Skip to content

Commit 3f6e2dd

Browse files
Repair determiniation of version from git tag
1 parent 419fefa commit 3f6e2dd

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling", "setuptools-scm", "setuptools", "wheel"]
2+
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
####################
@@ -89,8 +89,10 @@ Source = "https://github.com/PioneersHub/pytanis"
8989
allow-direct-references = true
9090

9191
[tool.hatch.version]
92-
path = "src/pytanis/__init__.py"
93-
pattern = "__version__ = [\"'](?P<version>[^\"']*)[\"']"
92+
source = "vcs"
93+
94+
[tool.hatch.build.hooks.vcs]
95+
version-file = "src/pytanis/_version.py"
9496

9597
[tool.hatch.build]
9698
packages = ["src/pytanis"]
@@ -270,7 +272,6 @@ dependencies = [
270272
"pytest-vcr",
271273
"pytest-sugar",
272274
"hypothesis",
273-
"setuptools-scm",
274275
]
275276
[tool.hatch.envs.default.scripts]
276277
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/pytanis --cov=tests {args}"

src/pytanis/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""PyTanis - Python client for Pretalx."""
22

3-
__version__ = '0.9.6'
4-
5-
from importlib.metadata import PackageNotFoundError, version
63
from typing import TYPE_CHECKING
74

85
import structlog.stdlib
@@ -25,11 +22,9 @@
2522
from pytanis.helpdesk import HelpDeskClient
2623

2724
try:
28-
__version__ = version('pytanis')
29-
except PackageNotFoundError: # pragma: no cover
25+
from pytanis._version import __version__
26+
except ImportError: # pragma: no cover
3027
__version__ = 'unknown'
31-
finally:
32-
del version, PackageNotFoundError
3328

3429
__all__ = [
3530
'GSheetsClient',

0 commit comments

Comments
 (0)