Nest async client under kubernetes.aio to fix kubernetes-asyncio collision#2586
Nest async client under kubernetes.aio to fix kubernetes-asyncio collision#2586karimzakzouk wants to merge 4 commits into
Conversation
|
Welcome @karimzakzouk! |
|
/assign @yliaog |
|
@karimzakzouk thanks for the PR, many files in this repo are generated, it is better to fix it in the script generator. I created a PR #2590 to switch from kubernetes_asyncio to kuberentes_aio to avoid the conflict. Please take a look. |
|
@yliaog That makes perfect sense, fixing it directly in the generator scripts is the right move. Thanks for the comment |
…bernetes.aio compatibility
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: karimzakzouk The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@yliaog Following up on your comment. Yes, I agree we should fix it in the generator scripts, so I updated this PR to do exactly that. I also added a script to All tests pass locally. Please take a look. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Right now,
setup-release.pyinstalls the new async client as a top-level package calledkubernetes_asyncio. The problem is that this directly collides with the existingkubernetes-asynciopackage on PyPI. When people try to install both, they overwrite each other's files and break.This PR fixes that by nesting the async client under
kubernetes.aioinstead (using setuptoolspackage_dir). This matches what other big libraries do (likeredis.asyncioorgrpc.aio) and cleanly avoids the naming collision.The main changes:
setup-release.pyto map the package tokubernetes.aiokubernetes_asyncio/to relative imports so the code works whether it's installed via the release bundle or as a standalone package for dev.try/exceptinkubernetes/__init__.pyto optionally expose theaiomodule.kubernetes.aioimport path.Which issue(s) this PR fixes:
Fixes #2583
Special notes for your reviewer:
Most of the files changed here are just bulk mechanical fixes (switching
from kubernetes_asyncio.client...to relative imports) across the code.The actual logic changes are pretty small and isolated to
setup-release.py, the two__init__.pyfiles, andapi_client.py.Note: We'll probably want to update the OpenAPI generator templates in a follow-up PR to spit out relative imports by default for future generation runs.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: