Publish worktrunk to PyPI
Feature Request
Publish the wt binary to PyPI as platform wheels, the way ruff and uv ship theirs.
Why
Python tooling that builds on worktrunk can't declare it as a dependency today. Users have to install wt separately with Homebrew, Cargo or the installer script, and the tooling can't pin a version.
A PyPI package would allow three things:
-
Bootstrap with no install step.
uvx --from worktrunk wt listworks on any machine with uv, including CI runners and fresh dev containers. -
Bundle it as a dependency. A Python CLI adds
worktrunk>=0.82topyproject.toml, andwtlands in the same environment, version-locked inuv.lock. -
Write self-contained scripts. A PEP 723 script declares worktrunk inline and runs with
uv run:# /// script # dependencies = ["worktrunk"] # /// import json, subprocess out = subprocess.run( ["wt", "list", "--format=json"], capture_output=True, text=True, check=True, ).stdout for worktree in json.loads(out)["items"]: ...
Suggested approach
Use maturin with bindings = "bin". It packs the existing Rust binary into wheels with no Python code and no changes to the crate.
- Add a small
pyproject.tomlthat points maturin at the existing crate. - Add a release job (
maturin-action) that builds wheels for the five targets the release already covers, then publishes with PyPI trusted publishing, so there is no token to manage. - The name
worktrunkis currently unclaimed on PyPI.
Out of scope
A Python API. The binary on PATH plus --format=json is enough.
Adding a PyPI channel is a maintainer call. Some details of the current release pipeline affect how it would fit in:
- Reuse the release binaries; don't rebuild them.
release.yamlbuilds the five targets once with cargo-dist. It then sends the Windows archive through SignPath and swaps the signedwt.exeback in before anything publishes. A separatematurin-actionbuild would compile its own copy, so the Windows wheel would ship an unsigned binary that differs from the one on GitHub Releases, winget and Homebrew. A PyPI job that repackages the signed archives from thehostjob into wheels would keep every channel on the same bytes. - Windows
wtnaming. On Windows,wtcollides with Windows Terminal, so winget installs Worktrunk asgit-wtas well (see the README). The release builds turn on thegit-wtfeature, so a wheel could carry both binaries. A script that runswton Windows would still reach whicheverwtcomes first onPATH. - One more publish job. PyPI would join crates.io, winget, Homebrew and AUR in the jobs that
announcewaits on, so a PyPI outage could hold up the release announcement unless the job is allowed to fail.
There's a partial option today: the community conda-forge feedstock lets Pixi or conda environments declare and lock worktrunk. That doesn't help uvx, uv.lock or PEP 723 scripts, which is the gap this request covers.
let's draft this @worktrunk-bot , it's a good idea!
Drafted in #4823. It repackages the release archives into wheels rather than rebuilding, so PyPI gets the same binaries as the other channels. Before the next release, it needs a pending trusted publisher on PyPI for worktrunk, scoped to release.yaml and the release environment. The PR body has the exact fields.