Repository navigation
Conversation
When building from a source tree without git metadata (e.g. GitHub tarball archives or git checkouts without the .git folder), hatch-vcs raises a LookupError since no version can be derived from tags. Set fallback-version = "0.0.0" in [tool.hatch.version] so such builds default to a placeholder version instead of failing. Fixes IBM#9
Author
|
Hi! I worked on this issue for Hacktoberfest. Some notes on the approach: Context: Since the issue was filed, the build system changed — What fails today: any source tree without git metadata can't be built. Reproduced with a git clone minus the The fix: Tested:
Happy to adjust if you'd prefer a different fallback strategy or a different default version! |
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
Building the package from a source tree without git metadata (e.g. GitHub tarball archives or a git checkout without the
.gitfolder) currently fails:This adds a
fallback-version = "0.0.0"to[tool.hatch.version]inpyproject.toml, so such builds default to a placeholder version instead of hard-failing. The issue was originally reported againstsetup.py, which asserted whenRELEASE_VERSIONwas missing;setup.pyhas since been replaced bypyproject.toml+hatch-vcs, and this is the equivalent fix in the current build system.Verification
.gitremoved):python -m buildnow succeeds, producingalchemy_config-0.0.0.tar.gz/alchemy_config-0.0.0-py3-none-any.whl.alchemy_config-1.2.1.dev35+ga760720ad— no regression.Fixes #9
Changes
pyproject.toml: addedfallback-version = "0.0.0"under[tool.hatch.version]