bundleup 0.0.1__tar.gz → 0.1.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 (43) hide show
  1. bundleup-0.1.0/PKG-INFO +127 -0
  2. bundleup-0.1.0/README.md +103 -0
  3. bundleup-0.1.0/pyproject.toml +126 -0
  4. bundleup-0.1.0/pyproject.toml.orig +78 -0
  5. bundleup-0.1.0/src/bundleup/__init__.py +94 -0
  6. bundleup-0.1.0/src/bundleup/__main__.py +7 -0
  7. bundleup-0.1.0/src/bundleup/_audit.py +177 -0
  8. bundleup-0.1.0/src/bundleup/_build.py +831 -0
  9. bundleup-0.1.0/src/bundleup/_bytecode.py +177 -0
  10. bundleup-0.1.0/src/bundleup/_cache.py +182 -0
  11. bundleup-0.1.0/src/bundleup/_check.py +448 -0
  12. bundleup-0.1.0/src/bundleup/_cli.py +813 -0
  13. bundleup-0.1.0/src/bundleup/_config.py +128 -0
  14. bundleup-0.1.0/src/bundleup/_coverage.py +200 -0
  15. bundleup-0.1.0/src/bundleup/_errors.py +139 -0
  16. bundleup-0.1.0/src/bundleup/_exe.py +439 -0
  17. bundleup-0.1.0/src/bundleup/_formats.py +39 -0
  18. bundleup-0.1.0/src/bundleup/_imports.py +145 -0
  19. bundleup-0.1.0/src/bundleup/_loader.py +912 -0
  20. bundleup-0.1.0/src/bundleup/_outputs.py +643 -0
  21. bundleup-0.1.0/src/bundleup/_payload.py +401 -0
  22. bundleup-0.1.0/src/bundleup/_platforms.py +228 -0
  23. bundleup-0.1.0/src/bundleup/_python.py +311 -0
  24. bundleup-0.1.0/src/bundleup/_runtime.py +140 -0
  25. bundleup-0.1.0/src/bundleup/_sitecustomize.py +74 -0
  26. bundleup-0.1.0/src/bundleup/_smoke.py +153 -0
  27. bundleup-0.1.0/src/bundleup/_source.py +334 -0
  28. bundleup-0.1.0/src/bundleup/_steps.py +88 -0
  29. bundleup-0.1.0/src/bundleup/_target_files.py +147 -0
  30. bundleup-0.1.0/src/bundleup/_term.py +92 -0
  31. bundleup-0.1.0/src/bundleup/_text.py +22 -0
  32. bundleup-0.1.0/src/bundleup/_toml.py +12 -0
  33. bundleup-0.1.0/src/bundleup/_uv.py +468 -0
  34. bundleup-0.1.0/src/bundleup/_verify.py +575 -0
  35. bundleup-0.1.0/src/bundleup/_zipwriter.py +186 -0
  36. bundleup-0.1.0/src/bundleup/py.typed +0 -0
  37. bundleup-0.0.1/PKG-INFO +0 -67
  38. bundleup-0.0.1/README.md +0 -46
  39. bundleup-0.0.1/pyproject.toml +0 -41
  40. bundleup-0.0.1/pyproject.toml.orig +0 -32
  41. bundleup-0.0.1/src/bundleup/__init__.py +0 -3
  42. bundleup-0.0.1/src/bundleup/cli.py +0 -26
  43. {bundleup-0.0.1 → bundleup-0.1.0}/LICENSE +0 -0
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: bundleup
3
+ Version: 0.1.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
+ **Bundle up your Python app with everything it needs.** One command turns a locked project into a
28
+ single `.pyz` that runs on plain Python: no install step, no network, native extensions included.
29
+ And it tells you *before* you ship what won't survive the trip.
30
+
31
+ Dead simple to use, but also powerful and fast: esbuild's experience, for Python.
32
+
33
+ > **Status: alpha (0.1.0).** Builds for this machine or another platform (Linux, macOS, Windows;
34
+ > x86_64 and arm64), passes the [gauntlet](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md)
35
+ > on all four in CI, and the own test suites of click, packaging, markupsafe and itsdangerous give
36
+ > the same results from a bundle as from a venv (nightly). Try it without installing via
37
+ > `uvx bundleup build`, or install with `uv tool install bundleup` / `pip install bundleup`.
38
+
39
+ ## Usage
40
+
41
+ ```bash
42
+ bundleup build # the project in this directory -> dist/<name>.pyz
43
+ bundleup build path/to/script.py # a PEP 723 script with inline dependencies
44
+ bundleup build --python 3.9 # build with Python 3.9 (pure Python: runs on 3.9 and newer)
45
+ bundleup build --python 3.11 --python-platform linux # build on a Mac for Linux x86_64
46
+ bundleup build --python-platform linux --python-platform macos --python-platform windows # one file for all three
47
+ bundleup build --json # the result as JSON on stdout, for scripts and agents
48
+ bundleup check # what won't survive bundling, and each package's size
49
+ bundleup check --also-platform windows # which packages lack a wheel for another OS
50
+ bundleup check --matrix # which OS, CPU and Python versions the lock's wheels cover
51
+ bundleup build --smoke # then run it once: fresh home folder, no network
52
+ bundleup check --audit # ask PyPI: vulnerable, yanked or brand-new dependencies?
53
+ bundleup build --max-size 30MB # fail, writing nothing, if the bundle is bigger
54
+ bundleup build --format dir # a plain directory, for apps that load packages from one
55
+ bundleup build --format py # one plain-text .py file (for small tools: gists, uploads)
56
+ bundleup build --split 100MB # no file over 100 MB: a small .pyz and a folder of parts
57
+ bundleup build --format exe # experimental: an executable with its own Python, unsigned
58
+ bundleup verify dist/app.pyz # bundle and unpacked copy vs its manifest (corruption; not a signature)
59
+ bundleup cache clean # remove unpacked bundles not used for 30 days
60
+ python dist/<name>.pyz # run it: no install, no network
61
+ ```
62
+
63
+ bundleup reads what you have: `pyproject.toml` with `uv.lock` or `pylock.toml`, a script's
64
+ `# /// script` block, or, without a lock, a `pyproject.toml`, `setup.py` or `requirements.txt`
65
+ (resolved at build time, with a warning; [recipes](docs/recipes.md)). It brings its own
66
+ [uv](https://docs.astral.sh/uv/) for the build; the bundle needs only Python. On first run it
67
+ unpacks to a cache (`~/Library/Caches/bundleup`, `~/.cache/bundleup`, or a temp directory if
68
+ those aren't writable), so later runs start as fast as an installed virtualenv; unpacking a new version removes older
69
+ copies of the same bundle that went unused for 30 days. A pure-Python
70
+ bundle runs on every Python version its lock allows (`Python 3.10+`), and on any OS when the lock
71
+ picks the same packages everywhere (`on any OS`); one with compiled code runs on the version and
72
+ platform it was built for. A bundle only sees
73
+ its own packages and the standard library; set `BUNDLEUP_INHERIT_PATH=1` to also let it use
74
+ packages installed on the machine (they come after the bundle's, but a machine package can still
75
+ win over a bundled namespace package of the same name: a Python rule, PEP 420). If it's started
76
+ with the wrong Python, it runs itself again with a matching one if one is installed; otherwise, and on
77
+ the wrong platform, it says so in one sentence. Programs it starts with
78
+ its own Python see its packages; any other Python it starts doesn't. bundleup never writes into
79
+ your project.
80
+
81
+ Every build checks the code first: a file of your project that doesn't compile on the target
82
+ Python stops the build, and anything that may not work in a bundle (a dependency's file that needs
83
+ a newer Python, data files a package expects under `sys.prefix`) is a warning. `bundleup check`
84
+ runs the same checks without writing a bundle and shows how big each package is; `--strict` makes
85
+ warnings fail too.
86
+
87
+ Recipes for Claude Skills, AWS Lambda, host applications, CI and HPC:
88
+ [docs/recipes.md](docs/recipes.md).
89
+
90
+ ## Why
91
+
92
+ Python has three ways to hand a program to someone else, and the middle one is missing:
93
+
94
+ | Ship as | The other machine needs | Problem |
95
+ |---|---|---|
96
+ | Standalone executable | Nothing | Per-OS builds, code signing, antivirus (bundleup can wrap a bundle as one, unsigned: `--format exe`) |
97
+ | Source + `pip install` / `uv sync` | Python, an installer, network | The install step is where things break |
98
+ | **One file that runs on the user's Python** | **Python** | **No easy, reliable tool. That's bundleup** |
99
+
100
+ pex, shiv and zipapps can do parts of this. bundleup's bet is a much better experience on top of
101
+ the same correct approach: no flags to get it fast, plain-language errors, and a pre-ship check.
102
+ Measured against pex's fastest configuration: builds 1.1-2.4× faster, warm starts as fast as an
103
+ installed venv (pex adds 45-80 ms), first runs 2.3-15× faster
104
+ ([findings](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-07-speed-vs-pex-best.md)).
105
+ See [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md).
106
+
107
+ ## Where to start reading
108
+
109
+ - [MISSION.md](https://github.com/funkyfunc/bundleup/blob/main/MISSION.md): goal, scope, what "done" means
110
+ - [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md): where bundleup fits and who it's for
111
+ - [docs/roadmap.md](https://github.com/funkyfunc/bundleup/blob/main/docs/roadmap.md): where it could go next
112
+ - [docs/python-primer.md](https://github.com/funkyfunc/bundleup/blob/main/docs/python-primer.md): Python packaging explained for JavaScript developers
113
+ - [docs/adr/](https://github.com/funkyfunc/bundleup/blob/main/docs/adr/README.md): decisions and why they were made
114
+ - [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
115
+ - [gauntlet/](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md): the test projects every bundler is measured against
116
+
117
+ ## Gauntlet
118
+
119
+ ```bash
120
+ uv run gauntlet/check_native.py # control group: projects run normally
121
+ uv run gauntlet/run_bundlers.py --conditions --out run # existing bundlers, incl. hostile conditions
122
+ uv run gauntlet/report.py gauntlet/results/run.json > gauntlet/results/run.md
123
+ ```
124
+
125
+ ## License
126
+
127
+ [MIT](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
@@ -0,0 +1,103 @@
1
+ # bundleup
2
+
3
+ **Bundle up your Python app with everything it needs.** One command turns a locked project into a
4
+ single `.pyz` that runs on plain Python: no install step, no network, native extensions included.
5
+ And it tells you *before* you ship what won't survive the trip.
6
+
7
+ Dead simple to use, but also powerful and fast: esbuild's experience, for Python.
8
+
9
+ > **Status: alpha (0.1.0).** Builds for this machine or another platform (Linux, macOS, Windows;
10
+ > x86_64 and arm64), passes the [gauntlet](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md)
11
+ > on all four in CI, and the own test suites of click, packaging, markupsafe and itsdangerous give
12
+ > the same results from a bundle as from a venv (nightly). Try it without installing via
13
+ > `uvx bundleup build`, or install with `uv tool install bundleup` / `pip install bundleup`.
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ bundleup build # the project in this directory -> dist/<name>.pyz
19
+ bundleup build path/to/script.py # a PEP 723 script with inline dependencies
20
+ bundleup build --python 3.9 # build with Python 3.9 (pure Python: runs on 3.9 and newer)
21
+ bundleup build --python 3.11 --python-platform linux # build on a Mac for Linux x86_64
22
+ bundleup build --python-platform linux --python-platform macos --python-platform windows # one file for all three
23
+ bundleup build --json # the result as JSON on stdout, for scripts and agents
24
+ bundleup check # what won't survive bundling, and each package's size
25
+ bundleup check --also-platform windows # which packages lack a wheel for another OS
26
+ bundleup check --matrix # which OS, CPU and Python versions the lock's wheels cover
27
+ bundleup build --smoke # then run it once: fresh home folder, no network
28
+ bundleup check --audit # ask PyPI: vulnerable, yanked or brand-new dependencies?
29
+ bundleup build --max-size 30MB # fail, writing nothing, if the bundle is bigger
30
+ bundleup build --format dir # a plain directory, for apps that load packages from one
31
+ bundleup build --format py # one plain-text .py file (for small tools: gists, uploads)
32
+ bundleup build --split 100MB # no file over 100 MB: a small .pyz and a folder of parts
33
+ bundleup build --format exe # experimental: an executable with its own Python, unsigned
34
+ bundleup verify dist/app.pyz # bundle and unpacked copy vs its manifest (corruption; not a signature)
35
+ bundleup cache clean # remove unpacked bundles not used for 30 days
36
+ python dist/<name>.pyz # run it: no install, no network
37
+ ```
38
+
39
+ bundleup reads what you have: `pyproject.toml` with `uv.lock` or `pylock.toml`, a script's
40
+ `# /// script` block, or, without a lock, a `pyproject.toml`, `setup.py` or `requirements.txt`
41
+ (resolved at build time, with a warning; [recipes](docs/recipes.md)). It brings its own
42
+ [uv](https://docs.astral.sh/uv/) for the build; the bundle needs only Python. On first run it
43
+ unpacks to a cache (`~/Library/Caches/bundleup`, `~/.cache/bundleup`, or a temp directory if
44
+ those aren't writable), so later runs start as fast as an installed virtualenv; unpacking a new version removes older
45
+ copies of the same bundle that went unused for 30 days. A pure-Python
46
+ bundle runs on every Python version its lock allows (`Python 3.10+`), and on any OS when the lock
47
+ picks the same packages everywhere (`on any OS`); one with compiled code runs on the version and
48
+ platform it was built for. A bundle only sees
49
+ its own packages and the standard library; set `BUNDLEUP_INHERIT_PATH=1` to also let it use
50
+ packages installed on the machine (they come after the bundle's, but a machine package can still
51
+ win over a bundled namespace package of the same name: a Python rule, PEP 420). If it's started
52
+ with the wrong Python, it runs itself again with a matching one if one is installed; otherwise, and on
53
+ the wrong platform, it says so in one sentence. Programs it starts with
54
+ its own Python see its packages; any other Python it starts doesn't. bundleup never writes into
55
+ your project.
56
+
57
+ Every build checks the code first: a file of your project that doesn't compile on the target
58
+ Python stops the build, and anything that may not work in a bundle (a dependency's file that needs
59
+ a newer Python, data files a package expects under `sys.prefix`) is a warning. `bundleup check`
60
+ runs the same checks without writing a bundle and shows how big each package is; `--strict` makes
61
+ warnings fail too.
62
+
63
+ Recipes for Claude Skills, AWS Lambda, host applications, CI and HPC:
64
+ [docs/recipes.md](docs/recipes.md).
65
+
66
+ ## Why
67
+
68
+ Python has three ways to hand a program to someone else, and the middle one is missing:
69
+
70
+ | Ship as | The other machine needs | Problem |
71
+ |---|---|---|
72
+ | Standalone executable | Nothing | Per-OS builds, code signing, antivirus (bundleup can wrap a bundle as one, unsigned: `--format exe`) |
73
+ | Source + `pip install` / `uv sync` | Python, an installer, network | The install step is where things break |
74
+ | **One file that runs on the user's Python** | **Python** | **No easy, reliable tool. That's bundleup** |
75
+
76
+ pex, shiv and zipapps can do parts of this. bundleup's bet is a much better experience on top of
77
+ the same correct approach: no flags to get it fast, plain-language errors, and a pre-ship check.
78
+ Measured against pex's fastest configuration: builds 1.1-2.4× faster, warm starts as fast as an
79
+ installed venv (pex adds 45-80 ms), first runs 2.3-15× faster
80
+ ([findings](https://github.com/funkyfunc/bundleup/blob/main/docs/findings/2026-10-07-speed-vs-pex-best.md)).
81
+ See [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md).
82
+
83
+ ## Where to start reading
84
+
85
+ - [MISSION.md](https://github.com/funkyfunc/bundleup/blob/main/MISSION.md): goal, scope, what "done" means
86
+ - [docs/vision.md](https://github.com/funkyfunc/bundleup/blob/main/docs/vision.md): where bundleup fits and who it's for
87
+ - [docs/roadmap.md](https://github.com/funkyfunc/bundleup/blob/main/docs/roadmap.md): where it could go next
88
+ - [docs/python-primer.md](https://github.com/funkyfunc/bundleup/blob/main/docs/python-primer.md): Python packaging explained for JavaScript developers
89
+ - [docs/adr/](https://github.com/funkyfunc/bundleup/blob/main/docs/adr/README.md): decisions and why they were made
90
+ - [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
91
+ - [gauntlet/](https://github.com/funkyfunc/bundleup/blob/main/gauntlet/README.md): the test projects every bundler is measured against
92
+
93
+ ## Gauntlet
94
+
95
+ ```bash
96
+ uv run gauntlet/check_native.py # control group: projects run normally
97
+ uv run gauntlet/run_bundlers.py --conditions --out run # existing bundlers, incl. hostile conditions
98
+ uv run gauntlet/report.py gauntlet/results/run.json > gauntlet/results/run.md
99
+ ```
100
+
101
+ ## License
102
+
103
+ [MIT](https://github.com/funkyfunc/bundleup/blob/main/LICENSE)
@@ -0,0 +1,126 @@
1
+ [project]
2
+ name = "bundleup"
3
+ version = "0.1.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.1.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.1.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())