From f804bd72a1a50f09315045d9874f8667c0b0d85a Mon Sep 17 00:00:00 2001 From: Francois Lanusse Date: Sat, 7 Feb 2026 12:53:56 +0100 Subject: [PATCH 1/4] Add git-based dynamic versioning with setuptools-scm Replace the hardcoded version in pyproject.toml with setuptools-scm, which derives versions automatically from git tags. This also exposes `jax_galsim.__version__` at runtime and ensures CI fetches full git history so setuptools-scm can resolve the version. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/python_package.yaml | 4 +++- .gitignore | 1 + jax_galsim/__init__.py | 5 +++++ pyproject.toml | 7 ++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_package.yaml b/.github/workflows/python_package.yaml index aa3275f0..c9944df4 100644 --- a/.github/workflows/python_package.yaml +++ b/.github/workflows/python_package.yaml @@ -24,6 +24,9 @@ jobs: steps: - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 @@ -40,7 +43,6 @@ jobs: - name: Test with pytest run: | - git submodule update --init --recursive pytest -vv --durations=100 --randomly-seed=42 build-status: diff --git a/.gitignore b/.gitignore index 2a21abb2..02207535 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +jax_galsim/_version.py # PyInstaller # Usually these files are written by a python script from a template diff --git a/jax_galsim/__init__.py b/jax_galsim/__init__.py index fe89288d..809efdee 100644 --- a/jax_galsim/__init__.py +++ b/jax_galsim/__init__.py @@ -1,3 +1,8 @@ +try: + from ._version import version as __version__ +except ImportError: + __version__ = "unknown" + # Exception and Warning classes from .errors import GalSimError, GalSimRangeError, GalSimValueError from .errors import GalSimKeyError, GalSimIndexError, GalSimNotImplementedError diff --git a/pyproject.toml b/pyproject.toml index ff8a2390..dad0f341 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ "setuptools>=45", + "setuptools-scm>=8", ] build-backend = "setuptools.build_meta" @@ -10,7 +11,7 @@ authors = [ {name = "GalSim Developers"}, ] description = "The modular galaxy image simulation toolkit, but in JAX" -version = "0.0.1rc1" +dynamic = ["version"] license = {file = "LICENSE"} readme = "README.md" dependencies = [ @@ -32,6 +33,10 @@ home = "https://github.com/GalSim-developers/JAX-GalSim" [tool.setuptools.packages.find] include = ["jax_galsim*"] +[tool.setuptools-scm] +write_to = "jax_galsim/_version.py" +fallback_version = "0.0.1rc1.dev0" + [tool.ruff.lint] select = ["E", "F", "I", "W"] ignore = ["C901", "E203", "E501"] From ac714245891a9d1e2e724de98d5daa5c67236b98 Mon Sep 17 00:00:00 2001 From: Francois Lanusse Date: Sat, 7 Feb 2026 13:42:22 +0100 Subject: [PATCH 2/4] Update jax_galsim/__init__.py Co-authored-by: Matthew R. Becker --- jax_galsim/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jax_galsim/__init__.py b/jax_galsim/__init__.py index 809efdee..540c3161 100644 --- a/jax_galsim/__init__.py +++ b/jax_galsim/__init__.py @@ -1,7 +1,7 @@ try: from ._version import version as __version__ except ImportError: - __version__ = "unknown" + __version__ = "0.0.1rc1.dev0" # Exception and Warning classes from .errors import GalSimError, GalSimRangeError, GalSimValueError From a8f4c80e45ab6ce71a8fb58ff6c4aceca488e546 Mon Sep 17 00:00:00 2001 From: Francois Lanusse Date: Sat, 7 Feb 2026 14:05:35 +0100 Subject: [PATCH 3/4] homogeneize default version --- jax_galsim/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jax_galsim/__init__.py b/jax_galsim/__init__.py index 540c3161..8e586d32 100644 --- a/jax_galsim/__init__.py +++ b/jax_galsim/__init__.py @@ -1,7 +1,7 @@ try: from ._version import version as __version__ except ImportError: - __version__ = "0.0.1rc1.dev0" + __version__ = "0.0.1.dev0" # Exception and Warning classes from .errors import GalSimError, GalSimRangeError, GalSimValueError diff --git a/pyproject.toml b/pyproject.toml index 8cd3a3e4..6780330a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ include = ["jax_galsim*"] [tool.setuptools-scm] write_to = "jax_galsim/_version.py" -fallback_version = "0.0.1rc1.dev0" +fallback_version = "0.0.1.dev0" [tool.ruff.lint] select = ["E", "F", "I", "W"] From d41c90df37825d868f4ff606b8bab7a24106c4fd Mon Sep 17 00:00:00 2001 From: Francois Lanusse Date: Sat, 7 Feb 2026 14:06:28 +0100 Subject: [PATCH 4/4] Update .github/workflows/python_package.yaml Co-authored-by: Matthew R. Becker --- .github/workflows/python_package.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python_package.yaml b/.github/workflows/python_package.yaml index c9944df4..af5f1878 100644 --- a/.github/workflows/python_package.yaml +++ b/.github/workflows/python_package.yaml @@ -27,6 +27,7 @@ jobs: with: fetch-depth: 0 submodules: recursive + fetch-tags: true - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6