Skip to content

build: prepare v0.2.0 for crates.io + PyPI distribution (rename lemma-rs / lemma-lean) - #1

Merged
AndPuQing merged 2 commits into
mainfrom
fix/distribution-rename-v0.2.0
Aug 3, 2026
Merged

build: prepare v0.2.0 for crates.io + PyPI distribution (rename lemma-rs / lemma-lean)#1
AndPuQing merged 2 commits into
mainfrom
fix/distribution-rename-v0.2.0

Conversation

@AndPuQing

Copy link
Copy Markdown
Collaborator

Summary

Prepares Lemma for its first distribution since the pivot to a pure toolchain manager: renames packages to available registry names, bumps the workspace to 0.2.0, makes the whole workspace publishable, and rewrites the crates.io publish workflow.

Part of W-153 (lemma 分发修复). After this merges, the remaining steps require account/secret access (see "Follow-up (needs maintainer)" below).

Why the renames

Registry lemma chosen name reason
crates.io taken (unrelated, active) lemma-rs resumes our own previously published crate (0.1.5, 2025‑11)
crates.io lemma-cli taken lemma-args available
PyPI taken (unrelated, 2020) lemma-lean available

The command-line executable stays lemma in every case ([[bin]] name = "lemma" for cargo; maturin bindings = "bin" for the wheel).

Changes

Version + publishability

  • Workspace 0.1.50.2.0; lemma-static aligned to the workspace version (was pinned 0.1.0).
  • Every internal workspace dependency now carries version = "0.2.0" (they were path‑only, which cargo publish rejects).
  • Binary crate lemmalemma-rs; lemma-clilemma-args (directory renamed, all lemma_cli imports → lemma_args).
  • Moved the integration test suite from workspace‑root tests/ into crates/lemma-rs/tests/ so the published crate no longer references a ../../tests path outside its package root (this blocked cargo package).

cd.yml

  • Rewrote to publish all 9 crates in topological order: lemma-static, lemma-platform, lemma-outputlemma-toolchainlemma-configlemma-argslemma-downloadlemma-installlemma-rs.
  • Skips crates whose version is already on crates.io (so a re-run after a partial failure is safe) and pauses briefly between publishes for sparse-index propagation.
  • Note: lemma-config depends on lemma-toolchain, so they are ordered (not parallel) — corrected vs. the original plan.

pyproject.toml

  • name = "lemma""lemma-lean", version0.2.0. maturin manifest-path = "crates/lemma-rs/Cargo.toml" and bindings = "bin" unchanged.

User-facing install guidance

  • README / README_CN, lemma self update, lemma self uninstall, and help text now point at pipx install lemma-lean and cargo install lemma-rs (previously they told users to install/upgrade the squatted lemma name — i.e. the wrong package).
  • PyPI badges updated to lemma-lean.

Verification (local)

  • cargo build --workspace
  • cargo test --workspace ✅ (129 passed, 0 failed; the 53 integration tests run from the new in-crate location)
  • cargo fmt --all --check ✅ and cargo clippy --all-targets --all-features --workspace -- -D warnings
  • cargo doc with -D warnings
  • cargo package -p lemma-static / -p lemma-platform ✅ (no-dep crates package cleanly; dependent crates correctly resolve their internal deps against the registry, which populate once published in order)
  • maturin build --lockedlemma_lean-0.2.0-*.whl; installed into a clean venv → lemma --version prints lemma 0.2.0
  • lemma self update now prints pipx upgrade lemma-lean / cargo install lemma-rs --force
  • crates.io name checks: lemma-rs@0.1.5 exists (ours to resume), lemma-args@0.2.0 and lemma-rs@0.2.0 are free ✅

Follow-up (needs maintainer — accounts/secrets, not code)

  1. crates.io: confirm CARGO_REGISTRY_TOKEN is set and the account owns lemma-rs; run the cd.yml workflow (or I can, once merged).
  2. PyPI: create project lemma-lean and add a pending trusted publisher — owner LeanOxide, repo lemma, workflow release.yml, environment blank. (Fallback: PYPI_API_TOKEN secret.)
  3. Release: tag v0.2.0 + create a GitHub release to trigger release.yml (5‑platform wheels + sdist → release assets + PyPI). Happy to tag on request.
  4. End‑to‑end: pipx install lemma-lean && lemma --version, cargo install lemma-rs && lemma --version, lemma toolchain install stable && lemma show.

Suggested later (out of scope here)

  • Add per-crate description/homepage metadata (cargo warns "manifest has no description" during packaging; cosmetic, does not block publishing).
  • Attach raw platform binaries to the GitHub release (old v0.1.x did; current release.yml only produces wheel/sdist).

The pivot to a pure toolchain manager (removing build/init/run) changed the
CLI surface significantly, so bump the workspace 0.1.5 -> 0.2.0 and make the
whole workspace publishable for the first time since the pivot.

Rename for available registry names (verified 2026-08-03):
- crates.io `lemma` is taken by an unrelated active project, so the binary
  crate `lemma` -> `lemma-rs`, resuming our own previously published crate
  (0.1.5, 2025-11). The executable stays `lemma` via [[bin]] name.
- `lemma-cli` -> `lemma-args` (also taken); directory renamed to match and
  all `lemma_cli` imports updated to `lemma_args`.
- PyPI `lemma` is taken, so the Python package is renamed `lemma` ->
  `lemma-lean` in pyproject.toml (maturin bin binding unchanged).

Make `cargo publish` work:
- Add `version = "0.2.0"` to every internal workspace dependency (they were
  path-only, which cargo rejects when packaging).
- Align `lemma-static` on the workspace version (was pinned 0.1.0).
- Move the integration test suite from the workspace-root `tests/` into
  `crates/lemma-rs/tests/` so the published crate no longer references a
  `../../tests` path outside its package root.

cd.yml: rewrite to publish all 9 crates in topological dependency order
(static/platform/output -> toolchain -> config -> args -> download ->
install -> lemma-rs), skipping anything already published so a re-run after a
partial failure is safe, with a short pause for sparse-index propagation.

User-facing install guidance (README, README_CN, `lemma self update`,
`lemma self uninstall`, help text) now points at `pipx install lemma-lean`
and `cargo install lemma-rs` instead of the squatted `lemma` names.
The integration suite located the `lemma` binary by walking up from
`env::current_exe()` and guessing `target/debug/lemma`. That broke on the
nightly toolchain used by CI: nightly places the integration test binary
under `target/debug/build/lemma-rs/<hash>/out/` instead of
`target/debug/deps/`, so `current_exe().parent().parent()` no longer lands in
`target/debug` and every integration test failed with
`Os { code: 2, kind: NotFound }` (Test Suite + Code Coverage jobs).

Use `env!("CARGO_BIN_EXE_lemma")` instead. Cargo sets it to the absolute path
of the binary it builds for the integration test and guarantees that binary is
built before the test runs, so it is correct regardless of toolchain, profile,
or `--target-dir` (the coverage job uses a custom one).

Verified on nightly from a clean build:
  cargo +nightly test --locked --all-features --workspace  -> 129 passed, 0 failed
  cargo +nightly fmt --check / clippy -D warnings          -> clean
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@AndPuQing
AndPuQing merged commit 4d40b80 into main Aug 3, 2026
7 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