Read commit hash from pip metadata for git rev#4
Merged
Conversation
When installed via pip from a git URL, pip records the exact commit
hash in direct_url.json (PEP 610). The v{version} tag fallback fails
when no such tag exists on the repo. Read the commit hash first, fall
through to the version tag only for PyPI releases.
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
v{version}tag fallback in_leanpy_git_rev()fails when no such tag exists on the repo (revision not found 'v0.1.0'). When installed viapip install git+https://..., pip records the exact commit hash indirect_url.json(PEP 610). Read it from there first, fall through to the version tag only for PyPI releases.Test plan
rm -rf ~/.lean_py/managed/7ce93581bec36f9f(clear stale cache)uv pip install "lean_py @ git+https://github.com/BasisResearch/lean.py"python -c "from lean_py.z3 import *; x, y = Ints('x y'); prove(Implies(And(x > 0, y > 0), x + y > 0))"