Skip to content

Fix pip install; eliminate deferred imports#3

Merged
kiranandcode merged 1 commit into
mainfrom
fix-pip-install
May 22, 2026
Merged

Fix pip install; eliminate deferred imports#3
kiranandcode merged 1 commit into
mainfrom
fix-pip-install

Conversation

@kiranandcode
Copy link
Copy Markdown
Collaborator

Summary

  • ManagedProject assumed _LEANPY_ROOT always pointed at a dev checkout with lakefile.lean. When installed via uv pip install, that path resolves to site-packages and lake build fails looking for a lakefile that does not exist. The managed lakefile now detects whether the Lean source tree is local and falls back to a git-based [[require]] keyed to the package version tag. LEANPY_GIT_REV overrides the rev for custom builds.
  • Moved all in-function imports to toplevel. Extracted _inductive_reg.py to break the one genuine circular dependency (core.py / solver.py). Cleaned up unused imports and dead variables flagged by ruff.

Test plan

  • uv run pytest tests -v (1265 passed)
  • ruff check lean_py/ clean
  • ruff format --check lean_py/ clean
  • mypy lean_py/ --ignore-missing-imports clean
  • Verify uv pip install lean_py && python -c "from lean_py.z3 import *" no longer crashes on lakefile lookup

…ev checkout

ManagedProject assumed _LEANPY_ROOT always pointed at the repo root
with lakefile.lean present. When installed via pip, that path resolves
to site-packages and lake build fails. The managed project now detects
whether the Lean source tree is local (editable install or checkout)
and switches to a git-based Lake require otherwise, keyed to the
package version tag. LEANPY_GIT_REV overrides the rev if needed.

Moved all in-function imports to toplevel. The one circular dependency
(core.py needs _register_inductive from solver.py, solver.py imports
from core.py) is broken by extracting _inductive_reg.py as a small
bridge module. Removed unused imports and variables flagged by ruff.
@kiranandcode kiranandcode merged commit 052377f into main May 22, 2026
4 checks passed
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