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
8 changes: 7 additions & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4.1.2
with:
# Full history + tags so hatch-vcs derives the version from the
# release tag instead of falling back to a guessed version.
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5.0.0
with:
Expand All @@ -24,4 +28,6 @@ jobs:
pip install build
python -m build
- name: Publish release to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
# v1.14.x bundles twine 7, which accepts Metadata-Version 2.5
# (v1.13.0 bundled twine 6.1 / packaging 25.0, which did not).
uses: pypa/gh-action-pypi-publish@v1.14.3
21 changes: 19 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ttn_client"
version = "1.3.0"
dynamic = ["version"]
authors = [
{ name="Angel Nunez Mencias", email="pypi@angelnu.com" },
]
Expand All @@ -21,5 +21,22 @@ Homepage = "https://github.com/angelnu/thethinksnetwork_python_client"
Issues = "https://github.com/angelnu/thethinksnetwork_python_client/issues"

[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "vcs"
# Fallback used when no git tag is reachable (e.g. shallow clones); the
# release workflow fetches the full history so tagged builds always win.
fallback-version = "0.0.0"

# Keep the emitted core metadata at 2.4: hatchling >= 1.30 defaults to
# Metadata-Version 2.5, which is rejected by the twine bundled in
# pypa/gh-action-pypi-publish < 1.14 (twine < 7). Pinning the emitted
# metadata version is deterministic, unlike pinning hatchling itself
# (its defaults are not monotonic: 1.30 -> 2.5, 1.31 -> 2.4, 1.32 -> 2.5).
[tool.hatch.build.targets.wheel]
core-metadata-version = "2.4"

[tool.hatch.build.targets.sdist]
core-metadata-version = "2.4"
Loading