Skip to content

Derive package version from git tag via setuptools-scm - #405

Merged
corydolphin merged 2 commits into
mainfrom
claude/sharp-wozniak-YzSU3
Jun 4, 2026
Merged

Derive package version from git tag via setuptools-scm#405
corydolphin merged 2 commits into
mainfrom
claude/sharp-wozniak-YzSU3

Conversation

@corydolphin

Copy link
Copy Markdown
Owner

The version was hardcoded as 0.0.1 in pyproject.toml and only rewritten by a sed step in the release workflow's throwaway checkout. As a result, GitHub's auto-generated source tarballs (and anything built from them, e.g. conda/distro packages) always reported 0.0.1, and flask_cors/version.py drifted out of sync (stuck at 5.0.0).

Make the git tag the single source of truth:

  • Use setuptools-scm dynamic versioning instead of a hardcoded version.
  • Add .git_archival.txt + .gitattributes export-subst so versions are recovered from GitHub's git-archive source tarballs.
  • Read the runtime version from importlib.metadata and drop the stale hardcoded flask_cors/version.py.
  • Drop the fragile sed-based set-version job from the release workflow and fetch full history/tags so setuptools-scm can derive the version.

Fixes #387

claude added 2 commits June 4, 2026 17:35
The version was hardcoded as 0.0.1 in pyproject.toml and only rewritten
by a sed step in the release workflow's throwaway checkout. As a result,
GitHub's auto-generated source tarballs (and anything built from them,
e.g. conda/distro packages) always reported 0.0.1, and flask_cors/version.py
drifted out of sync (stuck at 5.0.0).

Make the git tag the single source of truth:
- Use setuptools-scm dynamic versioning instead of a hardcoded version.
- Add .git_archival.txt + .gitattributes export-subst so versions are
  recovered from GitHub's git-archive source tarballs.
- Read the runtime __version__ from importlib.metadata and drop the stale
  hardcoded flask_cors/version.py.
- Drop the fragile sed-based set-version job from the release workflow and
  fetch full history/tags so setuptools-scm can derive the version.

Fixes #387
The switch to dynamic (setuptools-scm) versioning means the flask-cors
entry in uv.lock no longer carries a static version, so 'uv lock --locked'
(run by 'make check' in CI) needs the regenerated lockfile.
@corydolphin
corydolphin merged commit e1d4034 into main Jun 4, 2026
7 checks passed
@corydolphin
corydolphin deleted the claude/sharp-wozniak-YzSU3 branch June 4, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version in 5.0.1 tarball is actually marked as 0.0.1

2 participants