Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix setuptools-scm version in container image #575

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

pederhan
Copy link
Member

Fix container image versioning for tagged releases

Problem:
When building container images from tagged commits, setuptools-scm incorrectly appends commit hash and date to the version number. This happens because our build process creates requirements.txt, as well as possibly modifying uv.lock, causing setuptools-scm to detect the repository as "dirty" even though we're building from a clean tagged commit.

Solution:

  1. Add requirements.txt to .gitignore to prevent it from being tracked
  2. Set UV_FROZEN=1 environment variable to prevent any modifications to the lock file during build
  3. Update lock file to match dependencies in pyproject.toml (was missing coverage[toml] from Further coverage fixes, now with mocks. #568).

This ensures that container images built from tags (e.g., v1.2.3) will have clean version numbers that match the git tag instead of versions with appended hashes (e.g., 1.2.3.dev5+g123abc).

Copy link
Collaborator

@terjekv terjekv left a comment

Choose a reason for hiding this comment

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

LGTM (for loose enough versions of "good" that can be applied to python package management)

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 99.022%. remained the same
when pulling a721e30 on pederhan:fix-scm-version
into 43c9b5c on unioslo:master.

@pederhan pederhan merged commit 81b69a4 into unioslo:master Feb 20, 2025
16 checks passed
@pederhan pederhan deleted the fix-scm-version branch February 20, 2025 10:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants