Skip to content

refactor!: simplify namespaces to make public API more pythonic#172

Merged
toddbaert merged 9 commits into
open-feature:mainfrom
federicobond:pythonic-api-3
Sep 8, 2023
Merged

refactor!: simplify namespaces to make public API more pythonic#172
toddbaert merged 9 commits into
open-feature:mainfrom
federicobond:pythonic-api-3

Conversation

@federicobond

@federicobond federicobond commented Sep 1, 2023

Copy link
Copy Markdown
Member

For reviewing, it's best to follow the changes commit by commit.

This reduces the number of public namespaces in the sdk, following what we agreed on #101

I consolidated some modules into a single file when it made sense. The alternative would have been to prefix the internal namespace files with underscores and re-export the relevant symbols from __init__.py but it added a lot of boilerplate with little benefit. If the modules grow in size to make this necessary, it can be done later without breaking compatibility with existing users.

@codecov

codecov Bot commented Sep 1, 2023

Copy link
Copy Markdown

Codecov Report

Merging #172 (7444b29) into main (6f7cdb8) will decrease coverage by 0.54%.
The diff coverage is 95.31%.

@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
- Coverage   93.47%   92.93%   -0.54%     
==========================================
  Files          23       16       -7     
  Lines         460      439      -21     
==========================================
- Hits          430      408      -22     
- Misses         30       31       +1     
Flag Coverage Δ
unittests 92.93% <95.31%> (-0.54%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
open_feature/evaluation_context.py 90.90% <ø> (ø)
open_feature/hook/hook_support.py 86.48% <86.48%> (ø)
open_feature/flag_evaluation.py 97.72% <97.67%> (ø)
open_feature/api.py 100.00% <100.00%> (ø)
open_feature/client.py 95.60% <100.00%> (ø)
open_feature/exception.py 84.37% <100.00%> (ø)
open_feature/hook/__init__.py 86.11% <100.00%> (ø)
open_feature/provider/in_memory_provider.py 98.11% <100.00%> (-0.04%) ⬇️
open_feature/provider/no_op_provider.py 100.00% <100.00%> (ø)
open_feature/provider/provider.py 75.00% <100.00%> (ø)
... and 2 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

📢 Have feedback on the report? Share it here.

@beeme1mr beeme1mr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you! Please make sure to update the examples on the readme.

@toddbaert

Copy link
Copy Markdown
Member

I'll review this first thing next week. Thanks @federicobond

Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: Federico Bond <federicobond@gmail.com>
Comment thread tests/provider/test_in_memory_provider.py
@toddbaert

Copy link
Copy Markdown
Member

If the modules grow in size to make this necessary, it can be done later without breaking compatibility with existing users.

👍

@toddbaert toddbaert self-requested a review September 5, 2023 20:19

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@toddbaert

toddbaert commented Sep 5, 2023

Copy link
Copy Markdown
Member

Obviously this is a breaking change, but I have no issue merging it. I'll do so in the next few days unless I hear objections from the other (more Python-literate) reviewers.

@toddbaert toddbaert merged commit 793ced1 into open-feature:main Sep 8, 2023
kikihakiem pushed a commit to ResalApps/openfeature-python-sdk that referenced this pull request Aug 28, 2025
…ure#172)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants