Skip to main content

py4uv

A portable py launcher shim, backed by uv — no Python installation needed. py -3.10 …, py -3.12 … etc. work transparently on Windows and GNU/Linux; uv downloads missing interpreters on demand. (The Unix code is not specific to Linux, so other Unix systems such as macOS may work too, but they are not tested.)

What it does

Translates

py [-3 | -3.12 | -3.12-64 | -V:3.12] <python args...>

into

uv run --no-project [-p <version>] python <python args...>

On Windows the argument tail is taken from the raw command line (GetCommandLineW) and appended to uv's command line verbatim (raw_arg), so quoting, !, %, ^ etc. survive exactly as typed; Ctrl+C is forwarded to Python (the REPL gets KeyboardInterrupt instead of the shim dying) and exit codes propagate. On Unix argv is passed through untouched and uv is exec'd in place of the shim, so signals and exit codes need no forwarding at all.

Version resolution order mirrors the real py launcher:

  1. explicit flag (-3, -3.12, -3.12-64, -V:3.12)
  2. shebang line of the script given as first argument (#!/usr/bin/env python3.10); interpreter options trailing it (#!/usr/bin/python3 -u) are passed on to python
  3. PY_PYTHON environment variable
  4. uv's default (UV_PYTHON / .python-version / latest managed install)

A bare major version from any of these (py -3, #!/usr/bin/python3, PY_PYTHON=3) is refined through PY_PYTHON3/PY_PYTHON2, like the real launcher — except from an explicit -V:3 tag, which the real launcher treats as exact.

Version requests beyond X[.Y] work too: Company/version tags (-V:PyPy/3.10, PY_PYTHON=PyPy/3.10) map to uv's implementation@version form (pypy@3.10; PythonCore/ means plain CPython, and an unknown company fails in uv rather than silently running the wrong interpreter), and any other request py4uv doesn't recognize (3.13t, pypy3.10, an interpreter path) is handed to uv run -p verbatim, so uv's own resolution applies.

py -0 / -0p / --list / --list-paths as the first argument map to uv python list --only-installed; anything after the flag is ignored, like the real launcher.

Deliberate divergences from the real launcher: architecture suffixes (-32/-64/-arm64) are accepted but ignored, py -h shows Python's help rather than launcher help, py script.py runs the script with plain python (no PEP 723 inline-dependency handling — use uv run script.py for that), and the PYLAUNCHER_* environment variables (PYLAUNCHER_DRYRUN, PYLAUNCHER_DEBUG, PYLAUNCHER_ALLOW_INSTALL, …) are ignored. Shebangs only ever select a uv-managed interpreter: an absolute-path python shebang (#!C:\proj\venv\Scripts\python.exe) picks uv's python rather than running that file (the real launcher executes the named interpreter, e.g. a venv's), #!/usr/bin/env python3 does not search PATH for a python3 to run, non-python shebang commands are ignored entirely, and the shebang line must be UTF-8 (no ANSI-code-page fallback). On Windows, uv must be a real uv.exe — found on PATH, or failing that next to py.exe — since a .cmd/.bat shim would have cmd.exe re-parse the verbatim argument tail.

Checks

The typical Rust flow must stay clean (clippy runs with the pedantic group enabled via [lints.clippy] in Cargo.toml):

cargo fmt --check
cargo check --all-targets --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo doc --no-deps --all-features

plus a clippy pass for the other platform's module via a cross target, e.g. from Windows:

cargo clippy --all-targets --all-features --target x86_64-unknown-linux-musl -- -D warnings

A pre-commit hook runs all of it automatically; enable it once per clone with:

git config core.hooksPath .githooks

Install

  • Prebuilt binary: download the archive for GNU/Linux (x86_64, static, so it runs on any distribution) or Windows (x86_64) from the releases and put py (py.exe) on your PATH.
  • With uv (PyPI package py4uv, which contains the same binary): uv tool install py4uv puts py next to uv's other tools; without installing: uvx --from py4uv py -3.12 ….
  • With cargo: cargo binstall py4uv (downloads the prebuilt binary) or cargo install --locked py4uv (builds it).

Build

Anywhere with a Rust toolchain, straight from GitHub:

cargo install --locked --git https://github.com/sbellon/py4uv

or from a local checkout:

cargo install --locked --path .

Either installs py into ~/.cargo/bin. Or build and copy manually, e.g. on Windows:

cargo build --release
copy target\release\py.exe %USERPROFILE%\.local\bin\py.exe

License

Licensed under the MIT license.

Metadata

Release files for py4uv 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py4uv 0.1.0
File Size Uploaded Provenance
py4uv-0.1.0.tar.gz 12.8 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for py4uv 0.1.0
File Interpreter ABI Platform
py4uv-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
py4uv-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64, Linux glibc 2.17+ x86-64 Details

Total release size: 367.9 kB

Release files / py4uv-0.1.0.tar.gz

Download URL py4uv-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
34e11d2cdf815709d5b5df068cba688fd0ff38d6a4e665f1e87e96d831d6a2a7
BLAKE2b-256 checksum
How to use checksums
caf915c0e2b4b5fc1518f1850c58690744102b823f14643582c34ae701df3073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / py4uv-0.1.0-py3-none-win_amd64.whl

Download URL py4uv-0.1.0-py3-none-win_amd64.whl
Size 124.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
592af4abc775f6f892f9a321b9acd48f4fd21f4101fe7f45e25179b278cc21bd
BLAKE2b-256 checksum
How to use checksums
966e8744b349f74ea2ce797629cc04d5de71db5276b6df428e2878223f1f3a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / py4uv-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl

Download URL py4uv-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
Size 230.4 kB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d4a3a90a6686f2bc6740c0eab8b478e4d50dde778f3914442f08a3c456e10e7e
BLAKE2b-256 checksum
How to use checksums
6651931188d2b33ec2bb60ce10f7e7ef6867afa51d10541c426761000d026923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Security for py4uv 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for py4uv-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page