Skip to content

build: ship mogs as a Rust binary in platform wheels - #60

Merged
wiseodd merged 7 commits into
mainfrom
build/rust-binary
Nov 27, 2026
Merged

wiseodd merged 7 commits into
mainfrom
build/rust-binary

Conversation

@wiseodd

@wiseodd wiseodd commented Nov 26, 2026

Copy link
Copy Markdown
Owner

mogs is now a Rust binary that maturin puts in platform wheels. For now it forwards every command to python -m mogs.cli, so commands, output and exit codes are unchanged. Later PRs move the commands into Rust.

The binary runs the Python next to it, or the one in uv tool dir when none is there (Windows uv tool install copies the exe). CI builds Rust on every OS. release.yml builds the wheels and sdist on a published release and uploads them to PyPI by trusted publishing.

Closes #44

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5 · The PR still needs the Unix user-install fix before merging.RetriggerView in GreptileConfidence Score: 4/5

[High impact] The PR changes how platform packages are built and published to PyPI.

The PR still needs the Unix user-install fix before merging.

Findings

  1. P1 Pip-installed commands cannot start ▶

Summary

Ships mogs as a Rust executable bundled with the Python package in platform wheels.

  • The mogs command finds its Python and forwards each command.
  • Python installs now include a platform-specific mogs executable.
  • Published GitHub releases now build and publish the package to PyPI.

Reviews (3) · Last reviewed commit: "fix: find Python above Scripts for a glo..." · Reviewed by Greptile

Comment thread crates/mogs/src/python.rs
Comment on lines +93 to +99
if let Some(python) = interpreter_in(beside) {
return Ok(python);
}

// On Windows `uv tool install` copies the executable out of its environment. The tool
// environment found here may hold a different mogs version than this executable.
let tool = uv_tool_dir().map(|dir| dir.join("mogs").join(TOOL_BIN));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Pip-installed commands cannot start

This lookup breaks pip install --user mogs on Unix and ordinary global pip installs on Windows. Unix user installs put mogs in ~/.local/bin, away from Python. Windows global installs put mogs.exe in Scripts, while python.exe lives in its parent folder.

The launcher searches only beside the executable and inside a uv tool environment. If that uv environment is absent, every command fails before Python starts. Preserve a link to the Python environment that installed the wheel, and test these layouts.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the Windows case in d818a2c: when mogs.exe sits in a folder named Scripts, the binary also looks in the folder above it. pip install --user on Unix stays unsupported on purpose: supported installs are uv's (uv tool install, uvx, a venv).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. The Windows fix in d818a2c handles the global pip layout, and it includes a regression test. Since Unix pip install --user is intentionally unsupported, that part of my earlier comment was outside the project’s supported install scope; I’ll consider the concern addressed.

@wiseodd
wiseodd merged commit 547aad5 into main Nov 27, 2026
11 checks passed
@wiseodd
wiseodd deleted the build/rust-binary branch November 27, 2026 00:09
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.

Rust rewrite: ship the Rust binary in platform wheels

1 participant