open-feature / python-sdk

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

feat: implement provider status #288

Closed federicobond closed 6 months ago

federicobond commented 6 months ago

This self-contained change introduces the functionality required to properly implement provider status events later. It has no user-visible changes at this point.

I wanted to split this out of the events pull request because it had the potential to snowball the size of the diff and lower the quality of the review in general.

I've introduced several seams that will make it easy to attach event handlers that respond to status changes later on.

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 89.28571% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 94.06%. Comparing base (7ba7d61) to head (81cf99c).

Files Patch % Lines
openfeature/provider/registry.py 80.00% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #288 +/- ## ========================================== - Coverage 94.71% 94.06% -0.66% ========================================== Files 18 18 Lines 492 539 +47 ========================================== + Hits 466 507 +41 - Misses 26 32 +6 ``` | [Flag](https://app.codecov.io/gh/open-feature/python-sdk/pull/288/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/288/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-feature) | `94.06% <89.28%> (-0.66%)` | :arrow_down: | 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.

toddbaert commented 6 months ago

The "short circuiting" behavior mentioned in 1.7.6 and 1.7.7 might be relevant enough to implement here as well: https://github.com/open-feature/spec/blob/37cf68b0d68b6814514bcded521b9e199efcead3/specification/sections/01-flag-evaluation.md?plain=1#L485-L502