bundleup 0.0.1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. bundleup-0.2.0/PKG-INFO +133 -0
  2. bundleup-0.2.0/README.md +109 -0
  3. bundleup-0.2.0/pyproject.toml +126 -0
  4. bundleup-0.2.0/pyproject.toml.orig +78 -0
  5. bundleup-0.2.0/src/bundleup/__init__.py +94 -0
  6. bundleup-0.2.0/src/bundleup/__main__.py +7 -0
  7. bundleup-0.2.0/src/bundleup/_build.py +946 -0
  8. bundleup-0.2.0/src/bundleup/_bytecode.py +196 -0
  9. bundleup-0.2.0/src/bundleup/_cache.py +193 -0
  10. bundleup-0.2.0/src/bundleup/_check.py +569 -0
  11. bundleup-0.2.0/src/bundleup/_cli.py +879 -0
  12. bundleup-0.2.0/src/bundleup/_config.py +237 -0
  13. bundleup-0.2.0/src/bundleup/_coverage.py +200 -0
  14. bundleup-0.2.0/src/bundleup/_errors.py +139 -0
  15. bundleup-0.2.0/src/bundleup/_exe.py +448 -0
  16. bundleup-0.2.0/src/bundleup/_formats.py +39 -0
  17. bundleup-0.2.0/src/bundleup/_imports.py +248 -0
  18. bundleup-0.2.0/src/bundleup/_loader.py +934 -0
  19. bundleup-0.2.0/src/bundleup/_outputs.py +694 -0
  20. bundleup-0.2.0/src/bundleup/_payload.py +846 -0
  21. bundleup-0.2.0/src/bundleup/_platforms.py +265 -0
  22. bundleup-0.2.0/src/bundleup/_python.py +347 -0
  23. bundleup-0.2.0/src/bundleup/_runtime.py +190 -0
  24. bundleup-0.2.0/src/bundleup/_sitecustomize.py +79 -0
  25. bundleup-0.2.0/src/bundleup/_smoke.py +158 -0
  26. bundleup-0.2.0/src/bundleup/_source.py +369 -0
  27. bundleup-0.2.0/src/bundleup/_steps.py +87 -0
  28. bundleup-0.2.0/src/bundleup/_term.py +92 -0
  29. bundleup-0.2.0/src/bundleup/_text.py +22 -0
  30. bundleup-0.2.0/src/bundleup/_toml.py +12 -0
  31. bundleup-0.2.0/src/bundleup/_uv.py +763 -0
  32. bundleup-0.2.0/src/bundleup/_verify.py +692 -0
  33. bundleup-0.2.0/src/bundleup/_zipwriter.py +186 -0
  34. bundleup-0.2.0/src/bundleup/py.typed +0 -0
  35. bundleup-0.0.1/PKG-INFO +0 -67
  36. bundleup-0.0.1/README.md +0 -46
  37. bundleup-0.0.1/pyproject.toml +0 -41
  38. bundleup-0.0.1/pyproject.toml.orig +0 -32
  39. bundleup-0.0.1/src/bundleup/__init__.py +0 -3
  40. bundleup-0.0.1/src/bundleup/cli.py +0 -26
  41. {bundleup-0.0.1 → bundleup-0.2.0}/LICENSE +0 -0
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: bundleup
3
+ Version: 0.2.0
4
+ Summary: Bundle up your Python app with everything it needs: one .pyz that runs on plain Python, no install step.
5
+ Keywords: bundler,pyz,zipapp,packaging,distribution,cli
6
+ Author: funkyfunc
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Build Tools
15
+ Classifier: Topic :: System :: Software Distribution
16
+ Requires-Dist: packaging>=23
17
+ Requires-Dist: tomli>=1.1 ; python_full_version < '3.11'
18
+ Requires-Dist: uv>=0.9
19
+ Requires-Python: >=3.9
20
+ Project-URL: Homepage, https://github.com/funkyfunc/bundleup
21
+ Project-URL: Repository, https://github.com/funkyfunc/bundleup
22
+ Project-URL: Issues, https://github.com/funkyfunc/bundleup/issues
23
+ Description-Content-Type: text/markdown
24
+
25
+ # bundleup
26
+
27
+ [![PyPI](https://img.shields.io/pypi/v/bundleup.svg)](https://pypi.org/project/bundleup/)
28
+ [![Python](https://img.shields.io/pypi/pyversions/bundleup.svg)](https://pypi.org/project/bundleup/)
29
+ [![CI](https://github.com/funkyfunc/bundleup/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/funkyfunc/bundleup/actions/workflows/ci.yml)
30
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
31
+
32
+ **Bundle up your Python app with everything it needs.** One command turns a locked project into a
33
+ single `.pyz` that runs on plain Python: no install step, no network, native extensions included.
34
+ And it tells you *before* you ship what won't survive the trip.
35
+
36
+ Dead simple to use, but also powerful and fast: esbuild's experience, for Python.
37
+
38
+ > **Status: alpha (0.2.0).** Builds for this machine or another platform (Linux, macOS, Windows;
39
+ > x86_64 and arm64), passes the [gauntlet](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md)
40
+ > on all four in CI, and the own test suites of click, packaging, markupsafe and itsdangerous give
41
+ > the same results from a bundle as from a venv (nightly). Try it without installing via
42
+ > `uvx bundleup build`, or install with `uv tool install bundleup` / `pip install bundleup`.
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ bundleup build # the project in this directory -> dist/<name>.pyz
48
+ bundleup build path/to/script.py # a PEP 723 script with inline dependencies
49
+ bundleup build --python 3.9 # build with Python 3.9 (pure Python: runs on 3.9 and newer)
50
+ bundleup build --python 3.11 --python-platform linux # build on a Mac for Linux x86_64
51
+ bundleup build --python-platform linux,macos,windows # one file for all three
52
+ bundleup build --external torch # leave a heavy host package out of the bundle
53
+ bundleup build --json # the result as JSON on stdout, for scripts and agents
54
+ bundleup check # what won't survive bundling, and each package's size
55
+ bundleup check --python-platform linux,windows # also check Windows wheels
56
+ bundleup check --matrix # which OS, CPU and Python versions the lock's wheels cover
57
+ bundleup build --smoke # then run it once: fresh home folder, no network
58
+ bundleup build --max-size 30MB # fail, writing nothing, if the bundle is bigger
59
+ bundleup build --format dir # a plain directory, for apps that load packages from one
60
+ bundleup build --format zip # a flat .zip of code, packages and bytecode (e.g. serverless)
61
+ bundleup build --format py # one plain-text .py file (for small tools: gists, uploads)
62
+ bundleup build --split 100MB # no file over 100 MB: a small .pyz and a folder of parts
63
+ bundleup build --format exe # experimental: an executable with its own Python, unsigned
64
+ bundleup verify dist/app.pyz # bundle and unpacked copy vs its manifest (corruption; not a signature)
65
+ bundleup cache clean # remove unpacked bundles not used for 30 days
66
+ python dist/<name>.pyz # run it: no install, no network
67
+ ```
68
+
69
+ bundleup reads what you have: `pyproject.toml` with `uv.lock` or `pylock.toml`, a script's
70
+ `# /// script` block, or, without a lock, a `pyproject.toml`, `setup.py` or `requirements.txt`
71
+ (resolved at build time, with a warning; [recipes](https://github.com/funkyfunc/bundleup/blob/main/docs/recipes.md)). It brings its own
72
+ [uv](https://docs.astral.sh/uv/) for the build; the bundle needs only Python. On first run it
73
+ unpacks to a cache (`~/Library/Caches/bundleup`, `~/.cache/bundleup`, or a temp directory if
74
+ those aren't writable), so later runs start as fast as an installed virtualenv; unpacking a new version removes older
75
+ copies of the same bundle that went unused for 30 days. A pure-Python
76
+ bundle runs on every Python version its lock allows (`Python 3.10+`), and on any OS when the lock
77
+ picks the same packages everywhere (`on any OS`); one with compiled code runs on the version and
78
+ platform it was built for. A bundle only sees
79
+ its own packages and the standard library; pass `--external <pkg>` (or set `BUNDLEUP_INHERIT_PATH=1` at runtime) to also let it use
80
+ packages installed on the machine (they come after the bundle's, but a machine package can still
81
+ win over a bundled namespace package of the same name: a Python rule, PEP 420). If it's started
82
+ with the wrong Python, it runs itself again with a matching one if one is installed; otherwise, and on
83
+ the wrong platform, it says so in one sentence. Programs it starts with
84
+ its own Python see its packages; any other Python it starts doesn't. bundleup never writes into
85
+ your project.
86
+
87
+ Every build checks the code first: a file of your project that doesn't compile on the target
88
+ Python stops the build, and anything that may not work in a bundle (a dependency's file that needs
89
+ a newer Python, data files a package expects under `sys.prefix`) is a warning. `bundleup check`
90
+ runs the same checks without writing a bundle and shows how big each package is; `--strict` makes
91
+ warnings fail too.
92
+
93
+ Recipes for Claude Skills, AWS Lambda, host applications, CI and HPC:
94
+ [docs/recipes.md](https://github.com/funkyfunc/bundleup/blob/main/docs/recipes.md).
95
+
96
+ ## Why
97
+
98
+ Python has three ways to hand a program to someone else, and the middle one is missing:
99
+
100
+ | Ship as | The other machine needs | Problem |
101
+ |---|---|---|
102
+ | Standalone executable | Nothing | Per-OS builds, code signing, antivirus (bundleup can wrap a bundle as one, unsigned: `--format exe`) |
103
+ | Source + `pip install` / `uv sync` | Python, an installer, network | The install step is where things break |
104
+ | **One file that runs on the user's Python** | **Python** | **No easy, reliable tool. That's bundleup** |
105
+
106
+ pex, shiv and zipapps can do parts of this. bundleup's bet is a much better experience on top of
107
+ the same correct approach: no flags to get it fast, plain-language errors, and a pre-ship check.
108
+ Measured against pex's fastest configuration: builds 1.1-2.4× faster, warm starts as fast as an
109
+ installed venv (pex adds 45-80 ms), first runs 2.3-15× faster
110
+ ([findings](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-07-speed-vs-pex-best.md)).
111
+ See [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md).
112
+
113
+ ## Where to start reading
114
+
115
+ - [MISSION.md](https://github.com/funkyfunc/bundleup/blob/main/MISSION.md): goal, scope, what "done" means
116
+ - [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md): where bundleup fits and who it's for
117
+ - [docs/roadmap.md](https://github.com/funkyfunc/bundleup/blob/main/docs/roadmap.md): where it could go next
118
+ - [docs/python-primer.md](https://github.com/funkyfunc/bundleup/blob/main/docs/python-primer.md): Python packaging explained for JavaScript developers
119
+ - [docs/adr/](https://github.com/funkyfunc/bundleup/blob/main/docs/adr/README.md): decisions and why they were made
120
+ - [docs/findings/2026-10-03-baseline.md](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-03-baseline.md): how pex, shiv and zipapps fare today
121
+ - [gauntlet/](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md): the test projects every bundler is measured against
122
+
123
+ ## Gauntlet
124
+
125
+ ```bash
126
+ uv run gauntlet/check_native.py # control group: projects run normally
127
+ uv run gauntlet/run_bundlers.py --conditions --out run # existing bundlers, incl. hostile conditions
128
+ uv run gauntlet/report.py gauntlet/results/run.json > gauntlet/results/run.md
129
+ ```
130
+
131
+ ## License
132
+
133
+ [MIT](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
@@ -0,0 +1,109 @@
1
+ # bundleup
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/bundleup.svg)](https://pypi.org/project/bundleup/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/bundleup.svg)](https://pypi.org/project/bundleup/)
5
+ [![CI](https://github.com/funkyfunc/bundleup/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/funkyfunc/bundleup/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
7
+
8
+ **Bundle up your Python app with everything it needs.** One command turns a locked project into a
9
+ single `.pyz` that runs on plain Python: no install step, no network, native extensions included.
10
+ And it tells you *before* you ship what won't survive the trip.
11
+
12
+ Dead simple to use, but also powerful and fast: esbuild's experience, for Python.
13
+
14
+ > **Status: alpha (0.2.0).** Builds for this machine or another platform (Linux, macOS, Windows;
15
+ > x86_64 and arm64), passes the [gauntlet](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md)
16
+ > on all four in CI, and the own test suites of click, packaging, markupsafe and itsdangerous give
17
+ > the same results from a bundle as from a venv (nightly). Try it without installing via
18
+ > `uvx bundleup build`, or install with `uv tool install bundleup` / `pip install bundleup`.
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ bundleup build # the project in this directory -> dist/<name>.pyz
24
+ bundleup build path/to/script.py # a PEP 723 script with inline dependencies
25
+ bundleup build --python 3.9 # build with Python 3.9 (pure Python: runs on 3.9 and newer)
26
+ bundleup build --python 3.11 --python-platform linux # build on a Mac for Linux x86_64
27
+ bundleup build --python-platform linux,macos,windows # one file for all three
28
+ bundleup build --external torch # leave a heavy host package out of the bundle
29
+ bundleup build --json # the result as JSON on stdout, for scripts and agents
30
+ bundleup check # what won't survive bundling, and each package's size
31
+ bundleup check --python-platform linux,windows # also check Windows wheels
32
+ bundleup check --matrix # which OS, CPU and Python versions the lock's wheels cover
33
+ bundleup build --smoke # then run it once: fresh home folder, no network
34
+ bundleup build --max-size 30MB # fail, writing nothing, if the bundle is bigger
35
+ bundleup build --format dir # a plain directory, for apps that load packages from one
36
+ bundleup build --format zip # a flat .zip of code, packages and bytecode (e.g. serverless)
37
+ bundleup build --format py # one plain-text .py file (for small tools: gists, uploads)
38
+ bundleup build --split 100MB # no file over 100 MB: a small .pyz and a folder of parts
39
+ bundleup build --format exe # experimental: an executable with its own Python, unsigned
40
+ bundleup verify dist/app.pyz # bundle and unpacked copy vs its manifest (corruption; not a signature)
41
+ bundleup cache clean # remove unpacked bundles not used for 30 days
42
+ python dist/<name>.pyz # run it: no install, no network
43
+ ```
44
+
45
+ bundleup reads what you have: `pyproject.toml` with `uv.lock` or `pylock.toml`, a script's
46
+ `# /// script` block, or, without a lock, a `pyproject.toml`, `setup.py` or `requirements.txt`
47
+ (resolved at build time, with a warning; [recipes](https://github.com/funkyfunc/bundleup/blob/main/docs/recipes.md)). It brings its own
48
+ [uv](https://docs.astral.sh/uv/) for the build; the bundle needs only Python. On first run it
49
+ unpacks to a cache (`~/Library/Caches/bundleup`, `~/.cache/bundleup`, or a temp directory if
50
+ those aren't writable), so later runs start as fast as an installed virtualenv; unpacking a new version removes older
51
+ copies of the same bundle that went unused for 30 days. A pure-Python
52
+ bundle runs on every Python version its lock allows (`Python 3.10+`), and on any OS when the lock
53
+ picks the same packages everywhere (`on any OS`); one with compiled code runs on the version and
54
+ platform it was built for. A bundle only sees
55
+ its own packages and the standard library; pass `--external <pkg>` (or set `BUNDLEUP_INHERIT_PATH=1` at runtime) to also let it use
56
+ packages installed on the machine (they come after the bundle's, but a machine package can still
57
+ win over a bundled namespace package of the same name: a Python rule, PEP 420). If it's started
58
+ with the wrong Python, it runs itself again with a matching one if one is installed; otherwise, and on
59
+ the wrong platform, it says so in one sentence. Programs it starts with
60
+ its own Python see its packages; any other Python it starts doesn't. bundleup never writes into
61
+ your project.
62
+
63
+ Every build checks the code first: a file of your project that doesn't compile on the target
64
+ Python stops the build, and anything that may not work in a bundle (a dependency's file that needs
65
+ a newer Python, data files a package expects under `sys.prefix`) is a warning. `bundleup check`
66
+ runs the same checks without writing a bundle and shows how big each package is; `--strict` makes
67
+ warnings fail too.
68
+
69
+ Recipes for Claude Skills, AWS Lambda, host applications, CI and HPC:
70
+ [docs/recipes.md](https://github.com/funkyfunc/bundleup/blob/main/docs/recipes.md).
71
+
72
+ ## Why
73
+
74
+ Python has three ways to hand a program to someone else, and the middle one is missing:
75
+
76
+ | Ship as | The other machine needs | Problem |
77
+ |---|---|---|
78
+ | Standalone executable | Nothing | Per-OS builds, code signing, antivirus (bundleup can wrap a bundle as one, unsigned: `--format exe`) |
79
+ | Source + `pip install` / `uv sync` | Python, an installer, network | The install step is where things break |
80
+ | **One file that runs on the user's Python** | **Python** | **No easy, reliable tool. That's bundleup** |
81
+
82
+ pex, shiv and zipapps can do parts of this. bundleup's bet is a much better experience on top of
83
+ the same correct approach: no flags to get it fast, plain-language errors, and a pre-ship check.
84
+ Measured against pex's fastest configuration: builds 1.1-2.4× faster, warm starts as fast as an
85
+ installed venv (pex adds 45-80 ms), first runs 2.3-15× faster
86
+ ([findings](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-07-speed-vs-pex-best.md)).
87
+ See [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md).
88
+
89
+ ## Where to start reading
90
+
91
+ - [MISSION.md](https://github.com/funkyfunc/bundleup/blob/main/MISSION.md): goal, scope, what "done" means
92
+ - [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md): where bundleup fits and who it's for
93
+ - [docs/roadmap.md](https://github.com/funkyfunc/bundleup/blob/main/docs/roadmap.md): where it could go next
94
+ - [docs/python-primer.md](https://github.com/funkyfunc/bundleup/blob/main/docs/python-primer.md): Python packaging explained for JavaScript developers
95
+ - [docs/adr/](https://github.com/funkyfunc/bundleup/blob/main/docs/adr/README.md): decisions and why they were made
96
+ - [docs/findings/2026-10-03-baseline.md](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-03-baseline.md): how pex, shiv and zipapps fare today
97
+ - [gauntlet/](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md): the test projects every bundler is measured against
98
+
99
+ ## Gauntlet
100
+
101
+ ```bash
102
+ uv run gauntlet/check_native.py # control group: projects run normally
103
+ uv run gauntlet/run_bundlers.py --conditions --out run # existing bundlers, incl. hostile conditions
104
+ uv run gauntlet/report.py gauntlet/results/run.json > gauntlet/results/run.md
105
+ ```
106
+
107
+ ## License
108
+
109
+ [MIT](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
@@ -0,0 +1,126 @@
1
+ [project]
2
+ name = "bundleup"
3
+ version = "0.2.0"
4
+ description = "Bundle up your Python app with everything it needs: one .pyz that runs on plain Python, no install step."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.9"
9
+ keywords = [
10
+ "bundler",
11
+ "pyz",
12
+ "zipapp",
13
+ "packaging",
14
+ "distribution",
15
+ "cli",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Developers",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Topic :: Software Development :: Build Tools",
24
+ "Topic :: System :: Software Distribution",
25
+ ]
26
+ dependencies = [
27
+ "packaging>=23",
28
+ "tomli>=1.1; python_version < '3.11'",
29
+ "uv>=0.9",
30
+ ]
31
+
32
+ [[project.authors]]
33
+ name = "funkyfunc"
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/funkyfunc/bundleup"
37
+ Repository = "https://github.com/funkyfunc/bundleup"
38
+ Issues = "https://github.com/funkyfunc/bundleup/issues"
39
+
40
+ [project.scripts]
41
+ bundleup = "bundleup._cli:main"
42
+
43
+ [build-system]
44
+ requires = ["uv_build>=0.12,<0.13"]
45
+ build-backend = "uv_build"
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "jsonschema>=4.25.1",
50
+ "pyright[nodejs]>=1.1.414",
51
+ "pytest>=8.4.2",
52
+ "ruff>=0.16.10",
53
+ "tomli>=2.4.1",
54
+ ]
55
+
56
+ [tool.ruff]
57
+ line-length = 100
58
+ target-version = "py39"
59
+ extend-exclude = [
60
+ "gauntlet/projects",
61
+ "docs",
62
+ ]
63
+ force-exclude = true
64
+
65
+ [tool.ruff.per-file-target-version]
66
+ "gauntlet/*.py" = "py311"
67
+ "gauntlet/snapshot.py" = "py39"
68
+
69
+ [tool.ruff.lint]
70
+ select = [
71
+ "E",
72
+ "F",
73
+ "W",
74
+ "I",
75
+ "B",
76
+ "UP",
77
+ "SIM",
78
+ "RUF",
79
+ "ANN",
80
+ ]
81
+ allowed-confusables = ["–"]
82
+
83
+ [tool.ruff.lint.per-file-ignores]
84
+ "src/bundleup/_loader.py" = [
85
+ "UP004",
86
+ "UP031",
87
+ "UP032",
88
+ ]
89
+ "src/bundleup/_runtime.py" = [
90
+ "UP004",
91
+ "UP031",
92
+ "UP032",
93
+ "UP035",
94
+ ]
95
+ "src/bundleup/_sitecustomize.py" = [
96
+ "UP004",
97
+ "UP031",
98
+ "UP032",
99
+ ]
100
+
101
+ [tool.pyright]
102
+ include = [
103
+ "src",
104
+ "tests",
105
+ "gauntlet/*.py",
106
+ ]
107
+ exclude = [
108
+ "gauntlet/projects",
109
+ "gauntlet/.work",
110
+ ]
111
+ pythonVersion = "3.9"
112
+ typeCheckingMode = "standard"
113
+
114
+ [[tool.pyright.executionEnvironments]]
115
+ root = "gauntlet/snapshot.py"
116
+ pythonVersion = "3.9"
117
+
118
+ [[tool.pyright.executionEnvironments]]
119
+ root = "gauntlet"
120
+ pythonVersion = "3.11"
121
+
122
+ [[tool.pyright.executionEnvironments]]
123
+ root = "src"
124
+
125
+ [[tool.pyright.executionEnvironments]]
126
+ root = "tests"
@@ -0,0 +1,78 @@
1
+ [project]
2
+ name = "bundleup"
3
+ version = "0.2.0"
4
+ description = "Bundle up your Python app with everything it needs: one .pyz that runs on plain Python, no install step."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.9"
9
+ authors = [{ name = "funkyfunc" }]
10
+ keywords = ["bundler", "pyz", "zipapp", "packaging", "distribution", "cli"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Environment :: Console",
14
+ "Intended Audience :: Developers",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Topic :: Software Development :: Build Tools",
18
+ "Topic :: System :: Software Distribution",
19
+ ]
20
+ dependencies = [
21
+ "packaging>=23",
22
+ "tomli>=1.1; python_version < '3.11'",
23
+ "uv>=0.9",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/funkyfunc/bundleup"
28
+ Repository = "https://github.com/funkyfunc/bundleup"
29
+ Issues = "https://github.com/funkyfunc/bundleup/issues"
30
+
31
+ [project.scripts]
32
+ bundleup = "bundleup._cli:main"
33
+
34
+ [build-system]
35
+ requires = ["uv_build>=0.12,<0.13"]
36
+ build-backend = "uv_build"
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "jsonschema>=4.25.1",
41
+ "pyright[nodejs]>=1.1.414",
42
+ "pytest>=8.4.2",
43
+ "ruff>=0.16.10",
44
+ "tomli>=2.4.1",
45
+ ]
46
+
47
+ # Code quality (ADR-0015). Rule choices are Proposed until the user confirms them.
48
+ [tool.ruff]
49
+ line-length = 100
50
+ target-version = "py39" # the loader must run on macOS's system Python 3.9
51
+ extend-exclude = ["gauntlet/projects", "docs"] # fixtures (17 uses 3.12-only syntax on purpose)
52
+ force-exclude = true # also when a hook passes an excluded file explicitly
53
+ # Harness scripts need tomllib; snapshot.py runs on the target Python, so it stays 3.9.
54
+ per-file-target-version = { "gauntlet/*.py" = "py311", "gauntlet/snapshot.py" = "py39" }
55
+
56
+ [tool.ruff.lint]
57
+ # ANN enforces "type hints on every function signature" (docs/python-for-js-reviewers.md).
58
+ select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF", "ANN"]
59
+ allowed-confusables = ["–"] # the en dash reports use for "not applicable"
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ # The loader prints its "wrong Python" message on any Python 3, so it avoids f-strings and other
63
+ # newer syntax on purpose; the payload's runtime files follow the same rules (ADR-0027).
64
+ "src/bundleup/_loader.py" = ["UP004", "UP031", "UP032"]
65
+ "src/bundleup/_runtime.py" = ["UP004", "UP031", "UP032", "UP035"]
66
+ "src/bundleup/_sitecustomize.py" = ["UP004", "UP031", "UP032"]
67
+
68
+ [tool.pyright]
69
+ include = ["src", "tests", "gauntlet/*.py"]
70
+ exclude = ["gauntlet/projects", "gauntlet/.work"] # fixtures, even when a path is passed explicitly
71
+ pythonVersion = "3.9"
72
+ typeCheckingMode = "standard"
73
+ executionEnvironments = [
74
+ { root = "gauntlet/snapshot.py", pythonVersion = "3.9" },
75
+ { root = "gauntlet", pythonVersion = "3.11" },
76
+ { root = "src" },
77
+ { root = "tests" },
78
+ ]
@@ -0,0 +1,94 @@
1
+ """bundleup: make self-contained Python files.
2
+
3
+ The public API is exactly `__all__` (docs/cli-style-guide.md rule 38); everything else lives in
4
+ `_private` modules. The build machinery is imported on first use of `build` and friends, so
5
+ `import bundleup` (and so `bundleup --version`) stays cheap (rule 35, ADR-0018).
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from importlib import import_module
11
+ from typing import TYPE_CHECKING
12
+
13
+ from ._errors import (
14
+ BundleMismatchError,
15
+ BundleupError,
16
+ CheckFailedError,
17
+ Diagnostic,
18
+ EntryPointError,
19
+ ExitCode,
20
+ LockfileOutdatedError,
21
+ NoCompatibleWheelError,
22
+ NoLockfileError,
23
+ NotABundleError,
24
+ ProjectError,
25
+ PythonMismatchError,
26
+ PythonNotFoundError,
27
+ UsageError,
28
+ UvError,
29
+ UvNotFoundError,
30
+ )
31
+
32
+ if TYPE_CHECKING:
33
+ from ._build import BuildOptions, BuildResult, build, check
34
+ from ._cache import CachedBundle, CleanReport, clean_cache, list_cache
35
+ from ._check import CheckReport, PackageSize
36
+ from ._python import Target
37
+ from ._steps import ProgressEvent
38
+ from ._verify import VerifyReport, verify
39
+
40
+ __version__ = "0.2.0"
41
+
42
+ __all__ = [
43
+ "BuildOptions",
44
+ "BuildResult",
45
+ "BundleMismatchError",
46
+ "BundleupError",
47
+ "CachedBundle",
48
+ "CheckFailedError",
49
+ "CheckReport",
50
+ "CleanReport",
51
+ "Diagnostic",
52
+ "EntryPointError",
53
+ "ExitCode",
54
+ "LockfileOutdatedError",
55
+ "NoCompatibleWheelError",
56
+ "NoLockfileError",
57
+ "NotABundleError",
58
+ "PackageSize",
59
+ "ProgressEvent",
60
+ "ProjectError",
61
+ "PythonMismatchError",
62
+ "PythonNotFoundError",
63
+ "Target",
64
+ "UsageError",
65
+ "UvError",
66
+ "UvNotFoundError",
67
+ "VerifyReport",
68
+ "__version__",
69
+ "build",
70
+ "check",
71
+ "clean_cache",
72
+ "list_cache",
73
+ "verify",
74
+ ]
75
+
76
+ # Public names whose module is imported only when they're first used.
77
+ _LAZY = {
78
+ **{name: "._build" for name in ("BuildOptions", "BuildResult", "build", "check")},
79
+ "ProgressEvent": "._steps",
80
+ "Target": "._python",
81
+ **{name: "._check" for name in ("CheckReport", "PackageSize")},
82
+ **{name: "._verify" for name in ("VerifyReport", "verify")},
83
+ **{name: "._cache" for name in ("CachedBundle", "CleanReport", "clean_cache", "list_cache")},
84
+ }
85
+
86
+
87
+ def __getattr__(name: str) -> object:
88
+ """Load lazily exported names on first access (PEP 562; see ADR-0018 for why)."""
89
+ module = _LAZY.get(name)
90
+ if module is None:
91
+ raise AttributeError(f"module 'bundleup' has no attribute {name!r}")
92
+ value = getattr(import_module(module, __name__), name)
93
+ globals()[name] = value # later lookups skip this function
94
+ return value
@@ -0,0 +1,7 @@
1
+ """`python -m bundleup`: the same as the `bundleup` command."""
2
+
3
+ import sys
4
+
5
+ from ._cli import main
6
+
7
+ sys.exit(main())