Skip to content

Commit

Permalink
hath / versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhsmit committed Aug 7, 2023
1 parent b3f4b9c commit bb4a70e
Show file tree
Hide file tree
Showing 7 changed files with 884 additions and 644 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,5 @@ ENV/
# Dask
dask-worker-space/


# Generated conda requirements file
_req-*.txt
# Hatch-vcs generated version file
_version.py
97 changes: 95 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions pyhdx/__version__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# placeholder version number
__version__ = "0.0.0"

# when we are on editable install from source, the _version file is present
# and we can get a version from there
# Adapted from: https://github.com/maresb/hatch-vcs-footgun-example
# Define the variable '__version__':
try:
from . import _version
# If we are in an editable install, the _versioneer file exist and we can use it to find the version
from pyhdx._versioneer import get_versions

__version__ = _version.get_versions()["version"]
# This will fail with LookupError if the package is not installed in
# editable mode or if Git is not installed.
__version__ = get_versions()["version"]
except ImportError:
pass
# If the project build with hatch, there should be a _version.py file
try:
from pyhdx._version import __version__ # noqa: F401 # type: ignore
except ModuleNotFoundError:
# The user is probably trying to run this without having installed
# the package, so complain.
raise RuntimeError("PyHDX is not correctly installed. Please install it with pip.")
Loading

0 comments on commit bb4a70e

Please sign in to comment.