From 51f73bc0a91f108ae553d24f2ab882a6d7cc90fb Mon Sep 17 00:00:00 2001 From: Jason Kelly Date: Wed, 28 Oct 2026 14:14:01 -0400 Subject: [PATCH] Move asyncio dependencies into extras /kind feature Prior to version 36.0.0, the async client was a seperate pypi package. With version 36.0.0 including the async client in the main package, this increased the vulnerability/install footprint for users who don't require the asyncio client by now having to install several new dependency packages. This change makes asyncio dependencies an extra that will not be install by default. These dependencies are now only installed by specifying the asyncio extra - `pip install kubernetes[asyncio]`. Fixes https://github.com/kubernetes-client/python/issues/2739 Yes, users who install from pypi and need asyncio will need to `pip install kubernetes[asyncio]` to have all the dependencies installed. ```release-note Breaking change: the asyncio client's dependencies, such as `aiohttp` and `aiohttp-retry`, are no longer install by `pip install kubernetes`. Applications that user `kubernetes.aio` must install with `pip install kubernetes[asyncio]`. ``` Proposals), usage docs, etc.: Signed-off-by: Jason Kelly --- README.md | 6 ++++++ setup-release.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 26106dfad4..0d2516ae1c 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,12 @@ From [PyPI](https://pypi.python.org/pypi/kubernetes/) directly: pip install kubernetes ``` +To use the asyncio client (`kubernetes.aio`), install the `asyncio` extra: + +``` +pip install kubernetes[asyncio] +``` + ## Examples list all pods: diff --git a/setup-release.py b/setup-release.py index a7f7ff1b2f..c8f215358a 100644 --- a/setup-release.py +++ b/setup-release.py @@ -47,8 +47,15 @@ with open('test-requirements.txt') as f: TESTS_REQUIRES = f.readlines() +# The asyncio client (kubernetes.aio) ships in the same distribution, but its +# dependencies are only installed with the extra: pip install kubernetes[asyncio] +EXTRAS['asyncio'] = [] with open('requirements-asyncio.txt') as f: - REQUIRES_ASYNCIO = f.readlines() + for line in f: + line, _, _ = line.partition('#') + line = line.strip() + if line: + EXTRAS['asyncio'].append(line) with open('test-requirements-asyncio.txt') as f: TESTS_REQUIRES_ASYNCIO = f.readlines() @@ -63,7 +70,7 @@ license_expression="Apache-2.0", url="https://github.com/kubernetes-client/python", keywords=["Swagger", "OpenAPI", "Kubernetes"], - install_requires=REQUIRES+REQUIRES_ASYNCIO, + install_requires=REQUIRES, tests_require=TESTS_REQUIRES+TESTS_REQUIRES_ASYNCIO, extras_require=EXTRAS, packages=['kubernetes', 'kubernetes.client', 'kubernetes.config',