From 70cf683ccca02e68737ff328ae1a06551bcb56ba Mon Sep 17 00:00:00 2001 From: Johannes Thiem Date: Fri, 17 May 2024 10:24:13 +0200 Subject: [PATCH] remove pykube-ng references --- docs/howtos/write-an-operator.rst | 4 +-- docs/index.rst | 56 ------------------------------ docs/readme.rst | 57 ++++++++++++++++++++++++++++++- docs/users.rst | 4 +-- pykube/config.py | 2 +- pykube/http.py | 6 ++-- tests/test_http.py | 2 +- 7 files changed, 65 insertions(+), 66 deletions(-) delete mode 100644 docs/index.rst diff --git a/docs/howtos/write-an-operator.rst b/docs/howtos/write-an-operator.rst index ace11f4..4f0d339 100644 --- a/docs/howtos/write-an-operator.rst +++ b/docs/howtos/write-an-operator.rst @@ -28,7 +28,7 @@ You can now test the script locally with Pipenv_ and Minikube_ (run ``minikube s .. code-block:: bash - pipenv install pykube-ng + pipenv install new-pykube pipenv run python3 main.py See the operator in action by creating a deployment with the right annotation: @@ -51,7 +51,7 @@ Create a ``Dockerfile`` in the same directory as ``main.py``: WORKDIR / - RUN pip3 install pykube-ng + RUN pip3 install new-pykube COPY main.py / diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index fe73b05..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,56 +0,0 @@ -Pykube -====== - -.. image:: https://img.shields.io/pypi/v/pykube-ng.svg - :target: https://pypi.python.org/pypi/pykube-ng/ - -.. image:: https://img.shields.io/pypi/pyversions/pykube-ng.svg - :target: https://pypi.python.org/pypi/pykube-ng/ - -.. image:: https://img.shields.io/badge/license-apache-blue.svg - :target: https://pypi.python.org/pypi/pykube-ng/ - -Pykube (pykube-ng) is a lightweight Python 3+ client library for Kubernetes. - -Installation ------------- - -To install pykube, use pip:: - - pip install pykube-ng - -Usage ------ - -Query for all ready pods in a custom namespace: - -.. code:: python - - import operator - import pykube - - api = pykube.HTTPClient(pykube.KubeConfig.from_file()) - pods = pykube.Pod.objects(api).filter(namespace="gondor-system") - ready_pods = filter(operator.attrgetter("ready"), pods) - -Documentation -------------- - -.. toctree:: - :maxdepth: 2 - :glob: - - howtos/index - api/modules - README - changelog - users - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/readme.rst b/docs/readme.rst index 72a3355..3e0a1f3 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -1 +1,56 @@ -.. include:: ../README.rst +Pykube +====== + +.. image:: https://img.shields.io/pypi/v/new-pykube.svg + :target: https://pypi.python.org/pypi/new-pykube/ + +.. image:: https://img.shields.io/pypi/pyversions/new-pykube.svg + :target: https://pypi.python.org/pypi/new-pykube/ + +.. image:: https://img.shields.io/badge/license-apache-blue.svg + :target: https://pypi.python.org/pypi/new-pykube/ + +Pykube (new-pykube) is a lightweight Python 3+ client library for Kubernetes. + +Installation +------------ + +To install pykube, use pip:: + + pip install new-pykube + +Usage +----- + +Query for all ready pods in a custom namespace: + +.. code:: python + + import operator + import pykube + + api = pykube.HTTPClient(pykube.KubeConfig.from_file()) + pods = pykube.Pod.objects(api).filter(namespace="gondor-system") + ready_pods = filter(operator.attrgetter("ready"), pods) + +Documentation +------------- + +.. toctree:: + :maxdepth: 2 + :glob: + + howtos/index + api/modules + README + changelog + users + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/users.rst b/docs/users.rst index 140a0ab..47a9c17 100644 --- a/docs/users.rst +++ b/docs/users.rst @@ -3,11 +3,11 @@ Users The following projects use Pykube: -* `kube-downscaler `_ +* `py-kube-downscaler `_ * `kube-janitor `_ * `kube-ops-view `_ * `kube-resource-report `_ * `kube-web-view `_ * `pytest-kind `_ -Do you know of a project using Pykube and it's not listed here? Please `open a PR `_ to add it to the list. +Do you know of a project using Pykube and it's not listed here? Please `open a PR `_ to add it to the list. diff --git a/pykube/config.py b/pykube/config.py index a127caf..7ae1051 100644 --- a/pykube/config.py +++ b/pykube/config.py @@ -335,7 +335,7 @@ def filename(self): m = hashlib.md5() m.update(self._bytes) - path = Path(f"{tempfile.gettempdir()}/pykube-ng.{m.hexdigest()}.crt") + path = Path(f"{tempfile.gettempdir()}/new-pykube.{m.hexdigest()}.crt") if not path.exists() or path.stat().st_size == 0: with open(path, "wb") as f: f.write(self._bytes) diff --git a/pykube/http.py b/pykube/http.py index 0e0d0bd..f8e4be4 100644 --- a/pykube/http.py +++ b/pykube/http.py @@ -133,7 +133,7 @@ def _refresh_oidc_token(self, config): if not oidc_auth_installed: raise ImportError( "missing dependencies for OIDC token refresh support " - "(try pip install pykube-ng[oidc]" + "(try pip install new-pykube[oidc]" ) auth_config = config.user["auth-provider"]["config"] if "idp-certificate-authority" in auth_config: @@ -257,7 +257,7 @@ def _setup_request_auth(self, config, request, kwargs): dependencies = [google_auth_installed, jsonpath_installed] if not all(dependencies): raise ImportError( - "missing dependencies for GCP support (try pip install pykube-ng[gcp]" + "missing dependencies for GCP support (try pip install new-pykube[gcp]" ) auth_config = auth_provider.get("config", {}) if "cmd-path" in auth_config: @@ -352,7 +352,7 @@ def __init__( self.dry_run = dry_run session = requests.Session() - session.headers["User-Agent"] = f"pykube-ng/{__version__}" + session.headers["User-Agent"] = f"new-pykube/{__version__}" if not http_adapter: http_adapter = self.http_adapter_cls(self.config) session.mount("https://", http_adapter) diff --git a/tests/test_http.py b/tests/test_http.py index 38162d0..e68cb9a 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -38,7 +38,7 @@ def test_http(monkeypatch): mock_send.call_args[0][0].headers["Authorization"] == "Basic YWRtOnNvbWVwYXNzd29yZA==" ) - assert mock_send.call_args[0][0].headers["User-Agent"] == f"pykube-ng/{__version__}" + assert mock_send.call_args[0][0].headers["User-Agent"] == f"new-pykube/{__version__}" # check that the default HTTP timeout was set assert mock_send.call_args[1]["timeout"] == DEFAULT_HTTP_TIMEOUT