Skip to content

Commit 1122dc8

Browse files
author
Henry
committed
✨ setuptools_scm pick up version from tags and commits
- see https://setuptools-scm.readthedocs.io/ - dynamic attribute picking
1 parent 9a60f9a commit 1122dc8

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ classifiers = [
2121
"Bug Tracker" = "https://github.com/RasmussenLab/python_package/issues"
2222
"Homepage" = "https://github.com/RasmussenLab/python_package"
2323

24-
[tool.setuptools.dynamic]
25-
version = {attr = "mockup.__version__"}
2624

2725
[project.optional-dependencies]
2826
docs = [
@@ -36,3 +34,11 @@ docs = [
3634
# Configure the Ruff linter: Ignore error number 501
3735
[tool.ruff]
3836
ignore = ["E501"]
37+
38+
[build-system]
39+
build-backend = "setuptools.build_meta"
40+
requires = ["setuptools>=64", "setuptools_scm>=8"]
41+
42+
[tool.setuptools_scm]
43+
# https://setuptools-scm.readthedocs.io/
44+
# used to pick up the version from the git tags or the latest commit.

src/mockup/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# The __init__.py file is loaded when the package is loaded.
22
# It is used to indicate that the directory in which it resides is a Python package
33

4-
# ! does not work yet:
5-
# from importlib import metadata
6-
# __version__ = metadata.version("mockup")
7-
__version__ = "24.02"
4+
5+
from importlib import metadata
6+
__version__ = metadata.version("rasmussenlab-mockup")
87

98
from .mockup import add_one, Circle
109

0 commit comments

Comments
 (0)