-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: simplify async functionality to provider #385
base: main
Are you sure you want to change the base?
feat: simplify async functionality to provider #385
Conversation
df4fe5a
to
a6b8325
Compare
Hey @leohoare, thanks for the pr. I'm at KubeCon this week so reviews may be a bit delayed but I'll take a look as soon as possible. |
No rush @beeme1mr, enjoy KubeCon. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #385 +/- ##
==========================================
+ Coverage 97.54% 97.84% +0.29%
==========================================
Files 31 32 +1
Lines 1387 1622 +235
==========================================
+ Hits 1353 1587 +234
- Misses 34 35 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4f3e48d
to
657ef96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall nice work 🍻
def get_metadata(self) -> Metadata: | ||
return InMemoryMetadata() | ||
|
||
def get_provider_hooks(self) -> typing.List[Hook]: | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm wrong, but I think these two should also be async
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean more generally or specifically to the InMemoryProvider?
For this PR, I was limiting the scope of adding async functionality to the resolving calls.
This ensures we have backwards compatibility with current hooks / metadata calls and providers would just need to implement the async resolve calls.
I do agree support async hooks and metadata retrieval should be looked at in the future though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, meant it more generally, because currently those would block the call, which is not really relevant for the in-memory variant, but would be for remote calls.
But totally fine to change this in the future.
0bfde37
to
17acf42
Compare
6740235
to
0d68182
Compare
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
Signed-off-by: leohoare <leo@insight.co>
The current approach wasn't very compatible with mypy, I've updated settings to ignore overrides.
Can be overwritten to
Also given we're not forking the typing protocol
So I've ignored the error for that line. I'm not a heavy mypy user, let me know if there's a better or cleaner approach you'd prefer here. |
…ider Signed-off-by: Leo <37860104+leohoare@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behavior if a user registers an async provider but uses the synchronous client and vice versa? Could you please update the root readme examples for how to use this? If providers can't be used interchangeably, it may fragment the Python-related ecosystem in a confusing way.
This PR
Adds the ability for open feature providers to use async methods
Note: This version simplifies the implementation and doesn't change any of the hook implementation.
Related Issues
#284
#383
Notes
Just confirming the approach / POC for how this would work.