Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ __pycache__/
.idea/
.vscode/
tests/__pycache__/
dist/
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
54 changes: 54 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Releasing `kratix-sdk`

This document captures the steps for cutting a new version of the SDK and publishing it to PyPI.

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 <TESTPYPI_API_TOKEN>
# For the main PyPI token (if not already configured)
poetry config pypi-token.pypi <PYPI_API_TOKEN>
```
Alternatively export `POETRY_HTTP_BASIC_TESTPYPI_USERNAME="__token__"` and `POETRY_HTTP_BASIC_TESTPYPI_PASSWORD="<token>"` 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.

3. **Run quality checks**
```bash
make install # installs dependencies
make fmt && make lint # optional but recommended
make test # run pytest
```

4. **Build distributions**
```bash
poetry build
ls dist/ # verify the wheel and sdist exist
tar tf dist/kratix-sdk-<version>.tar.gz | head
```
Inspect the contents to ensure only expected files are included.

5. **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==<version>
```
Run a quick smoke test (`python -c "import kratix_sdk; print(kratix_sdk.__version__)"`) to ensure the build works.

6. **Publish to PyPI**
```bash
poetry publish --build
git tag v<version>
git push origin main --tags
```
PyPI credentials/API token must be configured in `~/.pypirc` beforehand.

7. **Communicate the release**
- Share release notes on the relevant channels.
- Update downstream sample projects if they pin versions.
11 changes: 8 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# 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

```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 .
```

Expand Down Expand Up @@ -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.
8 changes: 8 additions & 0 deletions kratix_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from importlib import metadata as importlib_metadata

from .status import Status
from .resource import Resource
from .kratix_sdk import (
Expand All @@ -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",
Expand All @@ -25,4 +32,5 @@
"get_output_dir",
"get_metadata_dir",
"set_metadata_dir",
"__version__",
]
3 changes: 1 addition & 2 deletions kratix_sdk/kratix_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
return self.workflow_action() == "delete"
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,41 @@ 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 <[email protected]>"]
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.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"
python = ">=3.10"
kubernetes = ">=33.0.0,<35"
PyYAML = ">=6.0.0,<7"

[tool.poetry.group.dev.dependencies]
pytest = "8.4.2"
ruff = "0.14.4"
pdoc = "^15"
pdoc = "^15"