pycrucible 0.2.7__py3-none-any.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.
pycrucible/__init__.py ADDED
File without changes
pycrucible/__main__.py ADDED
@@ -0,0 +1,9 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ def main():
7
+ bin_path = Path(__file__).parent / "pycrucible-bin"
8
+ result = subprocess.run([str(bin_path)] + sys.argv[1:], check=False)
9
+ sys.exit(result.returncode)
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycrucible
3
+ Version: 0.2.7
4
+ Summary: Python wrapper for the PyCrucible CLI tool
5
+ Author-email: razorblade23 <contact@razorblade23.dev>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Rust
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Requires-Python: >=3.6
14
+ Description-Content-Type: text/markdown
15
+
16
+ # PyCrucible
17
+ #### "Run Python Apps Instantly, No Setup Required."
18
+
19
+ A robust, cross-platform builder and launcher for Python apps using UV.
20
+
21
+ ## Overview
22
+
23
+ This tool runs a Python application with a help of UV binary. It extracts your package (ZIP or directory), loads an optional configuration from `pycrucible.toml`, and uses `uv` to run your app in an ephemeral environment.
24
+
25
+ ## Installation
26
+ You can install pycrucible with the usual:
27
+ ```bash
28
+ pip install pycrucible
29
+ ```
30
+
31
+
32
+ ## PyCrucible configuration
33
+ A directory with a single `.py` file is all you need to start.
34
+ There are however multiple configuration options to suit your specific needs.
35
+
36
+ ##### Note - when using any configuration, only `entrypoint` is required. Other options are optional.
37
+
38
+ Configuration can be set in two ways:
39
+ - `pycrucible.toml`
40
+ - `pyproject.toml`
41
+
42
+ 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)
43
+
44
+ ### Diffrence between configuration options
45
+ ##### Note - In both `pycrucible.toml` and `pyproject.toml` directive `entrypoint` can also be replaced by just `entry`.
46
+
47
+
48
+ In `pycrucible.toml` you would define configuration like this:
49
+ ```toml
50
+ entrypoint = "src/main.py"
51
+ # or
52
+ entry = "src/main.py"
53
+
54
+ [package.patterns]
55
+ include = [
56
+ "**/*.py",
57
+ ]
58
+ exclude = [
59
+ "**/__pycache__/**",
60
+ ]
61
+
62
+ [hooks]
63
+ pre_run = "some_script.py"
64
+ post_run = "some_other_script.py"
65
+ ```
66
+
67
+
68
+ In `pyproject.toml` you would define configuration like this:
69
+ ```toml
70
+ [tool.pycrucible]
71
+ entrypoint = "src/main.py"
72
+ # or
73
+ entry = "src/main.py"
74
+
75
+ [tool.pycrucible.patterns]
76
+ include = [
77
+ "**/*.py",
78
+ ]
79
+ exclude = [
80
+ "**/__pycache__/**",
81
+ ]
82
+
83
+ [tool.pycrucible.hooks]
84
+ pre_run = "some_script.py"
85
+ post_run = "some_other_script.py"
86
+ ```
87
+
88
+ #### Default configuration
89
+ ```rust
90
+ ProjectConfig {
91
+ package: PackageConfig {
92
+ entrypoint: "main.py".into(),
93
+ patterns: FilePatterns {
94
+ include: vec!["**/*.py".to_string()],
95
+ exclude: vec![
96
+ ".venv/**/*".to_string(),
97
+ "**/__pycache__/**".to_string(),
98
+ ".git/**/*".to_string(),
99
+ "**/*.pyc".to_string(),
100
+ "**/*.pyo".to_string(),
101
+ "**/*.pyd".to_string(),
102
+ ],
103
+ },
104
+ },
105
+ source: None,
106
+ uv: None,
107
+ env: None,
108
+ hooks: None,
109
+ }
110
+ ```
111
+
112
+ ### Update your project from GitHub
113
+ In configuration file its possible to set your GitHub repository, so the resulting binary will always check for update before running the application.
114
+
115
+ In `pycrucible.toml` it would look like this:
116
+ ```toml
117
+ [source]
118
+ repository = "https://github.com/username/repo"
119
+ branch = "main"
120
+ update_strategy = "pull"
121
+ ```
122
+
123
+
124
+ In `pyproject.toml` it would look like this-
125
+ ```toml
126
+ [tool.pycrucible.source]
127
+ repository = "https://github.com/username/repo"
128
+ branch = "main"
129
+ update_strategy = "pull"
130
+ ```
131
+
132
+
133
+ ## Prepare your python project
134
+ Your project should include at least:
135
+ - A directory with your Python application (with an entry point (default: __main__.py))
136
+ - Some kind of manifest file declaring dependacies and/or configuration
137
+ - (optional) configuration file or section
138
+ - only `entrypoint` is required if using this configuration file, other options are optional
139
+ - if this file is not present, it will be created with default values.
140
+
141
+ ## Usage
142
+ ```
143
+ $ pycrucible --help
144
+ Tool to generate python executable by melding UV and python source code in crucible of one binary
145
+
146
+ Usage: pycrucible [OPTIONS]
147
+
148
+ Options:
149
+ -e, --embed <EMBED>
150
+ Directory containing Python project to embed. When specified, creates a new binary with the embedded project
151
+ -o, --output <OUTPUT>
152
+ Output path for the new binary when using --embed
153
+ --uv-path <UV_PATH>
154
+ Path to `uv` executable. If not found, it will be downloaded automatically [default: `.`]
155
+ --extract-to-temp
156
+ Extract Python project to a temporary directory when running
157
+ --debug
158
+ Enable debug output
159
+ --delete-after-run <DELETE_AFTER_RUN>
160
+ Delete extracted files after running. Note: requires re-downloading dependencies on each run [default: false]
161
+ -h, --help
162
+ Print help
163
+ -V, --version
164
+ Print version
165
+ ```
166
+
167
+ ### Usage examples (Linux)
168
+ You can copy built/downloaded binary to your project folder and just run:
169
+
170
+ `./pycrucible -e . -o ./launcher`
171
+
172
+ This will embed your project into another binary (that we called "launcher")
173
+
174
+ You can run your project from binary by running
175
+
176
+ `./launcher`
177
+
178
+ ### Usage examples (Windows)
179
+ You can copy built/downloaded binary to your project folder and just run:
180
+
181
+ `pycrucible.exe -e . -o ./launcher.exe`
182
+
183
+ This will embed your project into another binary (that we called "launcher.exe")
184
+
185
+ You can run your project from binary by running
186
+
187
+ `launcher.exe`
188
+
189
+ Now you can copy that "launcher" on practicly any machine with the same architecture.
190
+ Machine only needs internet connection in order to download the dependacies.
191
+ This proccess is extremely fast (but reliant on internet connection)
@@ -0,0 +1,7 @@
1
+ pycrucible/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pycrucible/__main__.py,sha256=bHmD7ZhFsYwVXZNFei9UqX9H3KNuqUTYe4BneTS9Fgs,238
3
+ pycrucible-0.2.7.dist-info/METADATA,sha256=LwmvXg6G2VRkLIoTuTTga6c4XPq4nIJ4HewxcmwUzJw,5676
4
+ pycrucible-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ pycrucible-0.2.7.dist-info/entry_points.txt,sha256=eIPKn59hjdzgLXwdFghWF9KoNKfyTi5EeXT9xHw5EAw,56
6
+ pycrucible-0.2.7.dist-info/top_level.txt,sha256=63DNp5-huY2aG8NJoyho2y297RQOVDPt-Cp16bSFnx0,11
7
+ pycrucible-0.2.7.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pycrucible = pycrucible.__main__:main
@@ -0,0 +1 @@
1
+ pycrucible