Registry / ai-ml / leanclient

leanclient

JSON →
library0.10.0pypypi✓ verified 80d ago

LeanClient is a Python library for interacting with the Lean theorem prover language server. It provides a client interface to the Lean 4 server, enabling automated theorem proving, project manipulation, and environment queries. Current version is 0.10.0, with a monthly release cadence.

pip install leanclient
INSTALL
IMPORT
SIG · LEANCLIENT
L
leanclient
ai-mlpythonv0.10.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LeanLSPClient
from leanclient import LeanLSPClient
from leanclient import LeanClient
LeanClientPool
from leanclient import LeanClientPool
SingleFileClient
from leanclient import SingleFileClient

Initialize LeanClient, connect to a Lean server (specify Lean version or path to lake), and evaluate a simple expression.

import os from leanclient import LeanClient # Connect to an existing Lean server (e.g., via LSP) client = LeanClient( lean_version="v4.7.0", lake_path=os.environ.get('LAKE_PATH', '') ) # Evaluate a Lean expression result = client.evaluate("1+1") print(result) # "2"
Debug
Known issues
breakingIn version 0.10.0, the `LeanClient` constructor now requires `lean_version` or `lake_path`. Omitting both raises `ValueError`. Previously some defaults were assumed.
fix
Always provide `lean_version` (e.g., 'v4.7.0') or `lake_path` pointing to a valid lake binary.
affects: >=0.10.0
deprecatedThe `LeanClient.connect()` method is deprecated since 0.9.0. Use direct instantiation.
fix
Replace `LeanClient().connect()` with `LeanClient(...)`.
affects: >=0.9.0
gotchaThe library only supports Lean 4 (not Lean 3). Using it with Lean 3 projects will fail.
fix
Ensure your Lean project is version 4. Use `lean --version` to check.
affects: all
gotchaThe environment variable `LAKE_PATH` is not set automatically. If you don't set it, lake may not be found.
fix
Set `LAKE_PATH` to the directory containing the `lake` executable, or install Lean via elan (which adds lake to PATH).
affects: all
Upgrade
Version history
0.10.0latest on PyPI · released May 4, 2026
Audit
Dependencies
pydanticrequiredUsed for data models and validation
Agent activity
18 hits · last 30 days
node
16
Resources
leanclient — pip install leanclient · libregistry