Skip to content

Commit

Permalink
feat: use setuptools_scm for versioning
Browse files Browse the repository at this point in the history
Use `setuptools_scm` to generate version numbers from git as per the [Default versioning scheme](https://github.com/pypa/setuptools_scm/blob/main/docs/usage.md#default-versioning-scheme). It provides a convenient way to align version numbers with tags, and as a bonus, we can generate `dev` versions from any commit, and not just tagged commits.

When there is no git repo present (eg: inside a Docker container) fallback to version `0.0.0`
  • Loading branch information
tekumara committed Jul 13, 2024
1 parent c37d3f0 commit 7755085
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "{{cookiecutter.project_name}}"
description = "{{cookiecutter.description}}"
version = "0.0.0"
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.11"
dependencies = []
Expand All @@ -16,11 +16,14 @@ dev = [
]

[build-system]
requires = ["setuptools~=69.1", "wheel~=0.42"]
requires = ["setuptools~=69.1", "setuptools_scm~=8.0", "wheel~=0.42"]

[tool.setuptools.packages.find]
where = ["."]
exclude = ["tests*", "node_modules*", "build*"]
# enable setuptools_scm to set the version based on git tags
[tool.setuptools_scm]
fallback_version = "0.0.0"

[tool.pyright]
venvPath = "."
Expand Down

0 comments on commit 7755085

Please # to comment.