Skip to content

Commit ab624e6

Browse files
Merge pull request #2613 from devitocodes/dynamic-version
install: switch to dynamic version to avoid _version file issue
2 parents 111b7ec + 705a2fe commit ab624e6

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

devito/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747
from devito.mpatches import * # noqa
4848

4949

50-
from ._version import version as __version__ # noqa
50+
from importlib.metadata import version, PackageNotFoundError
51+
try:
52+
__version__ = version("devito")
53+
except PackageNotFoundError:
54+
# devito is not installed
55+
__version__ = '0+untagged'
5156

5257

5358
def reinit_compiler(val):

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ exclude = ["docs", "tests", "examples"]
6868

6969

7070
[tool.setuptools_scm]
71-
write_to = 'devito/_version.py'
7271
fallback_version = "0+untagged"
7372

7473
[tool.flake8]

0 commit comments

Comments
 (0)