Skip to content

Commit 0726e74

Browse files
committed
Configure setuptools-scm for version management
- Add setuptools-scm>=8 to build-system requires - Add [tool.setuptools_scm] with version_file - Replace hardcoded __version__ with import from generated _version.py - Remove version from [tool.setuptools.dynamic] (scm provides it) - Remove MANIFEST.in (setuptools-scm auto-includes git-tracked files) - Add unittest2pytest/_version.py to .gitignore
1 parent 5d5ba20 commit 0726e74

4 files changed

Lines changed: 10 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ Icon?
6262
Thumbs.db
6363
*.pid
6464
._.**~
65+
unittest2pytest/_version.py

MANIFEST.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=77"]
2+
requires = ["setuptools>=77", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -43,10 +43,11 @@ include-package-data = false
4343

4444
[tool.setuptools.dynamic]
4545
readme = {file = ["README.rst", "NEWLINE.rst", "CHANGELOG.rst"], content-type = "text/x-rst"}
46-
version = {attr = "unittest2pytest.__version__"}
46+
47+
[tool.setuptools_scm]
48+
version_file = "unittest2pytest/_version.py"
4749

4850
[tool.zest-releaser]
49-
python-file-with-version = "unittest2pytest/__init__.py"
5051
push-changes = false
5152
tag-format = "v{version}"
5253
tag-message = "unittest2pytest {version}"

unittest2pytest/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
__copyright__ = "Copyright 2015-2019 by Hartmut Goebel"
2222
__licence__ = "GNU General Public License version 3 or later (GPLv3+)"
2323

24-
2524
__title__ = "unittest2pytest"
26-
__version__ = "0.6.dev0"
25+
26+
try:
27+
from ._version import version as __version__
28+
except ImportError:
29+
__version__ = "0.0.0.dev0+unknown"

0 commit comments

Comments
 (0)