Skip to content

Commit d2997ce

Browse files
authored
Merge pull request #31 from syntasso/chore/publish-to-pypi
chore: adding release information for pypi
2 parents 4c17ad6 + c2e5fcc commit d2997ce

File tree

8 files changed

+109
-11
lines changed

8 files changed

+109
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ __pycache__/
88
.idea/
99
.vscode/
1010
tests/__pycache__/
11+
dist/

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [0.3.2](https://github.com/syntasso/kratix-python/compare/v0.3.0...v0.3.2) (2025-11-23)
4+
5+
6+
### Chores
7+
8+
* setting python 3.10 as minimum required version
9+
* configuring application for release
10+
* exposing version in the package
11+
12+
313
## [0.3.0](https://github.com/syntasso/kratix-python/compare/v0.2.0...v0.3.0) (2025-10-29)
414

515

RELEASING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Releasing `kratix-sdk`
2+
3+
This document captures the steps for cutting a new version of the SDK and publishing it to PyPI.
4+
5+
1. **Set up Poetry credentials (one-time per machine)**
6+
```bash
7+
poetry config repositories.testpypi https://test.pypi.org/legacy/
8+
# Use a TestPyPI API token copied from https://test.pypi.org/manage/account/token/
9+
poetry config pypi-token.testpypi <TESTPYPI_API_TOKEN>
10+
# For the main PyPI token (if not already configured)
11+
poetry config pypi-token.pypi <PYPI_API_TOKEN>
12+
```
13+
Alternatively export `POETRY_HTTP_BASIC_TESTPYPI_USERNAME="__token__"` and `POETRY_HTTP_BASIC_TESTPYPI_PASSWORD="<token>"` before publishing.
14+
15+
2. **Prep the repo**
16+
- Update `pyproject.toml` with the new version under `[tool.poetry]`.
17+
- Add an entry to `CHANGELOG.md` summarising the release and changes.
18+
- Commit your work before building artifacts.
19+
20+
3. **Run quality checks**
21+
```bash
22+
make install # installs dependencies
23+
make fmt && make lint # optional but recommended
24+
make test # run pytest
25+
```
26+
27+
4. **Build distributions**
28+
```bash
29+
poetry build
30+
ls dist/ # verify the wheel and sdist exist
31+
tar tf dist/kratix-sdk-<version>.tar.gz | head
32+
```
33+
Inspect the contents to ensure only expected files are included.
34+
35+
5. **Publish to TestPyPI (recommended)**
36+
```bash
37+
poetry publish --repository testpypi --build
38+
python -m venv /tmp/kratix-sdk-test
39+
source /tmp/kratix-sdk-test/bin/activate
40+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple kratix-sdk==<version>
41+
```
42+
Run a quick smoke test (`python -c "import kratix_sdk; print(kratix_sdk.__version__)"`) to ensure the build works.
43+
44+
6. **Publish to PyPI**
45+
```bash
46+
poetry publish --build
47+
git tag v<version>
48+
git push origin main --tags
49+
```
50+
PyPI credentials/API token must be configured in `~/.pypirc` beforehand.
51+
52+
7. **Communicate the release**
53+
- Share release notes on the relevant channels.
54+
- Update downstream sample projects if they pin versions.

Readme.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# kratix-python
22

3-
You can read library document [here](https://syntasso.github.io/kratix-python).
3+
Library documentation can be found [here](https://syntasso.github.io/kratix-python).
44

55
## Installation
66

77
```bash
8-
# Install from git
8+
# From PyPI (preferred once published)
9+
pip install kratix-sdk
10+
11+
# From the main branch
912
pip install git+https://github.com/syntasso/kratix-python.git
1013

11-
# Or for development
14+
# Editable install for local development
1215
pip install -e .
1316
```
1417

@@ -74,3 +77,5 @@ Library is under `kratix_sdk`. Examples of Promises using this library can be fo
7477
* `make fmt` code formatting using `ruff`
7578

7679
* `make lint` linting using `ruff`
80+
81+
See `RELEASING.md` for the tested release workflow when publishing to TestPyPI/PyPI.

kratix_sdk/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from importlib import metadata as importlib_metadata
2+
13
from .status import Status
24
from .resource import Resource
35
from .kratix_sdk import (
@@ -12,6 +14,11 @@
1214
from .promise import Promise
1315
from .types import GroupVersionKind, DestinationSelector
1416

17+
try:
18+
__version__ = importlib_metadata.version("kratix-sdk")
19+
except importlib_metadata.PackageNotFoundError: # pragma: no cover - source tree fallback
20+
__version__ = "0.0.0"
21+
1522
__all__ = [
1623
"Status",
1724
"Resource",
@@ -25,4 +32,5 @@
2532
"get_output_dir",
2633
"get_metadata_dir",
2734
"set_metadata_dir",
35+
"__version__",
2836
]

kratix_sdk/kratix_sdk.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ def publish_status(self, resource: Resource, status: Status) -> None:
154154
body=body,
155155
)
156156

157-
158157
def is_promise_workflow(self) -> bool:
159158
"""Returns true if the workflow is a promise workflow."""
160159
return self.workflow_type() == "promise"
@@ -169,4 +168,4 @@ def is_configure_action(self) -> bool:
169168

170169
def is_delete_action(self) -> bool:
171170
"""Returns true if the workflow is a delete action."""
172-
return self.workflow_action() == "delete"
171+
return self.workflow_action() == "delete"

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,41 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "kratix-sdk"
7-
version = "0.3.0"
7+
version = "0.3.2"
88
description = "Kratix SDK for writing Promises workflows"
99
readme = "Readme.md"
10+
authors = ["Syntasso <hello@syntasso.io>"]
1011
license = "Apache-2.0"
1112
homepage = "https://github.com/syntasso/kratix-python"
1213
repository = "https://github.com/syntasso/kratix-python"
14+
documentation = "https://syntasso.github.io/kratix-python"
15+
keywords = ["kratix", "platform-engineering", "promises", "sdk"]
1316
packages = [{include = "kratix_sdk"}]
17+
classifiers = [
18+
"Development Status :: 4 - Beta",
19+
"Intended Audience :: Developers",
20+
"License :: OSI Approved :: Apache Software License",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
26+
"Topic :: Software Development :: Build Tools",
27+
"Topic :: Utilities",
28+
]
29+
30+
[tool.poetry.urls]
31+
"Source" = "https://github.com/syntasso/kratix-python"
32+
"Documentation" = "https://syntasso.github.io/kratix-python"
33+
"Bug Tracker" = "https://github.com/syntasso/kratix-python/issues"
34+
"Changelog" = "https://github.com/syntasso/kratix-python/blob/main/CHANGELOG.md"
1435

1536
[tool.poetry.dependencies]
16-
python = ">=3.9"
37+
python = ">=3.10"
1738
kubernetes = ">=33.0.0,<35"
1839
PyYAML = ">=6.0.0,<7"
1940

2041
[tool.poetry.group.dev.dependencies]
2142
pytest = "8.4.2"
2243
ruff = "0.14.4"
23-
pdoc = "^15"
44+
pdoc = "^15"

0 commit comments

Comments
 (0)