-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add explicit sync and asyncio APIs #40
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
documentation
Improvements or additions to documentation
label
Apr 28, 2023
jacobtomlinson
changed the title
Add sync and asyncio APIs
Add explicit sync and asyncio APIs
Apr 28, 2023
Codecov Report
@@ Coverage Diff @@
## main #40 +/- ##
==========================================
- Coverage 97.33% 96.73% -0.60%
==========================================
Files 15 21 +6
Lines 1236 1562 +326
==========================================
+ Hits 1203 1511 +308
- Misses 33 51 +18
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #39
kr8s
uses asyncio under the hood by default. This PR changes the public API to be sync by default. In order to support a sync API this PR:objects.py
=>_objects.py
,portforward.py
=>_portforward.py
).kr8s.asyncio
so that asyncio is available but opt-in.universalasync
and modified to be opt-in only (it was only 100 lines or so and was hard to import and subclass without rewriting the whole thing).Api
and all objects includingPod
,Service
, etc with theuniversalasync
wrapper.Pod.ready()
=>Pod._ready()
, etc) and replace with new public method that awaits the private one.await
regardless of theuniveralasync
wrapper.nest-asyncio
to allow the sync API to be used within a running event loop (Jupyter is a common case where users may not know there is an event loop running).Sync API
Asyncio API