pycrucible 0.3.9__py3-none-win_amd64.whl → 0.4.1__py3-none-win_amd64.whl

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.
@@ -0,0 +1,494 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycrucible
3
+ Version: 0.4.1
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Rust
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Topic :: Software Development :: Build Tools
10
+ License-File: LICENSE
11
+ Summary: Python wrapper for the PyCrucible CLI tool
12
+ Keywords: install,python installer,install python,python packaging,python build tool,pycrucible,pyinstaller,py2exe,python wrapper,python cli tool
13
+ Author-email: razorblade23 <contact@razorblade23.dev>
14
+ License: MIT
15
+ Requires-Python: >=3.6
16
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
+ Project-URL: Homepage, https://github.com/razorblade23/PyCrucible
18
+ Project-URL: Issues, https://github.com/razorblade23/PyCrucible/issues
19
+ Project-URL: Repository, https://github.com/razorblade23/PyCrucible.git
20
+
21
+ ![Poster image of PyCrucible](/assets/PyCrucible_poster.png)
22
+
23
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/pycrucible?style=for-the-badge&label=PyPi%20downloads&cacheSeconds=86400)
24
+ ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/razorblade23/pycrucible/total?style=for-the-badge&label=Github%20downloads&cacheSeconds=86400)
25
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/razorblade23/pycrucible/v0.3-pipeline.yml?style=for-the-badge&label=CI%2FCD&cacheSeconds=3600)
26
+ ![PyPI - License](https://img.shields.io/pypi/l/pycrucible?style=for-the-badge&cacheSeconds=864000)
27
+ ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/t/razorblade23/pycrucible/main?style=for-the-badge&cacheSeconds=3600)
28
+
29
+ ## Sections
30
+ - [What is PyCrucible?](#what-is-pycrucible)
31
+ - [Quickstart](#quickstart)
32
+ - [Installation](#how-to-install-pycrucible)
33
+ - [Usage](#how-to-use-pycrucible)
34
+ - [Runtime Configuration](#pycrucible-configuration)
35
+ - [Embedding Options](#more-pycrucible-options)
36
+ - [Github Action](#github-action)
37
+ - [Security](#security--code-signing)
38
+ - [How it works](#how-pycrucible-works---a-diagram)
39
+ - [Features](#features)
40
+ - [Community](#community)
41
+ - [Changelog](#changelog)
42
+ - [Thanks to](#thanks-to)
43
+
44
+ ## What is PyCrucible?
45
+ PyCrucible packages any Python project into a single **cross-platform** executable with **minimal overhead**, powered by *Rust and uv*.
46
+
47
+ Existing tools like `PyInstaller` bundle the entire Python interpreter, dependencies, and project files. This typically results in:
48
+ - large binaries
49
+ - slow builds
50
+ - dependency complexity
51
+ - fragile runtime environments
52
+
53
+ #### PyCrucible is diffrent
54
+ - Fast and robust — written in Rust
55
+ - Multi-platform — Windows, Linux, macOS
56
+ - Tiny executables — ~2MB + your project files (if using `--no-uv-embed` flag [added: *v0.4.0*])
57
+ - Support for `*.whl` embedding [added: *v0.4.0*]
58
+ - Hassle-free dependency resolution — delegated to uv
59
+ - Simple but configurable
60
+ - Supports auto-updates (GitHub public repos)
61
+ - Includes a GitHub Action for CI automation
62
+
63
+ > [!NOTE]
64
+ > On the first run, PyCrucible downloads project dependencies through uv.
65
+ >
66
+ > Subsequent runs start instantly.
67
+
68
+ ## Quickstart
69
+ If you dont want to read the specifics, jump right in. Its easy to use:
70
+ ```bash
71
+ pip install pycrucible
72
+ pycrucible -e . -o ./myapp
73
+ ```
74
+
75
+ ## How to install `PyCrucible`
76
+ There are a couple of ways to install PyCrucible.
77
+ - using `PyPi`
78
+ - downloading from Github Releases
79
+ - compiling source code
80
+
81
+ ### Using `PyPi`
82
+ PyCrucible is published to `PyPi` for every release. All you need to do is:
83
+ ```bash
84
+ pip install pycrucible
85
+ ```
86
+
87
+ > [!TIP]
88
+ > You can also use `pipx`, `uv` or `uvx` to download and install PyCrucible from `PyPi`.
89
+
90
+ > [!NOTE]
91
+ > PyCrucible on `PyPi` is compiled with `glibc==2.28` making sure its compatible with older operating systems.
92
+
93
+ ### Using `Github Releases`
94
+ You can download pre-made binaries for your system from
95
+
96
+ [Github Releases](https://github.com/razorblade23/PyCrucible/releases/latest)
97
+
98
+ ### Downloading and building from source code
99
+ 1. Ensure you have [Rust](https://www.rust-lang.org/) installed.
100
+
101
+ 2. Clone the repository
102
+ - ```git clone https://github.com/razorblade23/PyCrucible```
103
+
104
+ 3. Change directory to be inside of a project
105
+ - ```cd PyCrucible```
106
+
107
+ 4. Build Runner
108
+ - ```cargo build -p pycrucible_runner --release```
109
+
110
+ 5. Build Pycrucible
111
+ - ```cargo build -p pycrucible --release```
112
+
113
+ > [!NOTE]
114
+ > The resulting binary will be in `target/release/pycrucible`.
115
+
116
+ ## How to use `PyCrucible`
117
+ All you need for starting is a single `main.py` file with some code.
118
+ #### Documentation
119
+ Documentation can be found at [PyCrucible docs](https://pycrucible.razorblade23.dev).
120
+
121
+ #### Example project
122
+ This is our example project.
123
+
124
+ ```python
125
+ def main():
126
+ print("Hello from PyCrucible binary")
127
+
128
+ if __name__ == "__main__":
129
+ main()
130
+ ```
131
+ > [!IMPORTANT]
132
+ > PyCrucible defaults to `src/main.py` so that is how you should save your file, but you can override this with **entrypoint** configuration.
133
+
134
+ > [!TIP]
135
+ > It would also be nice if you had `pyproject.toml` file, but this is not a requirement. If you do use configuration file, setting **entrypoint** directive is required.
136
+ >
137
+ > Example `pyproject.toml`
138
+ > ```toml
139
+ > [project]
140
+ > name = "pycrucible-example"
141
+ > version = "0.1.0"
142
+ > description = "Simple example in using PyCrucible"
143
+ > requires-python = ">=3.12"
144
+ > dependencies = []
145
+ >
146
+ > [tool.pycrucible]
147
+ > entrypoint = "main.py"
148
+ > ```
149
+
150
+ Now that we have our ingredients, lets make a binary using PyCrucible.
151
+ ```bash
152
+ $ pycrucible -e .
153
+ ```
154
+
155
+ This will embed your project and produce a new binary which is by default called `launcher` (or `launcher.exe` on Windows).
156
+
157
+ > [!TIP]
158
+ > To configure the output path and name of your binary, use `-o` or `--output` flag.
159
+ >
160
+ > Example: `pycrucible -e . -o ./myapp` (or `pycrucible -e . -o ./myapp.exe`)
161
+
162
+ This is now **all you need** to distribute your python project to other people.
163
+ **No python required on their end. Just this single binary.**
164
+
165
+ ## It does not have to be a .py script
166
+ In web apps it is common to run some server that will handle your requests. In PyCrucible, `entrypoint`, `pre-run` or `post-run` do not need to be .py scripts.
167
+
168
+ You can use anything from your dependacies as a starting point. For example, you could run your flask application like this:
169
+ ```toml
170
+ # pyproject.toml
171
+ ...
172
+
173
+ [tool.pycrucible]
174
+ entrypoint = "gunicorn --port 9000 --host '0.0.0.0' app.app"
175
+ ```
176
+ Everything that you pass as `entrypoint`, `pre-run` or `post-run` will be used just like you would run those commands within your enviroment.
177
+
178
+ ## PyCrucible configuration
179
+ Configuration can be set in any of these files:
180
+ - `pycrucible.toml`
181
+ - `pyproject.toml`
182
+
183
+ > [!IMPORTANT]
184
+ > When using any configuration option, only `entrypoint` (or `entry`) is required. Other options are optional.
185
+
186
+ Supported configuration options are:
187
+ - entrypoint (entry) - The main file your application must run. Usually `main.py` or `app.py`.
188
+ - options
189
+ - debug - Enable debug output during runtime of binary. Used for debugging.
190
+ - extract_to_temp - Extract the project files to temporary directory instead of directory next to binary.
191
+ - delete_after_run - Delete source files after running.
192
+ - patterns
193
+ - include - What files to include into your final binary.
194
+ - exclude - What files to exclude from your final binary.
195
+ - env - key-value pairs of enviroment variables that will be set before running your binary.
196
+ - hooks
197
+ - pre-run - Run this script before running main application. Useful for pre-loading of data. Must be Python script.
198
+ - post-run - Run this script after running main application. Useful for unloading of data. Must be Python script.
199
+
200
+ > [!NOTE]
201
+ > When both `pycrucible.toml` and `pyproject.toml` are discovered, configuration from `pycrucible.toml` will take effect.
202
+
203
+ **Both of these files have exact same configuration options**
204
+
205
+ You can find **example configuration file for `pycrucible.toml`** [here](pycrucible.example.toml)
206
+
207
+ Only diffrence between these files is that **`pyproject.toml`** requires you to **prefix** pycrucible configuration with **`tool.pycrucible<.section>`**.
208
+
209
+ For example, if setting **entrypoint**
210
+ ```toml
211
+ # pycrucible.toml
212
+ entrypoint = "src/main.py"
213
+ # or
214
+ entry = "src/main.py"
215
+
216
+ # pyproject.toml
217
+ [tool.pycrucible]
218
+ entrypoint = "src/main.py"
219
+ # or
220
+ entry = "src/main.py"
221
+ ```
222
+
223
+ If setting **options**
224
+ ```toml
225
+ # pycrucible.toml
226
+ [options]
227
+ debug = false
228
+ extract_to_temp = false
229
+ delete_after_run = false
230
+ uv_version = 0.9.21
231
+
232
+ # pyproject.toml
233
+ [tool.pycrucible.options]
234
+ debug = false
235
+ extract_to_temp = false
236
+ delete_after_run = false
237
+ uv_version = 0.9.21
238
+ ```
239
+
240
+ Full configuration options can be seen here:
241
+ <details>
242
+ <summary>pycrucible.toml</summary>
243
+
244
+ ```toml
245
+ entrypoint = "src/main.py"
246
+ # or
247
+ entry = "src/main.py"
248
+
249
+ [options]
250
+ debug = false
251
+ extract_to_temp = false
252
+ delete_after_run = false
253
+ uv_version = 0.9.21
254
+
255
+ [patterns]
256
+ include = [
257
+ "**/*.py",
258
+ ]
259
+ exclude = [
260
+ "**/__pycache__/**",
261
+ ]
262
+
263
+ [env]
264
+ FOO = "foo"
265
+ BAR = "bar"
266
+
267
+ [hooks]
268
+ pre_run = "some_script.py"
269
+ post_run = "some_other_script.py"
270
+ ```
271
+ </details>
272
+
273
+ <details>
274
+ <summary>pyproject.toml</summary>
275
+
276
+ ```toml
277
+ [tool.pycrucible]
278
+ entrypoint = "src/main.py"
279
+ # or
280
+ entry = "src/main.py"
281
+
282
+ [tool.pycrucible.options]
283
+ debug = false
284
+ extract_to_temp = false
285
+ delete_after_run = false
286
+ uv_version = 0.9.21
287
+
288
+ [tool.pycrucible.patterns]
289
+ include = [
290
+ "**/*.py",
291
+ ]
292
+ exclude = [
293
+ "**/__pycache__/**",
294
+ ]
295
+
296
+ [tool.pycrucible.env]
297
+ FOO = "foo"
298
+ BAR = "bar"
299
+
300
+ [tool.pycrucible.hooks]
301
+ pre_run = "some_script.py"
302
+ post_run = "some_other_script.py"
303
+ ```
304
+ </details>
305
+
306
+ > [!TIP]
307
+ > You can use `patterns` to include or exclude any arbitrary files, like HTML templates, Kivy layout files or any other arbitrary files needed by your application.
308
+ > For example your flask templates:
309
+ > ```toml
310
+ > [tool.pycrucible]
311
+ > entrypoint = "app.py"
312
+ >
313
+ > [tool.pycrucible.patterns]
314
+ > include = [
315
+ > "**/*.py",
316
+ > "src/templates/*.html",
317
+ > "src/static/*.css",
318
+ > "src/static/*.js",
319
+ > ]
320
+ > exclude = [
321
+ > "**/__pycache__/**",
322
+ > ]
323
+ > ```
324
+
325
+ > [!WARNING]
326
+ > There is no need for setting `PYTHONPATH` env variable as `uv` will take care of this. If this is really needed, `uv` will complain and you should also also set `UV_LINK_MODE="copy"` as env variable to mitigate the warning.
327
+
328
+ <details>
329
+ <summary>Default configuration</summary>
330
+ This configuration takes place when no configuration is set by the user.
331
+
332
+ ```python
333
+ entrypoint = "src/main.py"
334
+
335
+ # Options
336
+ debug = false # Enable debug output in runner
337
+ extract_to_temp = false # Extract contents into temporary directory
338
+ delete_after_run = false # Delete contents after running the program
339
+ uv_version = "0.9.21" # Select uv version
340
+
341
+ # Patterns
342
+ patterns.include = [
343
+ "**/*.py",
344
+ ]
345
+ patterns.exclude = [
346
+ ".venv/**/*",
347
+ "**/__pycache__/**",
348
+ ".git/**/*",
349
+ "**/*.pyc",
350
+ "**/*.pyo",
351
+ "**/*.pyd"
352
+ ]
353
+
354
+ # Source repository (GitHub)
355
+ source = None
356
+
357
+ # Enviroment variables
358
+ env = None
359
+
360
+ # Pre and post run hooks
361
+ hooks = None
362
+
363
+ ```
364
+ </details>
365
+
366
+ If any of these configuration options is not used, it will be replaced with default value.
367
+ #### NOTE - `entrypoint` directive is required when using any configuration options.
368
+
369
+ > [!TIP]
370
+ > As of `v0.4.0` *PyCrucible* supports embedding of `.whl` files. Just give PyCrucible your wheel file instead of source directory and it will take care of the rest.
371
+
372
+ ## More PyCrucible options
373
+ Running `pycrucible --help` reveals more options:
374
+ ```bash
375
+ $ pycrucible --help
376
+ Tool to generate python executable by melding UV and python source code in crucible of one binary
377
+
378
+ Usage: pycrucible [OPTIONS]
379
+
380
+ Options:
381
+ -e, --embed <SOURCE_DIR> Directory containing Python project to embed.
382
+ -o, --output <OUTPUT> Output path for the new binary. If not specified, defaults to `./launcher`.
383
+ --uv-path <UV_PATH> Path to `uv` executable. If not found, it will be downloaded automatically [default: .]
384
+ --no-uv-embed Disable embedding `uv` binary into the output executable. This will require `uv` to be present alongside (or downloaded) the output binary at runtime.
385
+ --extract-to-temp [`wheel` mode only] Extracts the embedded files to a temporary directory instead of a permanent one at runtime. The temporary directory will be deleted when the program exits.
386
+ --delete-after-run [`wheel` mode only] Deletes the extracted files after the program finishes running. Ignored if `--extract-to-temp` is used.
387
+ --force-uv-download Force re-download of `uv` binary even if it is already present at the specified or default location. Mostly useful for testing purposes.
388
+ --debug Enable debug output
389
+ -h, --help Print help
390
+ -V, --version Print version
391
+ ```
392
+
393
+ ## Github Action
394
+ PyCrucible has associated GitHub Action workflow which you can use to embed your python applications directly in CI.
395
+
396
+ [GitHub Action marketplace](https://github.com/marketplace/actions/build-python-app-with-pycrucible)
397
+
398
+ [GitHub Repository](https://github.com/razorblade23/pycrucible-action)
399
+
400
+ ## Security / Code signing
401
+ > [!WARNING]
402
+ > This is an embedding tool. Like any other tool of this type, it may be used in distribution of un-trusted and/or malicius software.
403
+
404
+ The `builder` is the only distributed artifact; the Python projects themselves are provided by developers and has nothing to do with pycrucible or its authors or maintainers. Its is the sole responsibility of the developer and its end-users to confirm authenticity and trust in executing the binary.
405
+
406
+ Developers, when distributing binary to your end users, please:
407
+ - Verify your build environment is clean
408
+ - Sign binaries if distributing to external users (after embedding your project)
409
+ - Test your output on a clean VM for each platform
410
+ - Pin dependencies
411
+ - Set reproducible flags
412
+
413
+ > [!IMPORTANT]
414
+ > Make sure you run code signing **after** embedding your project. This makes sure that embedded project also be part of the signiture.
415
+
416
+ ## How PyCrucible works - a diagram
417
+ ```mermaid
418
+ flowchart TD
419
+ %% Build Phase
420
+ A[PyCrucible CLI Builder] --> B[Is input a .whl file?]
421
+
422
+ B --> C[Embed wheel as-is]
423
+ B --> D[Archive project files]
424
+
425
+ C --> E[Payload Ready]
426
+ D --> E[Payload Ready]
427
+
428
+ E --> F[Embed uv runtime?]
429
+
430
+ F --> G[Embed uv]
431
+ F --> H[Do not embed uv]
432
+
433
+ G --> I[Build launcher binary]
434
+ H --> I[Build launcher binary]
435
+
436
+ %% Runtime Phase
437
+ I --> J[User runs launcher]
438
+ J --> K[Extract payload]
439
+ K --> L[Is uv embedded?]
440
+
441
+ L --> M[Use embedded uv]
442
+ L --> N[Locate or download uv]
443
+
444
+ M --> O[Run with uv]
445
+ N --> O[Run with uv]
446
+
447
+ O --> P[Run project entrypoint]
448
+ O --> Q[Run wheel file]
449
+ ```
450
+
451
+ ## Features
452
+ - **Cross-Platform**:
453
+ - [x] Windows support
454
+ - [x] macOS support (testing)
455
+ - [x] Linux support
456
+ - **Small overhead**:
457
+ - [x] Runner binary that embeds your project is **just ~2 MB**. This ofcourse grows with embedding `uv` and your project.
458
+ - **Configurable**:
459
+ - [ ] Use `pycrucible.toml` or `pyproject.toml` to customize embedding details
460
+ - [x] entrypoint
461
+ - [x] include/exlude files
462
+ - [x] arguments to `uv`
463
+ - [x] env variables
464
+ - [x] update source code from github
465
+ - [x] pre and post run hooks (python scripts)
466
+ - [x] extract to temporary directory (removes temporary directory after running automaticly)
467
+ - [x] remove extracted files after running
468
+ - [x] Support for multiple ways of defining requirements
469
+ - [x] `uv` initialized `pyproject.toml` (This is preffered !)
470
+ - [x] `requirements.txt`
471
+ - [x] `pylock.toml`
472
+ - [x] `setup.py`
473
+ - [x] `setup.cfg`
474
+ - [x] Load the project as a directory
475
+ - [x] Runtime arguments are supported
476
+ - **Tests**:
477
+ - [x] Unit tests covering as much as i can make it
478
+
479
+ ## Community
480
+ We have an active community on Telegram, you are free to join us.
481
+
482
+ [PyCrucible Telegram Community](https://t.me/PyCrucibleCommunity)
483
+
484
+ ## Changelog
485
+ You can see latest changes at
486
+
487
+ [CHANGELOG FILE](https://github.com/razorblade23/PyCrucible/blob/main/CHANGELOG.md)
488
+
489
+ ## Thanks to
490
+ The idea is inspired by [Packaged](https://packaged.live/).
491
+
492
+ Thanks to all the briliant developers at `Astral`.
493
+ They did awesome job with [uv](https://astral.sh/blog/uv).
494
+
@@ -0,0 +1,5 @@
1
+ pycrucible-0.4.1.data\scripts\pycrucible.exe,sha256=2GkjbU1K3xBZUuXy7i0sV5jM23bFhfMqDAJy3fzVmEY,6573056
2
+ pycrucible-0.4.1.dist-info\METADATA,sha256=mKjCJU5Oq_HvVkGU1ygqaRNjFG-ZwC9529D9Oc1Zb5Q,16689
3
+ pycrucible-0.4.1.dist-info\WHEEL,sha256=jsSEiVNsW1dJj5gDaReR40i7mhgBjWtms6nAD6EViXU,94
4
+ pycrucible-0.4.1.dist-info\licenses\LICENSE,sha256=1mKlWQzjtJbLuK-6mzMhwomUm2wTeOPVMBZUGYp4tSE,966
5
+ pycrucible-0.4.1.dist-info\RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.10.1)
2
+ Generator: maturin (1.11.5)
3
3
  Root-Is-Purelib: false
4
4
  Tag: py3-none-win_amd64
@@ -1,304 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pycrucible
3
- Version: 0.3.9
4
- Classifier: Programming Language :: Python :: 3
5
- Classifier: Programming Language :: Rust
6
- Classifier: License :: OSI Approved :: MIT License
7
- Classifier: Operating System :: OS Independent
8
- Classifier: Intended Audience :: Developers
9
- Classifier: Topic :: Software Development :: Build Tools
10
- License-File: LICENSE
11
- Summary: Python wrapper for the PyCrucible CLI tool
12
- Keywords: install,python installer,install python,python packaging,python build tool,pycrucible,pyinstaller,py2exe,python wrapper,python cli tool
13
- Author-email: razorblade23 <contact@razorblade23.dev>
14
- License: MIT
15
- Requires-Python: >=3.6
16
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
- Project-URL: Homepage, https://github.com/razorblade23/PyCrucible
18
- Project-URL: Repository, https://github.com/razorblade23/PyCrucible.git
19
- Project-URL: Issues, https://github.com/razorblade23/PyCrucible/issues
20
-
21
- ![Poster image of PyCrucible](/assets/PyCrucible_poster.png)
22
-
23
- ## Overview
24
- This tool runs a Python application using the UV binary. It extracts your application, optionally reads configuration from pycrucible.toml or pyproject.toml, and uses uv to execute it in an ephemeral environment.
25
-
26
- ## What does this mean?
27
- You get a single self-contained binary that can be distributed across machines running the same platform. No Python installation is required - just an internet connection. Run the executable, and it takes care of the rest.
28
-
29
- ## Community
30
- You can visit our community group on Telegram
31
- [PyCrucible Telegram Community](https://t.me/PyCrucibleCommunity)
32
-
33
- ## Changelog
34
- You can see latest changes at [CHANGELOG FILE](https://github.com/razorblade23/PyCrucible/blob/main/CHANGELOG.md).
35
-
36
- ## Github Action
37
- PyCrucible has associated GitHub Action workflow which you can use to embed your python applications directly in CI.
38
- [GitHub Action marketplace](https://github.com/marketplace/actions/build-python-app-with-pycrucible).
39
- [GitHub Repository](https://github.com/razorblade23/pycrucible-action)
40
-
41
- ## Documentation
42
- Documentation can be found at [PyCrucible docs](https://pycrucible.razorblade23.dev).
43
-
44
- ## How to get `PyCrucible`
45
- There are a couple of ways to get PyCrucible.
46
-
47
- ### Using `PyPI`
48
- PyCrucible is published to `PyPI` for every release. All you need to do is:
49
- ```bash
50
- pip install pycrucible
51
- ```
52
-
53
- ### Using `Github Releases`
54
- You can download pre-made binaries for your system from [Github Releases](https://github.com/razorblade23/PyCrucible/releases/latest) page
55
-
56
- ### Downloading and building from source code
57
- 1. Ensure you have [Rust](https://www.rust-lang.org/) installed.
58
-
59
- 2. Clone the repository
60
- ```git clone https://github.com/razorblade23/PyCrucible```
61
-
62
- 3. Change directory to be inside of a project
63
- ```cd PyCrucible```
64
-
65
- 4. Build Runner
66
- ```cargo build -p pycrucible_runner --release```
67
-
68
- 5. Build Pycrucible
69
- ```cargo build -p pycrucible --release```
70
-
71
- > [!NOTE]
72
- > The resulting binary will be in `target/release/pycrucible`.
73
-
74
- ## How to use `PyCrucible`
75
- All you need for starting is a single `main.py` file with some code.
76
-
77
- If you installed it using `pip` you can just run it with:
78
- ```bash
79
- pycrucible -e .
80
- ```
81
-
82
- This will embed your project and produce a new binary which is by default called `launcher` (or `launcher.exe` on Windows).
83
- > [!TIP]
84
- > To configure the output path and name of your binary, use `-o` or `--output` flag.
85
- >
86
- > Example: `pycrucible -e . -o ./myapp` (or `pycrucible -e . -o ./myapp.exe`)
87
-
88
- > [!TIP]
89
- > You can also use `pipx` or `uvx` to run the tool without installing it to your venv.
90
- >
91
- > Example with `pipx`: `pipx pycrucible -e .` | Example with `uvx`: `uvx pycrucible -e .`
92
-
93
- This is now **all you need** to distribute your python project to other people.
94
-
95
- **No python required on their end. Just this single binary.**
96
-
97
- > [!NOTE]
98
- > PyCrucible supports runtime arguments as of `v0.3.1`.
99
-
100
- Running `pycrucible --help` reveals more options:
101
- ```bash
102
- $ pycrucible --help
103
- Tool to generate python executable by melding UV and python source code in crucible of one binary
104
-
105
- Usage: pycrucible [OPTIONS]
106
-
107
- Options:
108
- -e, --embed <EMBED>
109
- Directory containing Python project to embed. When specified, creates a new binary with the embedded project
110
- -o, --output <OUTPUT>
111
- Output path for the new binary when using --embed
112
- --uv-path <UV_PATH>
113
- Path to `uv` executable. If not found, it will be downloaded automatically [default: `.`]
114
- --debug
115
- Enable debug output
116
- -h, --help
117
- Print help
118
- -V, --version
119
- Print version
120
- ```
121
-
122
-
123
- ## How to configure `PyCrucible`
124
- Configuration can be set in two files:
125
- - `pycrucible.toml`
126
- - `pyproject.toml`
127
-
128
- > [!NOTE]
129
- > When both `pycrucible.toml` and `pyproject.toml` are discovered, configuration from `pycrucible.toml` will take effect.
130
-
131
- > [!IMPORTANT]
132
- > When using any configuration, only `entrypoint` is required. Other options are optional.
133
-
134
- > [!TIP]
135
- > In both `pycrucible.toml` and `pyproject.toml` directive `entrypoint` can also be replaced by just `entry`.
136
-
137
- Both of these files have exact same configuration options. You can find example file for `pycrucible.toml` [here](https://raw.githubusercontent.com/razorblade23/PyCrucible/refs/heads/main/pycrucible.toml.example)
138
-
139
- In `pycrucible.toml` you would define configuration like this:
140
- ```toml
141
- entrypoint = "src/main.py"
142
- # or
143
- entry = "src/main.py"
144
-
145
- [options]
146
- debug = false
147
- extract_to_temp = false
148
- delete_after_run = false
149
-
150
- [patterns]
151
- include = [
152
- "**/*.py",
153
- ]
154
- exclude = [
155
- "**/__pycache__/**",
156
- ]
157
-
158
- [env]
159
- FOO = "foo"
160
- BAR = "bar"
161
-
162
- [hooks]
163
- pre_run = "some_script.py"
164
- post_run = "some_other_script.py"
165
- ```
166
-
167
- In `pyproject.toml` you would define configuration like this:
168
- ```toml
169
- [tool.pycrucible]
170
- entrypoint = "src/main.py"
171
- # or
172
- entry = "src/main.py"
173
-
174
- [tool.pycrucible.options]
175
- debug = false
176
- extract_to_temp = false
177
- delete_after_run = false
178
- offline_mode = false
179
-
180
- [tool.pycrucible.patterns]
181
- include = [
182
- "**/*.py",
183
- ]
184
- exclude = [
185
- "**/__pycache__/**",
186
- ]
187
-
188
- [tool.pycrucible.env]
189
- FOO = "foo"
190
- BAR = "bar"
191
-
192
- [tool.pycrucible.hooks]
193
- pre_run = "some_script.py"
194
- post_run = "some_other_script.py"
195
- ```
196
-
197
- > [!TIP]
198
- > You can use `patterns` to include or exclude any arbitrary files, like HTML templates, Kivy layout files or any other arbitrary files needed for your application.
199
-
200
- > [!IMPORTANT]
201
- > There is no need for setting `PYTHONPATH` env variable as `uv` will take care of this. If this is really needed, `uv` will complain and you should also also set `UV_LINK_MODE="copy"` as env variable to mitigate the warning.
202
-
203
- ### Update your project from GitHub
204
- In configuration file its possible to set your GitHub repository, so the resulting binary will always check for update before running the application.
205
-
206
- In `pycrucible.toml` it would look like this:
207
- ```toml
208
- [source]
209
- repository = "https://github.com/username/repo"
210
- branch = "main"
211
- update_strategy = "pull"
212
- ```
213
-
214
-
215
- In `pyproject.toml` it would look like this-
216
- ```toml
217
- [tool.pycrucible.source]
218
- repository = "https://github.com/username/repo"
219
- branch = "main"
220
- update_strategy = "pull"
221
- ```
222
-
223
- #### Default configuration
224
- ```python
225
- entrypoint = "main.py"
226
-
227
- # Options
228
- debug = false
229
- extract_to_temp = false
230
- delete_after_run = false
231
-
232
- # Patterns
233
- patterns.include = [
234
- "**/*.py",
235
- ]
236
- patterns.exclude = [
237
- ".venv/**/*",
238
- "**/__pycache__/**",
239
- ".git/**/*",
240
- "**/*.pyc",
241
- "**/*.pyo",
242
- "**/*.pyd"
243
- ]
244
-
245
- # Source repository (GitHub)
246
- source = None
247
-
248
- # Enviroment variables
249
- env = None
250
-
251
- # Pre and post run hooks
252
- hooks = None
253
- ```
254
- If any of these configuration options is not used, it will be replaced with default value.
255
- #### NOTE - `entrypoint` directive is required when using any configuration options.
256
-
257
- ## Security / Code signing
258
- For users who want to verify the authenticity of the `builder` binary, we recommend code signing. This ensures that the binary you download has not been tampered with.
259
- Code signing will be automatic in next release of `PyCrucible`.
260
-
261
-
262
- The `builder` is the only distributed artifact; the Python projects themselves are provided by users at runtime.
263
-
264
- Signing the builder ensures the binary is authentic.
265
-
266
- Generated self-contained binaries (created by the builder) are not pre-signed — users may optionally sign them for their own distribution.
267
-
268
- > [!IMPORTANT]
269
- > Make sure you run code signing **after** embedding your project. This makes sure that embedded project also be part of the signiture.
270
-
271
- ## Features
272
- - **Cross-Platform**:
273
- - [x] Windows support
274
- - [x] macOS support (testing)
275
- - [x] Linux support
276
- - **Small overhead**:
277
- - [x] Runner binary that embeds your project is **just 2 MB**. This ofcourse grows with embedding `uv` and your project.
278
- - **Configurable**:
279
- - [ ] Use `pycrucible.toml` or `pyproject.toml` to customize embedding details
280
- - [x] entrypoint
281
- - [x] include/exlude files
282
- - [x] arguments to `uv`
283
- - [x] env variables
284
- - [x] update source code from github
285
- - [x] pre and post run hooks (python scripts)
286
- - [ ] offline mode
287
- - [x] extract to temporary directory (removes temporary directory after running automaticly)
288
- - [x] remove extracted files after running
289
- - [x] Support for multiple ways of defining requirements
290
- - [x] `uv` initialized `pyproject.toml` (This is preffered !)
291
- - [x] `requirements.txt`
292
- - [x] `pylock.toml`
293
- - [x] `setup.py`
294
- - [x] `setup.cfg`
295
- - [x] Load the project as a directory
296
- - **Tests**:
297
- - [x] Unit tests covering as much as i can make it
298
-
299
- ## Thanks to
300
- The idea is inspired by [Packaged](https://packaged.live/).
301
-
302
- Thanks to all the briliant developers at `Astral`.
303
- They did awesome job with [uv](https://astral.sh/blog/uv).
304
-
@@ -1,5 +0,0 @@
1
- pycrucible-0.3.9.data/scripts/pycrucible.exe,sha256=610pH72uzgAoYfWH79gWd0dCCwWxSTwTSXyMSTwAAJA,5130240
2
- pycrucible-0.3.9.dist-info/METADATA,sha256=_miqyIks6rlL9RRHBy4uZbt1WiwlLLTenGPGRYIWc48,9962
3
- pycrucible-0.3.9.dist-info/WHEEL,sha256=nq3lkKW9_ylFdpeg5sUax_PDiAfrieKzAXES02b7P68,94
4
- pycrucible-0.3.9.dist-info/licenses/LICENSE,sha256=1mKlWQzjtJbLuK-6mzMhwomUm2wTeOPVMBZUGYp4tSE,966
5
- pycrucible-0.3.9.dist-info/RECORD,,