Skip to content

Derive package version from git tags via setuptools-scm#131

Merged
hownowstephen merged 3 commits into
mainfrom
setuptools-scm-versioning
May 26, 2026
Merged

Derive package version from git tags via setuptools-scm#131
hownowstephen merged 3 commits into
mainfrom
setuptools-scm-versioning

Conversation

@hownowstephen
Copy link
Copy Markdown
Contributor

@hownowstephen hownowstephen commented May 22, 2026

Summary

  • Replace manually maintained customerio/__version__.py with setuptools-scm, which derives the version from git tags at build time
  • Update client_base.py and tests/test_api.py to use importlib.metadata.version() instead of importing the now-deleted __version__ module
  • Add fetch-depth: 0 to the publish workflow so setuptools-scm can read git tags during CI builds

Release flow after this change

  1. Create a GitHub release with tag vX.Y.Z
  2. Publish workflow triggers automatically
  3. setuptools-scm reads the tag → builds with the correct version → publishes to PyPI

No code changes needed per release.

Test plan

  • pytest — 59 tests pass
  • ruff check — clean
  • Verified importlib.metadata.version("customerio") resolves correctly from editable install

Note

Low Risk
Release/versioning workflow change with no auth or API behavior changes; main risk is mis-versioned builds if tags or shallow checkout are wrong, mitigated by fetch-depth: 0 on publish/CI.

Overview
Replaces the hand-maintained customerio/__version__.py with setuptools-scm, so the package version comes from git tags at build/install time instead of a committed constant.

Build and packaging: pyproject.toml adds setuptools-scm to the build backend, configures [tool.setuptools_scm], and removes the old tool.setuptools.dynamic attr-based version. Runtime and tests read the installed distribution version via importlib.metadata.version("customerio") in client_base.py and tests/test_api.py.

CI: actions/checkout in main (lint, test, package) and publish workflows now uses fetch-depth: 0 so full git history/tags are available for setuptools-scm during editable installs and PyPI builds.

Reviewed by Cursor Bugbot for commit 37abcff. Bugbot is set up for automated code reviews on this repo. Configure here.

Removes the manually maintained __version__.py file. Version is now
read from git tags at build time by setuptools-scm, so cutting a
GitHub release is the only step needed to publish a new version.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dba5e59. Configure here.

Comment thread .github/workflows/publish.yml
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsetuptools-scm@​10.0.5100100100100100

View full report

@hownowstephen hownowstephen merged commit 41076ed into main May 26, 2026
10 checks passed
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.

2 participants