open-feature / python-sdk

Python SDK for OpenFeature
https://openfeature.dev
Apache License 2.0
48 stars 16 forks source link

feat: add FeatureProvider protocol #268

Closed federicobond closed 7 months ago

federicobond commented 7 months ago

This PR introduces a new FeatureProvider protocol. Public API methods can use it as an argument type when they want to denote any provider, instead of AbstractProvider which is a bit clunky.

AbstractProvider remains as a provider base class for backward compatibility but it's import path at openfeature.provider.provider does not have the best ergonomics and we should begin working on a migration path before 1.0 is released.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (3b89760) 93.94% compared to head (ec6df50) 94.02%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #268 +/- ## ========================================== + Coverage 93.94% 94.02% +0.08% ========================================== Files 16 17 +1 Lines 446 452 +6 ========================================== + Hits 419 425 +6 Misses 27 27 ``` | [Flag](https://app.codecov.io/gh/open-feature/python-sdk/pull/268/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-feature) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/open-feature/python-sdk/pull/268/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-feature) | `94.02% <100.00%> (+0.08%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-feature#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.