piebuild 3.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 (44) hide show
  1. piebuild-3.1.0/LICENSE +36 -0
  2. piebuild-3.1.0/PKG-INFO +425 -0
  3. piebuild-3.1.0/README.md +385 -0
  4. piebuild-3.1.0/piebuild/__init__.py +14 -0
  5. piebuild-3.1.0/piebuild/__main__.py +12 -0
  6. piebuild-3.1.0/piebuild/artifact.py +172 -0
  7. piebuild-3.1.0/piebuild/attestation.py +88 -0
  8. piebuild-3.1.0/piebuild/backends/__init__.py +10 -0
  9. piebuild-3.1.0/piebuild/backends/docker_backend.py +385 -0
  10. piebuild-3.1.0/piebuild/backends/macos_backend.py +34 -0
  11. piebuild-3.1.0/piebuild/backends/native.py +80 -0
  12. piebuild-3.1.0/piebuild/backends/remote_backend.py +35 -0
  13. piebuild-3.1.0/piebuild/checksums.py +115 -0
  14. piebuild-3.1.0/piebuild/cli/__init__.py +9 -0
  15. piebuild-3.1.0/piebuild/cli/main.py +869 -0
  16. piebuild-3.1.0/piebuild/config.py +323 -0
  17. piebuild-3.1.0/piebuild/context.py +246 -0
  18. piebuild-3.1.0/piebuild/core/__init__.py +230 -0
  19. piebuild-3.1.0/piebuild/core/bundle.py +723 -0
  20. piebuild-3.1.0/piebuild/core/cache.py +161 -0
  21. piebuild-3.1.0/piebuild/formats/__init__.py +144 -0
  22. piebuild-3.1.0/piebuild/formats/app.py +188 -0
  23. piebuild-3.1.0/piebuild/formats/appimage.py +445 -0
  24. piebuild-3.1.0/piebuild/formats/exe.py +567 -0
  25. piebuild-3.1.0/piebuild/formats/pie.py +34 -0
  26. piebuild-3.1.0/piebuild/gui/__init__.py +10 -0
  27. piebuild-3.1.0/piebuild/gui/builder.py +38 -0
  28. piebuild-3.1.0/piebuild/gui/main.py +588 -0
  29. piebuild-3.1.0/piebuild/ingredients/__init__.py +125 -0
  30. piebuild-3.1.0/piebuild/launchers.py +206 -0
  31. piebuild-3.1.0/piebuild/native.py +323 -0
  32. piebuild-3.1.0/piebuild/recipes/__init__.py +166 -0
  33. piebuild-3.1.0/piebuild/recipes/builtin/console-app.toml +11 -0
  34. piebuild-3.1.0/piebuild/recipes/builtin/gui-app.toml +11 -0
  35. piebuild-3.1.0/piebuild/release.py +92 -0
  36. piebuild-3.1.0/piebuild/runtime/__init__.py +95 -0
  37. piebuild-3.1.0/piebuild/runtime/cache.py +125 -0
  38. piebuild-3.1.0/piebuild/runtime/downloaded.py +502 -0
  39. piebuild-3.1.0/piebuild/runtime/provider.py +199 -0
  40. piebuild-3.1.0/piebuild/runtime/system.py +262 -0
  41. piebuild-3.1.0/piebuild/signing/__init__.py +78 -0
  42. piebuild-3.1.0/piebuild/signing/local.py +265 -0
  43. piebuild-3.1.0/piebuild/validation.py +598 -0
  44. piebuild-3.1.0/pyproject.toml +157 -0
piebuild-3.1.0/LICENSE ADDED
@@ -0,0 +1,36 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2026 PyPie Team
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+
19
+ ---
20
+
21
+ PyPie
22
+
23
+ A modern Python application build platform.
24
+
25
+ This program is free software: you can redistribute it and/or modify
26
+ it under the terms of the GNU General Public License as published by
27
+ the Free Software Foundation, either version 3 of the License, or
28
+ (at your option) any later version.
29
+
30
+ This program is distributed in the hope that it will be useful,
31
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
32
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33
+ GNU General Public License for more details.
34
+
35
+ You should have received a copy of the GNU General Public License
36
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
@@ -0,0 +1,425 @@
1
+ Metadata-Version: 2.5
2
+ Name: piebuild
3
+ Version: 3.1.0
4
+ Summary: Modern Python application build platform
5
+ Project-URL: Homepage, https://github.com/ThatByteGuy/PieBuild
6
+ Project-URL: Documentation, https://github.com/ThatByteGuy/PieBuild#readme
7
+ Project-URL: Repository, https://github.com/ThatByteGuy/PieBuild
8
+ Project-URL: Bug Tracker, https://github.com/ThatByteGuy/PieBuild/issues
9
+ Author-email: ThatByteGuy <12aa44edsta@gmail.com>
10
+ License: GPL-3.0-or-later
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Build Tools
22
+ Classifier: Topic :: System :: Software Distribution
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: click>=8.0.0
25
+ Requires-Dist: packaging>=21.0.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: rich>=13.0.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: black>=22.0.0; extra == 'dev'
30
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
31
+ Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
33
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
35
+ Provides-Extra: gui
36
+ Requires-Dist: pyside6>=6.5.0; extra == 'gui'
37
+ Provides-Extra: signing
38
+ Requires-Dist: cryptography>=41.0.0; extra == 'signing'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # PieBuild
42
+
43
+ [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
44
+ [![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
45
+ [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
46
+
47
+ PieBuild is a modern Python application build platform that bakes your Python applications into delicious, portable bundles.
48
+
49
+ ## Features
50
+
51
+ - 🥧 **Simple CLI**: Easy-to-use command-line interface
52
+ - 🎯 **Targeted Builds**: Build for different platforms (Windows, Linux, macOS, Native)
53
+ - 🔧 **Plugin System**: Extensible architecture for custom backends and formats
54
+ - 📦 **Canonical Bundle**: Native `.pie` bundle format (deterministic, portable)
55
+ - 🔍 **Multi-Format**: AppImage for Linux, PE `.exe` for Windows (extensible to `.app` via format plugins)
56
+ - 🔍 **Bundle Inspection**: Extract and inspect bundled applications
57
+ - 🚀 **Direct Execution**: Run bundles directly from the command line
58
+ - 📋 **Recipes**: Pre-built templates for common application types
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install piebuild
64
+ ```
65
+
66
+ ## Quick Start
67
+
68
+ ### 1. Bake your application
69
+
70
+ ```bash
71
+ # Create a simple Python app
72
+ echo 'print("Hello from PieBuild!")' > hello.py
73
+
74
+ # Bake it into a bundle
75
+ piebuild bake hello.py
76
+
77
+ # Run the bundle
78
+ piebuild run hello.pie
79
+ ```
80
+
81
+ ### 2. Build for different targets
82
+
83
+ ```bash
84
+ # Build for Windows
85
+ piebuild bake app.py --target windows
86
+
87
+ # Build for Linux
88
+ piebuild bake app.py --target linux
89
+
90
+ # Build for macOS
91
+ piebuild bake app.py --target macos
92
+ ```
93
+
94
+ ### 3. Extract and inspect bundles
95
+
96
+ ```bash
97
+ # Extract a bundle for inspection
98
+ piebuild extract my_app.pie
99
+
100
+ # Inspect manifest
101
+ piebuild inspect my_app.pie
102
+
103
+ # View available formats (with capability report)
104
+ piebuild formats
105
+
106
+ # View available backends
107
+ piebuild backends
108
+ ```
109
+
110
+ ### 4. Build AppImage for Linux
111
+
112
+ ```bash
113
+ # AppImage is a format adapter over the canonical .pie
114
+ piebuild bake app.py --format appimage --target linux
115
+
116
+ # Formats truthfully report tooling requirements
117
+ piebuild formats
118
+ # pie Native PieBuild bundle linux/windows/macos Available
119
+ # appimage Linux portable AppImage linux Requires: appimagetool
120
+ ```
121
+
122
+ ### 5. Build Windows EXE (PE32+)
123
+
124
+ ```bash
125
+ # EXE is a format adapter over the canonical .pie — genuine PE via MinGW
126
+ piebuild bake app.py --format exe --target windows --backend docker # cross-build via Docker
127
+ # or native Windows host:
128
+ piebuild bake app.py --format exe --target windows
129
+
130
+ # Requires MinGW-w64: x86_64-w64-mingw32-gcc + windres for icon/version
131
+ piebuild formats
132
+ # exe Windows executable (PE32+) windows/x86_64 Requires: x86_64-w64-mingw32-gcc
133
+ # Code signing: not yet implemented (future: cert, timestamp, CI)
134
+ ```
135
+
136
+ ## Project Structure
137
+
138
+ ```
139
+ piebuild/
140
+ ├── __init__.py # Package initialization
141
+ ├── __main__.py # CLI entry point
142
+ ├── config.py # Configuration models
143
+ ├── context.py # Build context utilities
144
+ ├── core/ # Core build engine
145
+ │ ├── __init__.py # BuildEngine and BuildResult
146
+ │ └── bundle.py # Bundle building logic
147
+ ├── backends/ # Build backends
148
+ │ ├── __init__.py # Backend registry
149
+ │ └── native.py # Native build backend
150
+ ├── formats/ # Output formats (plugin architecture)
151
+ │ ├── __init__.py # Format registry & OutputFormat ABC
152
+ │ ├── pie.py # PieBuild native format (canonical)
153
+ │ ├── appimage.py # AppImage format (Linux x86_64)
154
+ │ └── exe.py # Windows PE executable (windows x86_64, MinGW)
155
+ ├── cli/ # Command-line interface
156
+ │ ├── __init__.py # CLI package
157
+ │ └── main.py # Main CLI commands
158
+ └── tests/ # Test suite
159
+ └── test_core.py # Core functionality tests
160
+ ```
161
+
162
+ ## CLI Reference
163
+
164
+ ### bake
165
+
166
+ Build a Python application into a bundle.
167
+
168
+ ```bash
169
+ piebuild bake SOURCE [OPTIONS]
170
+ ```
171
+
172
+ **Options:**
173
+ - `--output, -o`: Output directory (default: ./dist)
174
+ - `--target`: Target platform (native, windows, linux, macos)
175
+ - `--backend`: Build backend (default: native)
176
+ - `--format`: Output format (default: pie)
177
+ - `--onefile`: Create single-file bundle (default: true)
178
+ - `--console-mode`: Run in console mode (no GUI)
179
+ - `--icon`: Icon file path
180
+ - `--recipe`: Build recipe to use
181
+
182
+ ### run
183
+
184
+ Run a PieBuild bundle.
185
+
186
+ ```bash
187
+ piebuild run BUNDLE_PATH
188
+ ```
189
+
190
+ ### extract
191
+
192
+ Extract a PieBuild bundle for inspection.
193
+
194
+ ```bash
195
+ piebuild extract BUNDLE_PATH [OPTIONS]
196
+ ```
197
+
198
+ **Options:**
199
+ - `--output, -o`: Output directory for extraction
200
+
201
+ ### formats
202
+
203
+ List available output formats with capability report (extension, targets, availability, toolchain).
204
+
205
+ ```bash
206
+ piebuild formats
207
+ ```
208
+
209
+ ### inspect
210
+
211
+ Inspect artifact metadata (pie, exe, AppImage) — target, runtime, dependencies, provenance.
212
+
213
+ ```bash
214
+ piebuild inspect app.pie
215
+ piebuild inspect app.exe
216
+ piebuild inspect app.AppDir
217
+ ```
218
+
219
+ ### validate
220
+
221
+ Validate artifact structure and provenance (VALID / VALID_WITH_WARNINGS / INVALID).
222
+
223
+ ```bash
224
+ piebuild validate app.pie
225
+ piebuild validate app.exe
226
+ piebuild validate app.AppImage
227
+ ```
228
+
229
+ ### backends
230
+
231
+ List available build backends.
232
+
233
+ ```bash
234
+ piebuild backends
235
+ ```
236
+
237
+ ## Bundle Format
238
+
239
+ PieBuild bundles are ZIP archives with the following structure:
240
+
241
+ ```
242
+ bundle.pie
243
+ ├── manifest.json # Bundle metadata
244
+ ├── launch.sh # Linux/macOS launcher
245
+ ├── launch.bat # Windows launcher
246
+ ├── source/ # Source files
247
+ │ └── app.py
248
+ └── bytecode/ # Compiled Python files
249
+ └── app.pyc
250
+ ```
251
+
252
+ ### Manifest Format
253
+
254
+ ```json
255
+ {
256
+ "app_name": "My App",
257
+ "version": "1.0.0",
258
+ "source": "/path/to/source.py",
259
+ "entry_point": "app.py",
260
+ "target_os": "native",
261
+ "target_arch": "native",
262
+ "build_mode": "native",
263
+ "analysis": {
264
+ "imports": ["sys", "os"],
265
+ "missing": []
266
+ },
267
+ "resources": [],
268
+ "bundle_name": "app"
269
+ }
270
+ ```
271
+
272
+ ## Development
273
+
274
+ ### Setup
275
+
276
+ ```bash
277
+ # Clone the repository
278
+ git clone https://github.com/ThatByteGuy/PieBuild.git
279
+ cd PieBuild
280
+
281
+ # Install development dependencies
282
+ pip install -e ".[dev]"
283
+
284
+ # Run tests
285
+ pytest tests/
286
+
287
+ # Run linting
288
+ ruff check piebuild/
289
+ black piebuild/
290
+ ```
291
+
292
+ ### Running Tests
293
+
294
+ ```bash
295
+ # Run all tests
296
+ pytest
297
+
298
+ # Run with coverage
299
+ pytest --cov=piebuild
300
+
301
+ # Run specific test file
302
+ pytest tests/test_core.py
303
+ ```
304
+
305
+ ### Contributing
306
+
307
+ 1. Fork the repository
308
+ 2. Create a feature branch
309
+ 3. Make your changes
310
+ 4. Add tests for new functionality
311
+ 5. Run the test suite
312
+ 6. Submit a pull request
313
+
314
+ ## License
315
+
316
+ This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
317
+
318
+ ## Roadmap
319
+
320
+ - [ ] Recipe system with pre-built templates
321
+ - [ ] Docker build backend
322
+ - [ ] Remote build execution
323
+ - [ ] GUI interface
324
+ - [ ] VSCode extension
325
+ - [ ] Marketplace for recipes and plugins
326
+ - [ ] Code signing integration
327
+ - [ ] Advanced security scanning
328
+ - [ ] Performance optimization
329
+ - [ ] Cross-platform packaging (AppImage, macOS app)
330
+
331
+ ## Support
332
+
333
+ - 📖 [Documentation](https://github.com/ThatByteGuy/PieBuild#readme)
334
+ - 🐛 [Issues](https://github.com/ThatByteGuy/PieBuild/issues)
335
+ - 💬 [Discussions](https://github.com/ThatByteGuy/PieBuild/discussions)
336
+ - 📧 [Email](mailto:12aa44edsta@gmail.com)
337
+ ## Release Workflow (Phase 11)
338
+
339
+ ### Checksums
340
+
341
+ Every distributable has a deterministic SHA-256 over final artifact bytes (`piebuild inspect` shows `SHA-256`). Use `piebuild release` to generate `SHA256SUMS` and `release.json` with stable ordering and normalized paths.
342
+
343
+ ### Signing
344
+
345
+ Local development signer uses Ed25519 via `cryptography` (optional `pip install piebuild[signing]`). Keys are stored outside bundles (`~/.cache/piebuild/signing-keys` or `PIEBUILD_SIGNING_KEY_DIR`), never inside `.pie`.
346
+
347
+ ```bash
348
+ piebuild sign app.pie --generate-key
349
+ piebuild sign app.pie
350
+ piebuild verify app.pie # ✓ Valid / ⚠ Valid with warnings / ❌ Invalid
351
+ ```
352
+
353
+ Tampered artifacts are detected via checksum mismatch before signature verification.
354
+
355
+ ### Release
356
+
357
+ ```bash
358
+ piebuild release app.py --output dist/
359
+ piebuild release app.py --output dist/ --sign
360
+ # generates: app.pie, app.pie.sig (if --sign), release.json, SHA256SUMS
361
+ ```
362
+
363
+ Release manifest (`release.json`) is deterministic JSON (sorted keys) describing app, version, artifacts, checksums, provenance, signing state. No absolute paths, usernames, or temp directories are embedded.
364
+
365
+ ### Verify
366
+
367
+ ```bash
368
+ piebuild verify app.pie
369
+ piebuild verify app.exe
370
+ piebuild verify MyApp.AppDir
371
+ ```
372
+
373
+ Exit codes: 0 valid (with or without warnings), 2 invalid. Warnings include unsigned artifacts for production.
374
+
375
+ ### Reproducibility
376
+
377
+ Deterministic portions with `SOURCE_DATE_EPOCH`:
378
+ - ZIP metadata (timestamps fixed to 2020-01-01 or SOURCE_DATE_EPOCH)
379
+ - File ordering (sorted)
380
+ - Manifest ordering (sorted keys)
381
+ - Launcher generation
382
+ - Bytecode now uses relative `dfile` to avoid absolute build-path leakage (fixed in Phase 11)
383
+
384
+ Non-reproducible boundaries:
385
+ - PE `.exe` via MinGW: PE header timestamp not normalized (byte variance)
386
+ - AppImage: requires external `appimagetool`/`mksquashfs` with squashfs timestamps
387
+ - `release.json` `built_at` is wall-clock (excluded for deterministic comparison)
388
+
389
+ ### Windows Signing
390
+
391
+ PieBuild generates legitimate PE via MinGW-w64 (`x86_64-w64-mingw32-gcc` + `windres`). This is **not** Authenticode signed. Authenticode is a separate future provider: `PE generation → PE validation → Authenticode provider → signed EXE`. We do not fake Authenticode.
392
+
393
+ ### Security Boundaries
394
+
395
+ - No `shell=True`, argument arrays only
396
+ - No private keys in bundles
397
+ - Path traversal/symlink checks in validation and format extraction
398
+ - No environment secrets leaked in provenance/attestation
399
+
400
+ ## Supported Targets (3.1.0 — True Cross, Honest Matrix)
401
+
402
+ | Target | Arch | Backend | Format | Status |
403
+ |--------|------|---------|--------|--------|
404
+ | Linux | x86_64 | native | .pie | ✅ verified (system+bundled) — system 37M, bundled uses host |
405
+ | Linux | x86_64 | docker | .pie | ✅ verified (linux containers) |
406
+ | Linux | x86_64 | native | AppDir | ✅ verified (AppImage needs appimagetool) |
407
+ | Windows | x86_64 | native+downloaded | .pie / .exe | ✅ verified **from Linux** — `runtime=bundled` fetches real Windows PE Python (`astral-sh/python-build-standalone`, HTTPS+SHA256), `runtime=system` cross via launcher warning; `.exe` is genuine PE (MinGW) with bundled `python.exe`+`Lib` |
408
+ | macOS | x86_64 | native+downloaded | .pie / .app | ✅ verified **from Linux** — `Mach-O x86_64` via downloaded |
409
+ | macOS | arm64 | native+downloaded | .pie / .app | ✅ verified **from Linux** — `Mach-O arm64` via downloaded |
410
+ | Linux | arm64 | native+downloaded | .pie | ✅ verified **from x86_64 Linux** — `ELF aarch64` via downloaded |
411
+ | Linux musl | x86_64 | downloaded | .pie | ✅ `x86_64-unknown-linux-musl` via downloaded (glibc vs musl recorded) |
412
+ | Remote | any | remote | any | Future — requires `PIEBUILD_REMOTE_ENDPOINT` |
413
+
414
+ - `piebuild formats` shows toolchain + bundled-runtime availability (`downloaded` for cross); `piebuild backends`/`runtimes` report target-native cache (`~/.cache/piebuild/runtimes`, validated, corrupt discarded).
415
+ - `piebuild runtimes` shows `host_libc` (glibc/musl) and downloaded target runtimes (`windows/x86_64`, `macos/x86_64+arm64`, `linux/aarch64`).
416
+ - Cross `runtime=bundled` **never** silently falls back to `system`; fails with actionable `Downloaded provider` hint if unavailable.
417
+ - Examples:
418
+ ```bash
419
+ piebuild bake app.py --target linux --runtime bundled # host-native
420
+ piebuild bake app.py --target windows --runtime bundled --format exe # Linux → Windows PE (real python.exe, no Wine)
421
+ piebuild bake app.py --target macos --arch x86_64 --runtime bundled --format app # Linux → macOS Intel
422
+ piebuild bake app.py --target macos --arch arm64 --runtime bundled # Linux → macOS Apple Silicon
423
+ piebuild bake app.py --target linux --arch arm64 --runtime bundled # Linux x86_64 → Linux aarch64
424
+ piebuild bake app.py --target windows --runtime system # cross without bundled (needs target Python)
425
+ ```