Skip to main content

Interact with the Lean theorem prover language server

Project description

leanclient

leanclient is a thin wrapper around the native Lean language server. It enables interaction with a Lean language server instance running in a subprocess.

Check out the documentation for more information.

Key Features

  • Interact: Query and change lean files via the LSP
  • Thin wrapper: Directly expose the Lean Language Server.
  • Synchronous: Requests block until a response is received.
  • Fast: Typically more than 99% of time is spent waiting.
  • Parallel: Easy batch processing of files using all your cores.

Currently in Beta

Not compatible with Lean 4.15.0 (stable) yet.

  • The API is almost stable.
  • There are missing features.
  • Needs more testing with different setups.
  • Any feedback is appreciated!

Next Features

  • Documentation: Tutorial & examples
  • Publishing on pipy

Potential Features

  • Virtual files (no actual file on disk), only in-memory in lsp and client
  • Use document versions to handle evolving file states
  • Automatic lean env setup for non Debian-based systems
  • Parallel implementation (multiple requests in-flight) like multilspy
  • Allow interaction before waitForDiagnostics returns

Missing LSP Methods

Might be implemented in the future:

  • callHierarchy/incomingCalls, callHierarchy/outgoingCalls, ...
  • $/lean/rpc/connect, $/lean/rpc/call, $/lean/rpc/release, $/lean/rpc/keepAlive
  • workspace/symbol, workspace/didChangeWatchedFiles, workspace/applyEdit, ...
  • textDocument/prepareRename, textDocument/rename
  • $/lean/ileanInfoUpdate, $/lean/ileanInfoFinal, $/lean/importClosure, $/lean/staleDependency

Run Tests

# python3 -m venv venv  # Or similar: Create environment
make install            # Installs python package and dev dependencies
make test               # Run all tests, also installs fresh lean env if not found
make test-profile       # Run all tests with cProfile

Documentation

Read the documentation at leanclient.readthedocs.io.

Run make docs to build the documentation locally.

License

MIT

Citing this repository is highly appreciated but not required by the license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leanclient-0.1.0b1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leanclient-0.1.0b1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file leanclient-0.1.0b1.tar.gz.

File metadata

  • Download URL: leanclient-0.1.0b1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for leanclient-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 1d27e3d9f1798fae4a93453aa062423a66d1d5138226be1ade2609be4af17db4
MD5 5fd06653875999739a6e46744b3d2749
BLAKE2b-256 8194c2568b39867379a66539be512e8644249008ce03997210afe08de71b06aa

See more details on using hashes here.

File details

Details for the file leanclient-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: leanclient-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for leanclient-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd5068c09b630f503658320abd556cc4a8d945ce1fcae41631a87aeae52b7afc
MD5 98ddbefa5f301a2a64e9e514e2c4f2cf
BLAKE2b-256 8f5b9ca1adfdb630a973a004932d6b4cbc01faba1c9937a069ece176923807ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page