Skip to content

Commit 40845dd

Browse files
authored
Add git-based dynamic versioning with setuptools-scm (#165)
1 parent 04d22c6 commit 40845dd

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/python_package.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
submodules: recursive
30+
fetch-tags: true
2731

2832
- name: Set up Python ${{ matrix.python-version }}
2933
uses: actions/setup-python@v6
@@ -40,7 +44,6 @@ jobs:
4044
4145
- name: Test with pytest
4246
run: |
43-
git submodule update --init --recursive
4447
pytest -vv --durations=100 --randomly-seed=42
4548
4649
build-status:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ share/python-wheels/
2626
.installed.cfg
2727
*.egg
2828
MANIFEST
29+
jax_galsim/_version.py
2930

3031
# PyInstaller
3132
# Usually these files are written by a python script from a template

jax_galsim/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
try:
2+
from ._version import version as __version__
3+
except ImportError:
4+
__version__ = "0.0.1.dev0"
5+
16
# Exception and Warning classes
27
from .errors import GalSimError, GalSimRangeError, GalSimValueError
38
from .errors import GalSimKeyError, GalSimIndexError, GalSimNotImplementedError

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
22
requires = [
33
"setuptools>=45",
4+
"setuptools-scm>=8",
45
]
56
build-backend = "setuptools.build_meta"
67

@@ -10,7 +11,7 @@ authors = [
1011
{name = "GalSim Developers"},
1112
]
1213
description = "The modular galaxy image simulation toolkit, but in JAX"
13-
version = "0.0.1rc1"
14+
dynamic = ["version"]
1415
license = {file = "LICENSE"}
1516
readme = "README.md"
1617
dependencies = [
@@ -31,6 +32,10 @@ home = "https://github.com/GalSim-developers/JAX-GalSim"
3132
[tool.setuptools.packages.find]
3233
include = ["jax_galsim*"]
3334

35+
[tool.setuptools-scm]
36+
write_to = "jax_galsim/_version.py"
37+
fallback_version = "0.0.1.dev0"
38+
3439
[tool.ruff.lint]
3540
select = ["E", "F", "I", "W"]
3641
ignore = ["C901", "E203", "E501"]

0 commit comments

Comments
 (0)