Skip to content

Read commit hash from pip metadata for git rev#4

Merged
kiranandcode merged 1 commit into
mainfrom
fix-git-rev
May 22, 2026
Merged

Read commit hash from pip metadata for git rev#4
kiranandcode merged 1 commit into
mainfrom
fix-git-rev

Conversation

@kiranandcode
Copy link
Copy Markdown
Collaborator

Summary

  • The 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 via pip install git+https://..., pip records the exact commit hash in direct_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))"

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.
@kiranandcode kiranandcode merged commit 0294940 into main May 22, 2026
10 checks passed
@kiranandcode kiranandcode deleted the fix-git-rev branch May 22, 2026 16:12
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