Skip to main content

Bundle any uv project into a single runnable .py file.

Project description

zuv

Bundle any uv project into a single runnable .py file. End users only need uv installed.

uv run app.py

That's it. The bundled script is a PEP 723 self-contained script. On first run it creates a .venv next to itself, installs the project's dependencies into it via uv pip install, extracts the bundled source, and runs the entry point. Subsequent runs reuse the cache.

Install

uv tool install zuv

Project layout

Your project needs a pyproject.toml and a src/main.py with a main() function:

my-project/
  pyproject.toml         # [project] dependencies = [...]
  src/
    main.py              # def main(): ...

Build

zuv build ./my-project
# -> ./dist/my-project.py

zuv build wipes ./dist/ first, then writes a fresh single-file script. Override the path with -o and the entry point with -e module:function (default main:main).

Build the included examples

zuv build examples/bigtest -o dist/bigtest.py
zuv build examples/fastapi -o dist/fastapi.py

Then:

uv run dist/bigtest.py
uv run dist/fastapi.py

Sibling overrides

The script chdirs to its own folder before invoking your entry point, so any file you drop next to the .py is visible to user code as a cwd-relative path:

File next to the bundle Effect
.env load_dotenv(".env") picks it up
frontend/ Path("frontend") resolves to the override
.venv/ shared dep cache (auto-created on first run)
.zuv/ extracted source cache (per build hash)

This lets you ship a single .py and let users tweak config or assets next to it without rebuilding.

How it works

The output .py is a normal Python script with three parts:

  1. A #!/usr/bin/env -S uv run --script shebang plus a PEP 723 metadata block declaring the Python version.
  2. An _ZUV_ENV dict with the entry point and the project's dependency list, and a _ZUV_PAYLOAD base85-encoded tar.gz of src/.
  3. A small loader that bootstraps the venv, extracts the source, sets ZUV_DIR / ZUV_CWD / ZUV_CACHE, and imports the entry callable.

Deps are NOT bundled inside the .py. uv handles them at runtime, so the bundle stays tiny (under 15 KB even for a FastAPI app) and binary wheels work natively without extraction tricks.

Layout

src/
  pyproject.toml
  zuv/
    cli.py                 # zuv build CLI
    builder.py             # tar.gz + base85 + emit .py
    _loader_template.py    # runtime loader embedded in every output
    constants.py
examples/
  bigtest/                 # rich + pydantic smoke test
  fastapi/                 # FastAPI + uvicorn web app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zuv-0.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zuv-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file zuv-0.0.1.tar.gz.

File metadata

  • Download URL: zuv-0.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zuv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cd0b18498802cd56855b1028512a9adf235a48c1f4396a9d16dd213ef7f6f8c0
MD5 8f553c94cb40ed28df1ac9d0b07116cf
BLAKE2b-256 ca6a9cfc02eb72fe3e1c2d910b2a0a861777069ff4ae283d5b63db75f782c2e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for zuv-0.0.1.tar.gz:

Publisher: pypi.yml on HamzaYslmn/zuv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zuv-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: zuv-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zuv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e51df0a3827549c2bb74783d6b38948fefe68111fc9a3760c03f12597bdaa04
MD5 3c04312fcbc7d11aa23ac90fd19dba62
BLAKE2b-256 643d9170e725916cd9435e558f88cb41e96b7d18c0e436374179ae320c26be2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for zuv-0.0.1-py3-none-any.whl:

Publisher: pypi.yml on HamzaYslmn/zuv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page