MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / _leanpy_git_rev

Function _leanpy_git_rev

lean_py/project.py:78–97  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

76
77
78def _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
100def _cache_key(lean_version: str, deps: tuple[str, ...]) -> str:

Callers 2

_cache_keyFunction · 0.85
_generate_lakefileFunction · 0.85

Calls 2

_leanpy_versionFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected