Python wrapper for the PyCrucible CLI tool
Project description
PyCrucible
"Run Python Apps Instantly, No Setup Required."
A robust, cross-platform builder and launcher for Python apps using UV.
Overview
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.
Features
- Cross-Platform:
- Windows support
- macOS support (testing)
- Linux support
- Configurable:
- Use
pycrucible.tomlto customize embedding details- entrypoint
- include/exlude files
- arguments to `uv
- env variables
- pre and post run hooks (python scripts)
- Support for multiple ways of defining requirements
-
uvinitializedpyproject.toml -
requirements.txt -
pylock.toml -
setup.py -
setup.cfg
-
- Load the project as a directory
- Load the project as .zip archive
- Use
- Cleanup:
- Optionally remove files after execution (reccomended for temporary directories)
- Tests:
- Unit tests cover configuration, extraction, and hook execution
- Source Update:
- Initiate an update of source code pulling from GitHub
Building from source
-
Ensure you have Rust installed.
-
Clone the repository
git clone https://github.com/razorblade23/PyCrucible
- Change directory to be inside of a project
cd PyCrucible
- Build the binary
cargo build --release
The resulting binary will be in target/release/pycrucible.
Downloading pre-made binary
You can download pre-made binaries for your system from Releases page
PyCrucible configuration
A directory with a single .py file is all you need to start.
There are however multiple configuration options to suit your specific needs.
Note - when using any configuration, only entrypoint is required. Other options are optional.
Configuration can be set in two ways:
pycrucible.tomlpyproject.toml
Both of these files have exact same configuration options. You can find example file for pycrucible.toml here
Diffrence between configuration options
Note - In both pycrucible.toml and pyproject.toml directive entrypoint can also be replaced by just entry.
In pycrucible.toml you would define configuration like this:
entrypoint = "src/main.py"
# or
entry = "src/main.py"
[package.patterns]
include = [
"**/*.py",
]
exclude = [
"**/__pycache__/**",
]
[hooks]
pre_run = "some_script.py"
post_run = "some_other_script.py"
In pyproject.toml you would define configuration like this:
[tool.pycrucible]
entrypoint = "src/main.py"
# or
entry = "src/main.py"
[tool.pycrucible.patterns]
include = [
"**/*.py",
]
exclude = [
"**/__pycache__/**",
]
[tool.pycrucible.hooks]
pre_run = "some_script.py"
post_run = "some_other_script.py"
Default configuration
ProjectConfig {
package: PackageConfig {
entrypoint: "main.py".into(),
patterns: FilePatterns {
include: vec!["**/*.py".to_string()],
exclude: vec![
".venv/**/*".to_string(),
"**/__pycache__/**".to_string(),
".git/**/*".to_string(),
"**/*.pyc".to_string(),
"**/*.pyo".to_string(),
"**/*.pyd".to_string(),
],
},
},
source: None,
uv: None,
env: None,
hooks: Some(Hooks {
pre_run: Some("".to_string()),
post_run: Some("".to_string()),
}),
}
Update your project from GitHub
In configuration file its possible to set your GitHub repository, so the resulting binary will always check for update before running the application.
In pycrucible.toml it would look like this:
[source]
repository = "https://github.com/username/repo"
branch = "main"
update_strategy = "pull"
In pyproject.toml it would look like this-
[tool.pycrucible.source]
repository = "https://github.com/username/repo"
branch = "main"
update_strategy = "pull"
Prepare your python project
Your project should include at least:
- A directory with your Python application (with an entry point (default: main.py))
- Some kind of manifest file declaring dependacies and/or configuration
- (optional) configuration file or section
- only
entrypointis required if using this configuration file, other options are optional - if this file is not present, it will be created with default values.
- only
Usage
$ pycrucible --help
Tool to generate python executable by melding UV and python source code in crucible of one binary
Usage: pycrucible [OPTIONS]
Options:
-e, --embed <EMBED>
Directory containing Python project to embed. When specified, creates a new binary with the embedded project
-o, --output <OUTPUT>
Output path for the new binary when using --embed
--uv-path <UV_PATH>
Path to `uv` executable. If not found, it will be downloaded automatically [default: `.`]
--extract-to-temp
Extract Python project to a temporary directory when running
--debug
Enable debug output
--delete-after-run <DELETE_AFTER_RUN>
Delete extracted files after running. Note: requires re-downloading dependencies on each run [default: false]
-h, --help
Print help
-V, --version
Print version
Usage examples (Linux)
You can copy built/downloaded binary to your project folder and just run:
./pycrucible -e . -o ./launcher
This will embed your project into another binary (that we called "launcher")
You can run your project from binary by running
./launcher
Usage examples (Windows)
You can copy built/downloaded binary to your project folder and just run:
pycrucible.exe -e . -o ./launcher
This will embed your project into another binary (that we called "launcher")
You can run your project from binary by running
launcher.exe
Now you can copy that "launcher" on practicly any machine with the same architecture. Machine only needs internet connection in order to download the dependacies. This proccess is extremely fast (but reliant on internet connection)
Thanks to
The idea is inspired by Packaged
Thanks to all the briliant developers at Astral - they did awesome job with uv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycrucible-0.2.9.tar.gz.
File metadata
- Download URL: pycrucible-0.2.9.tar.gz
- Upload date:
- Size: 36.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
107cf0d8d929cc6bddc5045cd23f106487e30fabeae8156f25318ca528cda072
|
|
| MD5 |
74fc0a096205fd769f2d69210b3cad3d
|
|
| BLAKE2b-256 |
c0e5112dde230917f7bee0fa7cd074ed59cc34bd9f35986982251c60aadf0f60
|
Provenance
The following attestation bundles were made for pycrucible-0.2.9.tar.gz:
Publisher:
native_pipeline.yml on razorblade23/PyCrucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycrucible-0.2.9.tar.gz -
Subject digest:
107cf0d8d929cc6bddc5045cd23f106487e30fabeae8156f25318ca528cda072 - Sigstore transparency entry: 264714021
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Branch / Tag:
refs/tags/v0.2.9-fix-pypi3 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native_pipeline.yml@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.2.9-py3-none-win_amd64.whl.
File metadata
- Download URL: pycrucible-0.2.9-py3-none-win_amd64.whl
- Upload date:
- Size: 3.2 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ae26341cf7fb39951a476f25dc949c54621836f505b216bee611b4273eb86e6
|
|
| MD5 |
e08ea79eca9c2cd1d82e5cc4f9911abc
|
|
| BLAKE2b-256 |
25d6eaa060c44dc0b109aa2355d1c86715acff8b6a8d6924dfff68a413e4ae1c
|
Provenance
The following attestation bundles were made for pycrucible-0.2.9-py3-none-win_amd64.whl:
Publisher:
native_pipeline.yml on razorblade23/PyCrucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycrucible-0.2.9-py3-none-win_amd64.whl -
Subject digest:
0ae26341cf7fb39951a476f25dc949c54621836f505b216bee611b4273eb86e6 - Sigstore transparency entry: 264714024
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Branch / Tag:
refs/tags/v0.2.9-fix-pypi3 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native_pipeline.yml@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.2.9-py3-none-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: pycrucible-0.2.9-py3-none-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ce0364beec4817d91caaea5b1d7760b394bfd4cc755e358ebdc61bbb71ddcb
|
|
| MD5 |
0057d7384dad06c7cc946c2f2f0cb726
|
|
| BLAKE2b-256 |
a75898c8defd199ad8b719cf8402d9c3cc88c614ed3ad3c20b684c53fbdf9cdc
|
Provenance
The following attestation bundles were made for pycrucible-0.2.9-py3-none-manylinux_2_39_x86_64.whl:
Publisher:
native_pipeline.yml on razorblade23/PyCrucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycrucible-0.2.9-py3-none-manylinux_2_39_x86_64.whl -
Subject digest:
40ce0364beec4817d91caaea5b1d7760b394bfd4cc755e358ebdc61bbb71ddcb - Sigstore transparency entry: 264714031
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Branch / Tag:
refs/tags/v0.2.9-fix-pypi3 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native_pipeline.yml@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.2.9-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pycrucible-0.2.9-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9c5ded024c05853a0347c89d18b5b5d5fc55d231826961344e6b951e87caee
|
|
| MD5 |
a115313b80b37fecc873e93b8851e581
|
|
| BLAKE2b-256 |
6da320455cb8e0efc10eb4848570a20b663a0af423489d244f8054a5d5046584
|
Provenance
The following attestation bundles were made for pycrucible-0.2.9-py3-none-macosx_10_12_x86_64.whl:
Publisher:
native_pipeline.yml on razorblade23/PyCrucible
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycrucible-0.2.9-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
6b9c5ded024c05853a0347c89d18b5b5d5fc55d231826961344e6b951e87caee - Sigstore transparency entry: 264714028
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Branch / Tag:
refs/tags/v0.2.9-fix-pypi3 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
native_pipeline.yml@b08a7c529b93b5fc4508b65d3bff9341d77c6049 -
Trigger Event:
release
-
Statement type: