Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,54 @@ jobs:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Publish lemma crate
working-directory: crates/lemma-rs
run: cargo publish
- name: Publish all crates in dependency order
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail

# Topological order of the internal dependency graph:
# lemma-static, lemma-platform, lemma-output (no internal deps)
# lemma-toolchain -> static, platform
# lemma-config -> static, toolchain
# lemma-args -> config, static
# lemma-download -> static, platform, config, toolchain
# lemma-install -> static, config, toolchain, download
# lemma-rs -> all of the above
crates=(
lemma-static
lemma-platform
lemma-output
lemma-toolchain
lemma-config
lemma-args
lemma-download
lemma-install
lemma-rs
)

# Return 0 if name@version is already present on crates.io, so a
# re-run after a partial failure skips what is already published.
is_published() {
local name="$1" version="$2" status
status=$(curl -s -o /dev/null -w '%{http_code}' \
-H 'User-Agent: lemma-ci (https://github.com/LeanOxide/lemma)' \
"https://crates.io/api/v1/crates/${name}/${version}")
[ "$status" = "200" ]
}

for crate in "${crates[@]}"; do
pkgid="$(cargo pkgid -p "$crate")"
version="${pkgid##*#}"
version="${version##*@}"
if is_published "$crate" "$version"; then
echo "::notice::${crate} ${version} already published, skipping"
continue
fi
echo "::group::Publishing ${crate} ${version}"
cargo publish -p "$crate"
echo "::endgroup::"
# Give the sparse index a moment to propagate before publishing the
# next crate, which may depend on the one just published.
sleep 20
done
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ resolver = "2"


[workspace.package]
version = "0.1.5"
version = "0.2.0"
edition = "2021"
rust-version = "1.75"
license = "MIT OR Apache-2.0"
authors = ["PuQing <me@puqing.work>"]
repository = "https://github.com/LeanOxide/lemma.git"

[workspace.dependencies]
lemma-cli = { path = "crates/lemma-cli" }
lemma-config = { path = "crates/lemma-config" }
lemma-toolchain = { path = "crates/lemma-toolchain" }
lemma-static = { path = "crates/lemma-static" }
lemma-platform = { path = "crates/lemma-platform" }
lemma-download = { path = "crates/lemma-download" }
lemma-install = { path = "crates/lemma-install" }
lemma-output = { path = "crates/lemma-output" }
lemma-args = { path = "crates/lemma-args", version = "0.2.0" }
lemma-config = { path = "crates/lemma-config", version = "0.2.0" }
lemma-toolchain = { path = "crates/lemma-toolchain", version = "0.2.0" }
lemma-static = { path = "crates/lemma-static", version = "0.2.0" }
lemma-platform = { path = "crates/lemma-platform", version = "0.2.0" }
lemma-download = { path = "crates/lemma-download", version = "0.2.0" }
lemma-install = { path = "crates/lemma-install", version = "0.2.0" }
lemma-output = { path = "crates/lemma-output", version = "0.2.0" }

serde = { version = "1.0", features = ["derive"] }
toml = "0.8"
Expand Down
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Lemma - A Modern Lean4 Toolchain Manager

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/LeanOxide/lemma/ci.yml?style=flat-square&logo=github)
![PyPI Version](https://img.shields.io/pypi/v/lemma?style=flat-square&logo=pypi)
![PyPI Downloads](https://img.shields.io/pypi/dm/lemma?style=flat-square&logo=pypi)
![PyPI Version](https://img.shields.io/pypi/v/lemma-lean?style=flat-square&logo=pypi)
![PyPI Downloads](https://img.shields.io/pypi/dm/lemma-lean?style=flat-square&logo=pypi)
[![dependency status](https://deps.rs/repo/github/LeanOxide/lemma/status.svg?style=flat-square)](https://deps.rs/repo/github/LeanOxide/lemma)
![PyPI License](https://img.shields.io/pypi/l/lemma?style=flat-square)
![PyPI License](https://img.shields.io/pypi/l/lemma-lean?style=flat-square)
[![codecov](https://codecov.io/github/LeanOxide/lemma/graph/badge.svg)](https://codecov.io/github/LeanOxide/lemma)

[English](README.md) | [简体中文](README_CN.md)
Expand Down Expand Up @@ -47,24 +47,34 @@ GitHub release assets.

## Installation

### Quick Install (Recommended)
The command-line executable is always named `lemma`, regardless of how you install it.

Install Lemma as a Python package. The package name and command are both `lemma`.
### From PyPI (Recommended)

Install Lemma as a Python package named `lemma-lean`:

```bash
pipx install lemma
pipx install lemma-lean
```

If you do not use `pipx`, install with Python's user site instead:

```bash
python -m pip install --user lemma
python -m pip install --user lemma-lean
```

On Windows, use the Python launcher if needed:

```powershell
py -m pip install --user lemma
py -m pip install --user lemma-lean
```

### From crates.io

If you have a Rust toolchain installed, you can also install the `lemma-rs` crate, which provides the same `lemma` executable:

```bash
cargo install lemma-rs
```

After installation, run a setup command such as `lemma toolchain 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.
Expand All @@ -73,7 +83,7 @@ After installation, run a setup command such as `lemma toolchain install stable`

```bash
# Build from source
cargo build --release -p lemma
cargo build --release -p lemma-rs

# Install the CLI from this checkout
cargo install --path crates/lemma-rs
Expand All @@ -84,9 +94,11 @@ cargo install --path crates/lemma-rs
Use the same package manager that installed Lemma:

```bash
pipx upgrade lemma
pipx upgrade lemma-lean
# or
python -m pip install --user --upgrade lemma
python -m pip install --user --upgrade lemma-lean
# or, for a crates.io install
cargo install lemma-rs
```

`lemma self update` prints these safe package-manager commands instead of replacing the running binary directly.
Expand Down
28 changes: 20 additions & 8 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,34 @@ release_asset_url_prefix = "https://mirror.example.com"

## 安装

### 快速安装(推荐)
无论通过哪种方式安装,可执行文件名始终为 `lemma`。

Lemma 现在通过 Python 包发布,包名和命令名都是 `lemma`。
### 从 PyPI 安装(推荐)

Lemma 以名为 `lemma-lean` 的 Python 包发布:

```bash
pipx install lemma
pipx install lemma-lean
```

如果不使用 `pipx`,可以使用 Python user site 安装:

```bash
python -m pip install --user lemma
python -m pip install --user lemma-lean
```

Windows 可以使用 Python launcher:

```powershell
py -m pip install --user lemma
py -m pip install --user lemma-lean
```

### 从 crates.io 安装

如果已经安装了 Rust 工具链,也可以安装 `lemma-rs` crate,它提供相同的 `lemma` 可执行文件:

```bash
cargo install lemma-rs
```

安装后,运行 `lemma toolchain install stable` 等初始化命令。Lemma 会在 `~/.lemma/bin` 下创建 `lean`、`lake`、`leanc` 等代理命令;如果希望直接运行这些代理命令,请把该目录加入 `PATH`。
Expand All @@ -61,7 +71,7 @@ py -m pip install --user lemma

```bash
# 构建发布版本
cargo build --release -p lemma
cargo build --release -p lemma-rs

# 从当前源码安装 CLI
cargo install --path crates/lemma-rs
Expand All @@ -72,9 +82,11 @@ cargo install --path crates/lemma-rs
使用安装 Lemma 时的同一个包管理器更新:

```bash
pipx upgrade lemma
pipx upgrade lemma-lean
# 或
python -m pip install --user --upgrade lemma
python -m pip install --user --upgrade lemma-lean
# 或(crates.io 安装方式)
cargo install lemma-rs
```

`lemma self update` 会显示这些安全的包管理器更新命令,不会直接覆盖当前正在运行的二进制文件。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "lemma-cli"
name = "lemma-args"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
File renamed without changes.
Loading
Loading