Git rev for the LeanPy Lake dependency when pip-installed. Resolution order: LEANPY_GIT_REV env var, then the commit hash from direct_url.json (set by pip for git installs), then v{version} tag.
()
| 76 | |
| 77 | |
| 78 | def _leanpy_git_rev() -> str: |
| 79 | """Git rev for the LeanPy Lake dependency when pip-installed. |
| 80 | |
| 81 | Resolution order: LEANPY_GIT_REV env var, then the commit hash from |
| 82 | direct_url.json (set by pip for git installs), then v{version} tag. |
| 83 | """ |
| 84 | override = os.environ.get("LEANPY_GIT_REV") |
| 85 | if override: |
| 86 | return override |
| 87 | try: |
| 88 | dist = distribution("lean_py") |
| 89 | raw = dist.read_text("direct_url.json") |
| 90 | if raw: |
| 91 | info = json.loads(raw) |
| 92 | commit = info.get("vcs_info", {}).get("commit_id") |
| 93 | if commit: |
| 94 | return commit |
| 95 | except Exception: |
| 96 | pass |
| 97 | return f"v{_leanpy_version()}" |
| 98 | |
| 99 | |
| 100 | def _cache_key(lean_version: str, deps: tuple[str, ...]) -> str: |
no test coverage detected