Skip to content

Commit

Permalink
dist ver
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 5, 2021
1 parent ec29506 commit 8fd2023
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__/
MANIFEST
*.so
/niftypet/nipet/cmake/
/niftypet/nipet/_dist_ver.py
/build/
/dist/
/_skbuild/
Expand Down
10 changes: 10 additions & 0 deletions niftypet/nipet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
"""initialise the NiftyPET NIPET package"""
__author__ = ("Pawel J. Markiewicz", "Casper O. da Costa-Luis")
__copyright__ = "Copyright 2020"
# version detector. Precedence: installed dist, git, 'UNKNOWN'
try:
from ._dist_ver import __version__
except ImportError:
try:
from setuptools_scm import get_version

__version__ = get_version(root="../..", relative_to=__file__)
except (ImportError, LookupError):
__version__ = "UNKNOWN"

import logging
import os
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4",
"ninst>=0.8.0", "numpy>=1.14", "miutil[cuda]>=0.4.0",
"scikit-build>=0.11.0", "cmake>=3.18", "ninja"]

[tool.setuptools_scm]
write_to = "niftypet/nipet/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"

0 comments on commit 8fd2023

Please sign in to comment.