Skip to content

Commit

Permalink
build: use fallback version.
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Feb 9, 2024
1 parent 4e52517 commit 03518c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ where=["src"]
write_to = "src/snkf/_version.py"
version_scheme = "python-simplified-semver"
local_scheme="no-local-version"
fallback_version="v99-dev"

[tool.coverage.report]
precision = 2
Expand Down
17 changes: 6 additions & 11 deletions src/snkf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@
"load_from_yaml",
]

try:
# -- Distribution mode --
# import from _version.py generated by setuptools_scm during release
from ._version import version as __version__
except ImportError: # pragma: no cover
# -- Source mode --
# use setuptools_scm to get the current version from src using git
from os import path as _path

from setuptools_scm import get_version as _gv
from importlib.metadata import version, PackageNotFoundError

__version__ = _gv(_path.join(_path.dirname(__file__), _path.pardir))
try:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass

0 comments on commit 03518c1

Please sign in to comment.