Skip to content

Improvement: Switch to git tags for version during package build.#142

Open
flamingbear wants to merge 1 commit into
mainfrom
fix/build-version-from-tag
Open

Improvement: Switch to git tags for version during package build.#142
flamingbear wants to merge 1 commit into
mainfrom
fix/build-version-from-tag

Conversation

@flamingbear

@flamingbear flamingbear commented Jun 24, 2026

Copy link
Copy Markdown
Member

Jira Issue ID

HARMONY-FIX

Description

Derive the package version from the git tag at build time usind setuptools_scm
so releases no longer require CI to bump and force push to main.

This will allow us to add branch protections to the default branch without
having to add an application to add an exception to the rules. And we can keep
the same basic workflow.

Note: harmony/__init__.py will no longer have a literal version string.

Local Test Steps

This is a little tough to test, but you can do a few things.

You check out this commit and build the package with make build

You will get:

Successfully built harmony_py-1.4.1.dev1+gac794a9bf.tar.gz and harmony_py-1.4.1.dev1+gac794a9bf-py3-none-any.whl

so +gac794a9bf == built from git commit.

Or you can use a pretend version:

❯ SETUPTOOLS_SCM_PRETEND_VERSION=2.4.0 make build

and get

Successfully built harmony_py-2.4.0.tar.gz and harmony_py-2.4.0-py3-none-any.whl

you can check the harmony.__version__ still works on either of these by installing the wheel and checking the version

❯ python -c "import harmony; print(harmony.__version__)"

You can actually fake install any version with the make command:

❯ SETUPTOOLS_SCM_PRETEND_VERSION=3.0.3 make install

...Successfully installed harmony-py-3.0.3

❯ python -c "import harmony; print(harmony.__version__)"
3.0.3

The final way you can test how CI/CD will respond is by adding a local tag in the form v.X.Y.Z on the checked out branch with everything clean, then a make build will generate a vX.Y.Z package.

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)

@flamingbear flamingbear marked this pull request as ready for review June 24, 2026 22:22
Comment thread pyproject.toml

[build-system]
requires = ["setuptools"]
requires = ["setuptools>=64", "setuptools_scm>=8"]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

dynamic version comes from setuptools_scm now

Rather than bumping the tag in the CI/CD and force pushing back to main.
Use setuptools_scm to get the git tag at build time.
@flamingbear flamingbear force-pushed the fix/build-version-from-tag branch from ac794a9 to 86812d4 Compare June 24, 2026 22:31
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.

1 participant