Skip to content
Merged
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: python -c "import sys; print(sys.version)"
- name: Install sdist without optional dependencies
run: pip install dist/*.tar.gz
- run: python -c 'import trx.version; print(trx.version.__version__)'
- run: python -c 'import trx; print(trx.__version__)'
- name: Install pytest
run: pip install pytest psutil pytest-console-scripts pytest-cov
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev,test]
python -c "import trx; print(trx.__version__)"

- name: Test
run: spin test
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ packages = ["trx"]
include-package-data = true

[tool.setuptools_scm]
write_to = "trx/version.py"
write_to = "trx/_version.py"
fallback_version = "0.0"
local_scheme = "no-local-version"

Expand Down
10 changes: 10 additions & 0 deletions trx/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
"""TRX file format for brain tractography data."""

try:
from ._version import __version__ # noqa: F401
except ImportError:
try:
from importlib.metadata import PackageNotFoundError, version

__version__ = version("trx-python")
except (ImportError, PackageNotFoundError):
__version__ = "unknown"