From a57eb39d34be8e8ba02ea06f8257d125c8623177 Mon Sep 17 00:00:00 2001 From: Shane Dowling <167567+shano@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:37:47 +0000 Subject: [PATCH 1/2] chore: adding release information for pypi --- RELEASING.md | 45 ++++++++++++++++++++++++++++++++++++++++ Readme.md | 9 ++++++-- kratix_sdk/kratix_sdk.py | 3 +-- pyproject.toml | 24 ++++++++++++++++++++- 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 RELEASING.md diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..c07f3e8 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,45 @@ +# Releasing `kratix-sdk` + +This document captures the steps for cutting a new version of the SDK and publishing it to PyPI. + +1. **Prep the repo** + - Update `pyproject.toml` with the new version under `[tool.poetry]`. + - Add an entry to `CHANGELOG.md` summarising the release and changes. + - Commit your work before building artifacts. + +2. **Run quality checks** + ```bash + make install # installs dependencies + make fmt && make lint # optional but recommended + make test # run pytest + ``` + +3. **Build distributions** + ```bash + poetry build + ls dist/ # verify the wheel and sdist exist + tar tf dist/kratix-sdk-.tar.gz | head + ``` + Inspect the contents to ensure only expected files are included. + +4. **Publish to TestPyPI (recommended)** + ```bash + poetry publish --repository testpypi --build + python -m venv /tmp/kratix-sdk-test + source /tmp/kratix-sdk-test/bin/activate + pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple kratix-sdk== + ``` + Run a quick smoke test (`python -c "import kratix_sdk; print(kratix_sdk.__version__)"`) to ensure the build works. + +5. **Publish to PyPI** + ```bash + poetry publish --build + git tag v + git push origin main --tags + ``` + PyPI credentials/API token must be configured in `~/.pypirc` beforehand. + +6. **Communicate the release** + - Share release notes on the relevant channels. + - Update downstream sample projects if they pin versions. + diff --git a/Readme.md b/Readme.md index 6ac95dd..3d0bd61 100644 --- a/Readme.md +++ b/Readme.md @@ -5,10 +5,13 @@ You can read library document [here](https://syntasso.github.io/kratix-python). ## Installation ```bash -# Install from git +# From PyPI (preferred once published) +pip install kratix-sdk + +# From the main branch pip install git+https://github.com/syntasso/kratix-python.git -# Or for development +# Editable install for local development pip install -e . ``` @@ -74,3 +77,5 @@ Library is under `kratix_sdk`. Examples of Promises using this library can be fo * `make fmt` code formatting using `ruff` * `make lint` linting using `ruff` + +See `RELEASING.md` for the tested release workflow when publishing to TestPyPI/PyPI. diff --git a/kratix_sdk/kratix_sdk.py b/kratix_sdk/kratix_sdk.py index c52fc91..81278a2 100644 --- a/kratix_sdk/kratix_sdk.py +++ b/kratix_sdk/kratix_sdk.py @@ -154,7 +154,6 @@ def publish_status(self, resource: Resource, status: Status) -> None: body=body, ) - def is_promise_workflow(self) -> bool: """Returns true if the workflow is a promise workflow.""" return self.workflow_type() == "promise" @@ -169,4 +168,4 @@ def is_configure_action(self) -> bool: def is_delete_action(self) -> bool: """Returns true if the workflow is a delete action.""" - return self.workflow_action() == "delete" \ No newline at end of file + return self.workflow_action() == "delete" diff --git a/pyproject.toml b/pyproject.toml index f612712..02ba44e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,10 +7,32 @@ name = "kratix-sdk" version = "0.3.0" description = "Kratix SDK for writing Promises workflows" readme = "Readme.md" +authors = ["Syntasso "] license = "Apache-2.0" homepage = "https://github.com/syntasso/kratix-python" repository = "https://github.com/syntasso/kratix-python" +documentation = "https://syntasso.github.io/kratix-python" +keywords = ["kratix", "platform-engineering", "promises", "sdk"] packages = [{include = "kratix_sdk"}] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Build Tools", + "Topic :: Utilities", +] + +[tool.poetry.urls] +"Source" = "https://github.com/syntasso/kratix-python" +"Documentation" = "https://syntasso.github.io/kratix-python" +"Bug Tracker" = "https://github.com/syntasso/kratix-python/issues" +"Changelog" = "https://github.com/syntasso/kratix-python/blob/main/CHANGELOG.md" [tool.poetry.dependencies] python = ">=3.9" @@ -20,4 +42,4 @@ PyYAML = ">=6.0.0,<7" [tool.poetry.group.dev.dependencies] pytest = "8.4.2" ruff = "0.14.4" -pdoc = "^15" \ No newline at end of file +pdoc = "^15" From c2e5fccb026d97d0b30f26f3a1e5aa256d8b8025 Mon Sep 17 00:00:00 2001 From: Shane Dowling <167567+shano@users.noreply.github.com> Date: Thu, 13 Nov 2025 15:46:43 +0000 Subject: [PATCH 2/2] chore: exposing version and preparing 0.3.2 release --- .gitignore | 1 + CHANGELOG.md | 10 ++++++++++ RELEASING.md | 23 ++++++++++++++++------- Readme.md | 2 +- kratix_sdk/__init__.py | 8 ++++++++ poetry.lock | 6 +++--- pyproject.toml | 5 ++--- 7 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 92bbd8b..b04a2d8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__/ .idea/ .vscode/ tests/__pycache__/ +dist/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e0413..0ac72b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [0.3.2](https://github.com/syntasso/kratix-python/compare/v0.3.0...v0.3.2) (2025-11-23) + + +### Chores + +* setting python 3.10 as minimum required version +* configuring application for release +* exposing version in the package + + ## [0.3.0](https://github.com/syntasso/kratix-python/compare/v0.2.0...v0.3.0) (2025-10-29) diff --git a/RELEASING.md b/RELEASING.md index c07f3e8..e3d1e03 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,19 +2,29 @@ This document captures the steps for cutting a new version of the SDK and publishing it to PyPI. -1. **Prep the repo** +1. **Set up Poetry credentials (one-time per machine)** + ```bash + poetry config repositories.testpypi https://test.pypi.org/legacy/ + # Use a TestPyPI API token copied from https://test.pypi.org/manage/account/token/ + poetry config pypi-token.testpypi + # For the main PyPI token (if not already configured) + poetry config pypi-token.pypi + ``` + Alternatively export `POETRY_HTTP_BASIC_TESTPYPI_USERNAME="__token__"` and `POETRY_HTTP_BASIC_TESTPYPI_PASSWORD=""` before publishing. + +2. **Prep the repo** - Update `pyproject.toml` with the new version under `[tool.poetry]`. - Add an entry to `CHANGELOG.md` summarising the release and changes. - Commit your work before building artifacts. -2. **Run quality checks** +3. **Run quality checks** ```bash make install # installs dependencies make fmt && make lint # optional but recommended make test # run pytest ``` -3. **Build distributions** +4. **Build distributions** ```bash poetry build ls dist/ # verify the wheel and sdist exist @@ -22,7 +32,7 @@ This document captures the steps for cutting a new version of the SDK and publis ``` Inspect the contents to ensure only expected files are included. -4. **Publish to TestPyPI (recommended)** +5. **Publish to TestPyPI (recommended)** ```bash poetry publish --repository testpypi --build python -m venv /tmp/kratix-sdk-test @@ -31,7 +41,7 @@ This document captures the steps for cutting a new version of the SDK and publis ``` Run a quick smoke test (`python -c "import kratix_sdk; print(kratix_sdk.__version__)"`) to ensure the build works. -5. **Publish to PyPI** +6. **Publish to PyPI** ```bash poetry publish --build git tag v @@ -39,7 +49,6 @@ This document captures the steps for cutting a new version of the SDK and publis ``` PyPI credentials/API token must be configured in `~/.pypirc` beforehand. -6. **Communicate the release** +7. **Communicate the release** - Share release notes on the relevant channels. - Update downstream sample projects if they pin versions. - diff --git a/Readme.md b/Readme.md index 3d0bd61..da37d90 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # kratix-python -You can read library document [here](https://syntasso.github.io/kratix-python). +Library documentation can be found [here](https://syntasso.github.io/kratix-python). ## Installation diff --git a/kratix_sdk/__init__.py b/kratix_sdk/__init__.py index 38084cd..ddd786b 100644 --- a/kratix_sdk/__init__.py +++ b/kratix_sdk/__init__.py @@ -1,3 +1,5 @@ +from importlib import metadata as importlib_metadata + from .status import Status from .resource import Resource from .kratix_sdk import ( @@ -12,6 +14,11 @@ from .promise import Promise from .types import GroupVersionKind, DestinationSelector +try: + __version__ = importlib_metadata.version("kratix-sdk") +except importlib_metadata.PackageNotFoundError: # pragma: no cover - source tree fallback + __version__ = "0.0.0" + __all__ = [ "Status", "Resource", @@ -25,4 +32,5 @@ "get_output_dir", "get_metadata_dir", "set_metadata_dir", + "__version__", ] diff --git a/poetry.lock b/poetry.lock index 3aa7550..b5f22e6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. [[package]] name = "cachetools" @@ -742,5 +742,5 @@ test = ["websockets"] [metadata] lock-version = "2.1" -python-versions = ">=3.9" -content-hash = "7e130a3b27d684978c92f33c3ac8a11ec0655de9e2ac1529edb51660968efc9f" +python-versions = ">=3.10" +content-hash = "9df3f044d00d9fb3a7b7500fd9d58e5b9b192bb68b47ee9739ad84dbe4f2c248" diff --git a/pyproject.toml b/pyproject.toml index 02ba44e..a2920aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "kratix-sdk" -version = "0.3.0" +version = "0.3.2" description = "Kratix SDK for writing Promises workflows" readme = "Readme.md" authors = ["Syntasso "] @@ -20,7 +20,6 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -35,7 +34,7 @@ classifiers = [ "Changelog" = "https://github.com/syntasso/kratix-python/blob/main/CHANGELOG.md" [tool.poetry.dependencies] -python = ">=3.9" +python = ">=3.10" kubernetes = ">=33.0.0,<35" PyYAML = ">=6.0.0,<7"