feat: dockerize + switch to hatch-vcs versioning#21
Merged
Conversation
- Switch version source to hatch-vcs (driven by git tags). __init__.py reads from the generated _version.py with importlib.metadata fallback for editable installs. - Add Dockerfile based on python:3.13-slim-bookworm with all runtime tools (dar, par2, genisoimage, growisofs, dvd+rw-tools, udisks2, lsof, eject, mount). Version is injected via SETUPTOOLS_SCM_PRETEND_VERSION build-arg, so .git/ does not need to be in the build context. - Add docker-publish workflow that builds linux/amd64 + linux/arm64 images on v*.*.* tag push and publishes them to ghcr.io with semver tag fan-out (5.0.0, 5.0, 5, latest). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__init__.pyloads from the generated_version.pywith animportlib.metadatafallback for editable installs (and a final0.0.0+unknownsafety net). Firstv*.*.*tag will give us a proper__version__.python:3.13-slim-bookworm+ all runtime tools listed inCLAUDE.md(dar,par2,genisoimage,growisofs,dvd+rw-tools,udisks2,lsof,eject,mount). Version is injected viaSETUPTOOLS_SCM_PRETEND_VERSIONbuild-arg, so.git/does not need to be in the build context (which keeps the context small and avoids the usual hatch-vcs-in-Docker pitfalls).v*.*.*tag push. Buildslinux/amd64+linux/arm64via Buildx + QEMU and publishes toghcr.io/xitee1/bd-archiverwith semver tag fan-out (5.0.0,5.0,5,latestfor the highest stable).Notes
v5.0.0andv5.0.0rc1work;v5.0.0-rc1(SemVer-style hyphenated prerelease) would fail the Docker build because hatch-vcs takes the string verbatim.v5.0.0tag should produce the first published image atghcr.io/xitee1/bd-archiver:5.0.0(+5.0,5,latest).Test plan
pip install -e '.[dev]'regenerates_version.py;bd-archive --versionshows a dynamic dev version (no hardcoded5.0.0)git statusshows_version.pyas ignoreddocker build --build-arg BD_ARCHIVE_VERSION=9.9.9 .succeeds;docker run --rm <img> --versionprintsbd-archive 9.9.9dar,par2,mkisofs,growisofs,dvd+rw-mediainfo,udisksctl,lsof,eject,mount,umount)ruff check+ruff format --checkpassv5.0.0tag, watch the workflow, verify image appears atghcr.io/xitee1/bd-archiver:5.0.0🤖 Generated with Claude Code