Skip to content

Commit

Permalink
pyproject.toml: use setuptools_scm to determine version number
Browse files Browse the repository at this point in the history
This means we no longer have to update the version number manually
when creating a new release because just setting a tag suffices.

It does however also add some complexity and magic to the project,
like incorrect version numbers when the git history is not complete
(hence why we now clone the whole history in the build job) and
all files included in the git repository now being shipped in the
source distribution (while previously only files mentioned in the
MANIFEST.in were included).

The beneftis when it comes to automating the release process do
however outweight the drawbacks of added compexity.

We use `local_scheme = "no-local-version"` to prevent random files
in the project directory from causing "+dirty" version numbers.

Signed-off-by: Leonard Göhrs <[email protected]>
  • Loading branch information
hnez committed May 6, 2024
1 parent 7bf3281 commit f6e7c68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check-and-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# include tags and full history for setuptools_scm
fetch-depth: 0
- run: make build
- uses: actions/upload-artifact@v4
with:
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools", "setuptools_scm[toml]"]
build-backend = "setuptools.build_meta"

[project]
name = "usbsdmux"
description = "Tool to control an USB-SD-Mux from the command line"
version = "24.01.1"
authors = [
{ name = "Chris Fiege", email = "[email protected]" },
]
Expand All @@ -18,6 +17,7 @@ classifiers = [
"Operating System :: Unix",
"Programming Language :: Python :: 3 :: Only",
]
dynamic = ["version"] # via setuptools_scm

[project.optional-dependencies]
mqtt = ["paho-mqtt"]
Expand All @@ -37,6 +37,9 @@ packages = [
]
include-package-data = true

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.ruff]
line-length = 119
exclude = [
Expand Down

0 comments on commit f6e7c68

Please sign in to comment.