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:
- A
#!/usr/bin/env -S uv run --scriptshebang plus a PEP 723 metadata block declaring the Python version. - An
_ZUV_ENVdict with the entry point and the project's dependency list, and a_ZUV_PAYLOADbase85-encodedtar.gzofsrc/. - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd0b18498802cd56855b1028512a9adf235a48c1f4396a9d16dd213ef7f6f8c0
|
|
| MD5 |
8f553c94cb40ed28df1ac9d0b07116cf
|
|
| BLAKE2b-256 |
ca6a9cfc02eb72fe3e1c2d910b2a0a861777069ff4ae283d5b63db75f782c2e4
|
Provenance
The following attestation bundles were made for zuv-0.0.1.tar.gz:
Publisher:
pypi.yml on HamzaYslmn/zuv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zuv-0.0.1.tar.gz -
Subject digest:
cd0b18498802cd56855b1028512a9adf235a48c1f4396a9d16dd213ef7f6f8c0 - Sigstore transparency entry: 1553400659
- Sigstore integration time:
-
Permalink:
HamzaYslmn/zuv@e1b7da00b2aa90aff9c5d7796d1790eade7b4595 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/HamzaYslmn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e1b7da00b2aa90aff9c5d7796d1790eade7b4595 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e51df0a3827549c2bb74783d6b38948fefe68111fc9a3760c03f12597bdaa04
|
|
| MD5 |
3c04312fcbc7d11aa23ac90fd19dba62
|
|
| BLAKE2b-256 |
643d9170e725916cd9435e558f88cb41e96b7d18c0e436374179ae320c26be2d
|
Provenance
The following attestation bundles were made for zuv-0.0.1-py3-none-any.whl:
Publisher:
pypi.yml on HamzaYslmn/zuv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zuv-0.0.1-py3-none-any.whl -
Subject digest:
0e51df0a3827549c2bb74783d6b38948fefe68111fc9a3760c03f12597bdaa04 - Sigstore transparency entry: 1553400668
- Sigstore integration time:
-
Permalink:
HamzaYslmn/zuv@e1b7da00b2aa90aff9c5d7796d1790eade7b4595 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/HamzaYslmn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e1b7da00b2aa90aff9c5d7796d1790eade7b4595 -
Trigger Event:
push
-
Statement type: