Lemma is a rewrite of elan that addresses critical usability issues, particularly around proxy support and custom toolchain sources.
After analyzing the elan codebase, we identified several critical issues that make it difficult to use in enterprise and restricted network environments.
- HTTP, HTTPS, and SOCKS5 proxies with authentication
- Standard environment variables:
HTTP_PROXY,HTTPS_PROXY,NO_PROXY
Configure custom Lean release index URLs:
release_url = "https://release.custom.org"Install Lemma as a Python package. The package name and command are both lemma.
pipx install lemmaIf you do not use pipx, install with Python's user site instead:
python -m pip install --user lemmaOn Windows, use the Python launcher if needed:
py -m pip install --user lemmaAfter installation, run a setup command such as lemma lean install stable. Lemma will create proxy commands such as lean, lake, and leanc under ~/.lemma/bin. Add that directory to your PATH if you want to call those proxies directly.
# Build from source
cargo build --release -p lemma
# Install the CLI from this checkout
cargo install --path crates/lemma-rsUse the same package manager that installed Lemma:
pipx upgrade lemma
# or
python -m pip install --user --upgrade lemmalemma self update prints these safe package-manager commands instead of replacing the running binary directly.
# Install a Lean toolchain
lemma lean install stable
lemma lean install nightly
lemma lean install v4.0.0
# List toolchains
lemma lean list
# Set default toolchain
lemma default stable
# Upgrade installed channel toolchains
lemma lean upgrade
# Show active toolchain information
lemma show
# Self-management
lemma self update # Show package-manager upgrade commands
lemma self uninstall # Remove Lemma-managed toolchains and ~/.lemma datalemma toolchain ... remains available as a compatibility alias for lemma lean ..., but new documentation uses lemma lean ....
Lemma stores its configuration in ~/.lemma/lemma.toml (or $LEMMA_HOME/lemma.toml).
Example configuration:
version = "1"
default_toolchain = "leanprover/lean4:stable"
path_setup_shown = true
release_url = "https://release.lean-lang.org"
[overrides]Lemma respects standard proxy environment variables:
HTTP_PROXY/http_proxy- HTTP proxy URLHTTPS_PROXY/https_proxy- HTTPS proxy URLALL_PROXY/all_proxy- Proxy for all protocolsNO_PROXY/no_proxy- Comma-separated list of domains to bypass proxyLEMMA_HOME- Lemma home directory (default:~/.lemma)LEMMA_RELEASE_URL- Override the Lean release index URLLEMMA_TOOLCHAIN- Override active toolchain for current session
Lemma automatically detects project-specific toolchains from:
-
lean-toolchain file: Create a
lean-toolchainfile in your project root:stableor with full specification:
leanprover/lean4:v4.25.0 -
leanpkg.toml: Specify
lean_versionin your package configuration:lean_version = "v4.25.0"
Set a toolchain for a specific directory and all subdirectories:
cd my-project
lemma override set stableRemove the override:
lemma override unsetList all directory overrides:
lemma override listConfigure a custom Lean release index in ~/.lemma/lemma.toml:
release_url = "https://mirror.example.com/lean-releases"Or use environment variable:
export LEMMA_RELEASE_URL=https://mirror.example.com/lean-releasesLemma resolves which toolchain to use in the following priority order:
- Explicit override:
+toolchainsyntax (e.g.,lean +nightly test.lean) - Environment variable:
LEMMA_TOOLCHAIN - Directory override: Set via
lemma override set - Project file:
lean-toolchainorleanpkg.tomlin current directory or parent directories - Default toolchain: Configured via
lemma default <toolchain>
If you see "Toolchain not installed" errors:
# List installed toolchains
lemma lean list
# Install the required toolchain
lemma lean install stableIf downloads fail behind a proxy:
# Verify proxy settings
echo $HTTPS_PROXY
# Test with curl
curl -v https://release.lean-lang.org
# Set proxy for lemma
export HTTPS_PROXY=http://your-proxy:portIf lemma is not found, ensure your Python package manager's scripts directory is on PATH (pipx ensurepath can help for pipx installs).
If lean, lake, or leanc are not found, ensure Lemma's proxy directory is on PATH:
export PATH="$HOME/.lemma/bin:$PATH"Contributions are welcome! Key areas that need work:
- Toolchain Installation - Improve the download and install pipeline
- Binary Proxying - Improve the toolchain binary wrapper system
- Testing - Add comprehensive test coverage
- Documentation - Expand user and developer documentation
- Platform Support - Test on Windows, macOS, Linux
MIT OR Apache-2.0