Repository navigation
build: ship mogs as a Rust binary in platform wheels - #60
Conversation
[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
SummaryShips
Reviews (3) · Last reviewed commit: "fix: find Python above Scripts for a glo..." · Reviewed by Greptile |
| 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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
mogsis now a Rust binary that maturin puts in platform wheels. For now it forwards every command topython -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 dirwhen none is there (Windowsuv tool installcopies the exe). CI builds Rust on every OS.release.ymlbuilds the wheels and sdist on a published release and uploads them to PyPI by trusted publishing.Closes #44