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.

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, needs Rust 1.86 or newer).

Build

With Rust 1.86 or newer, 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 it with cargo build --release and put target/release/py (py.exe on Windows) on your PATH yourself.

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 code via a cross target (x86_64-pc-windows-msvc from GNU/Linux, x86_64-unknown-linux-musl from Windows), e.g.:

cargo clippy --all-targets --all-features --target x86_64-pc-windows-msvc -- -D warnings

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

git config core.hooksPath .githooks

License

MIT, see LICENSE.

Metadata

Release files for py4uv 0.1.1

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.1
File Size Uploaded Provenance
py4uv-0.1.1.tar.gz 12.9 kB With provenance Details

Built distributions (wheels)

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

Total release size: 365.7 kB

Release files / py4uv-0.1.1.tar.gz

Download URL py4uv-0.1.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0968fed169b9a80ee1591505617cd1ff4bea94626ff446a6d2f82ea5da2250c0
BLAKE2b-256 checksum
How to use checksums
d881ff463d24960dfa8b783a448eb775847d9a70e4fd3c7f96481a2c82490e9a
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 24, 2026.

Transparency log

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

Download URL py4uv-0.1.1-py3-none-win_amd64.whl
Size 123.9 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
3fbd1360d6e2969d82c063f31ecff40d39a7ac07acd13b3db296dd2181c64e38
BLAKE2b-256 checksum
How to use checksums
d4f67297b74758643198549aaec8d4298a9c8e59db85dea1d556bb90e14b89fb
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 24, 2026.

Transparency log

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

Download URL py4uv-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl
Size 228.9 kB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
90d07b6b63ee5bfee78b5eff18d078d3d9c37b39bc8dd61976b5913945ed6b1d
BLAKE2b-256 checksum
How to use checksums
db2f433def72aa686c494800e615257ac148f62e7c60719abda20f05e5abe8ed
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 24, 2026.

Transparency log

Security for py4uv 0.1.1

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.1.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 24, 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.1 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