Python wrapper for the PyCrucible CLI tool
Project description
Overview
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.
What does this mean?
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.
Community
You can visit our community group on Telegram PyCrucible Telegram Community
Changelog
You can see latest changes at CHANGELOG FILE.
Github Action
PyCrucible has associated GitHub Action workflow which you can use to embed your python applications directly in CI. GitHub Action marketplace. GitHub Repository
Documentation
Documentation can be found at PyCrucible docs.
How to get PyCrucible
There are a couple of ways to get PyCrucible.
Using PyPI
PyCrucible is published to PyPI for every release. All you need to do is:
pip install pycrucible
Using Github Releases
You can download pre-made binaries for your system from Github Releases page
Downloading and building from source code
-
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 Runner
cargo build -p pycrucible_runner --release -
Build Pycrucible
cargo build -p pycrucible --release
[!NOTE] The resulting binary will be in
target/release/pycrucible.
How to use PyCrucible
All you need for starting is a single main.py file with some code.
If you installed it using pip you can just run it with:
pycrucible -e .
This will embed your project and produce a new binary which is by default called launcher (or launcher.exe on Windows).
[!TIP] To configure the output path and name of your binary, use
-oor--outputflag.Example:
pycrucible -e . -o ./myapp(orpycrucible -e . -o ./myapp.exe)
This is now all you need to distribute your python project to other people.
No python required on their end. Just this single binary.
Running pycrucible --help reveals more options:
$ 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: `.`]
--debug
Enable debug output
-h, --help
Print help
-V, --version
Print version
How to configure PyCrucible
Configuration can be set in two files:
pycrucible.tomlpyproject.toml
[!NOTE] When both
pycrucible.tomlandpyproject.tomlare discovered, configuration frompycrucible.tomlwill take effect.
[!IMPORTANT] When using any configuration, only
entrypointis required. Other options are optional.
[!TIP] In both
pycrucible.tomlandpyproject.tomldirectiveentrypointcan also be replaced by justentry.
Both of these files have exact same configuration options. You can find example file for pycrucible.toml here
In pycrucible.toml you would define configuration like this:
entrypoint = "src/main.py"
# or
entry = "src/main.py"
[options]
debug = false
extract_to_temp = false
delete_after_run = false
[patterns]
include = [
"**/*.py",
]
exclude = [
"**/__pycache__/**",
]
[env]
FOO = "foo"
BAR = "bar"
[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.options]
debug = false
extract_to_temp = false
delete_after_run = false
offline_mode = false
[tool.pycrucible.patterns]
include = [
"**/*.py",
]
exclude = [
"**/__pycache__/**",
]
[tool.pycrucible.env]
FOO = "foo"
BAR = "bar"
[tool.pycrucible.hooks]
pre_run = "some_script.py"
post_run = "some_other_script.py"
[!TIP] You can use
patternsto include or exclude any arbitrary files, like HTML templates, Kivy layout files or any other arbitrary files needed for your application.
[!IMPORTANT] There is no need for setting
PYTHONPATHenv variable asuvwill take care of this. If this is really needed,uvwill complain and you should also also setUV_LINK_MODE="copy"as env variable to mitigate the warning.
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"
Default configuration
entrypoint = "main.py"
# Options
debug = false
extract_to_temp = false
delete_after_run = false
# Patterns
patterns.include = [
"**/*.py",
]
patterns.exclude = [
".venv/**/*",
"**/__pycache__/**",
".git/**/*",
"**/*.pyc",
"**/*.pyo",
"**/*.pyd"
]
# Source repository (GitHub)
source = None
# Enviroment variables
env = None
# Pre and post run hooks
hooks = None
If any of these configuration options is not used, it will be replaced with default value.
NOTE - entrypoint directive is required when using any configuration options.
Security / Code signing
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.
Code signing will be automatic in next release of PyCrucible.
The builder is the only distributed artifact; the Python projects themselves are provided by users at runtime.
Signing the builder ensures the binary is authentic.
Generated self-contained binaries (created by the builder) are not pre-signed — users may optionally sign them for their own distribution.
[!IMPORTANT] Make sure you run code signing after embedding your project. This makes sure that embedded project also be part of the signiture.
Features
- Cross-Platform:
- Windows support
- macOS support (testing)
- Linux support
- Small overhead:
- Runner binary that embeds your project is just 2 MB. This ofcourse grows with embedding
uvand your project.
- Runner binary that embeds your project is just 2 MB. This ofcourse grows with embedding
- Configurable:
- Use
pycrucible.tomlorpyproject.tomlto customize embedding details- entrypoint
- include/exlude files
- arguments to
uv - env variables
- update source code from github
- pre and post run hooks (python scripts)
- offline mode
- extract to temporary directory (removes temporary directory after running automaticly)
- remove extracted files after running
- Support for multiple ways of defining requirements
-
uvinitializedpyproject.toml(This is preffered !) -
requirements.txt -
pylock.toml -
setup.py -
setup.cfg
-
- Load the project as a directory
- Use
- Tests:
- Unit tests covering as much as i can make it
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 Distributions
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.3.8-py3-none-win_amd64.whl.
File metadata
- Download URL: pycrucible-0.3.8-py3-none-win_amd64.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
554085902b8f81776b933ac8720c169ee6bc588942c2fb1e314c14c5d6653fdf
|
|
| MD5 |
e3344e11222d969babfa07eadf36567c
|
|
| BLAKE2b-256 |
2fa4d976b24b6ed2d89d42c78b30d19c98308752e896c830ddb84db48ff82827
|
Provenance
The following attestation bundles were made for pycrucible-0.3.8-py3-none-win_amd64.whl:
Publisher:
v0.3-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.3.8-py3-none-win_amd64.whl -
Subject digest:
554085902b8f81776b933ac8720c169ee6bc588942c2fb1e314c14c5d6653fdf - Sigstore transparency entry: 700353906
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
v0.3-pipeline.yml@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.3.8-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pycrucible-0.3.8-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3658c500f7969ad272fdaf63075cc58db2bd74fe1f12274a361c6483f0a3f15
|
|
| MD5 |
c946c6fb1d226906fcbb2a3d2f1b129a
|
|
| BLAKE2b-256 |
b8dede121d45ef0d328d378b4bac7d55b0cb3d99096a0c54222327654178fb11
|
Provenance
The following attestation bundles were made for pycrucible-0.3.8-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
v0.3-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.3.8-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
e3658c500f7969ad272fdaf63075cc58db2bd74fe1f12274a361c6483f0a3f15 - Sigstore transparency entry: 700353901
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
v0.3-pipeline.yml@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.3.8-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: pycrucible-0.3.8-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dc7956efd862d8ab9e0636d2800660c9cfeac0e0e57195fbb461b46280a124e
|
|
| MD5 |
b104e3b9d7d804c0a7a1395d411f5ab6
|
|
| BLAKE2b-256 |
d98597258e01d81982a52a68d409301b75702528bbd4c9ff4d926e5171d8d355
|
Provenance
The following attestation bundles were made for pycrucible-0.3.8-py3-none-macosx_11_0_arm64.whl:
Publisher:
v0.3-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.3.8-py3-none-macosx_11_0_arm64.whl -
Subject digest:
3dc7956efd862d8ab9e0636d2800660c9cfeac0e0e57195fbb461b46280a124e - Sigstore transparency entry: 700353902
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
v0.3-pipeline.yml@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycrucible-0.3.8-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pycrucible-0.3.8-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
544746fbbfb122c2182a93cd05b1b9c6facb0f34b864aeaacb21e49eae65aae5
|
|
| MD5 |
19a9eeabae74ee0083a77b8118b81400
|
|
| BLAKE2b-256 |
ea90a6abe20522ed8dbc18de705ccbd34c43010785060773a8c08a5bb7685fd0
|
Provenance
The following attestation bundles were made for pycrucible-0.3.8-py3-none-macosx_10_12_x86_64.whl:
Publisher:
v0.3-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.3.8-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
544746fbbfb122c2182a93cd05b1b9c6facb0f34b864aeaacb21e49eae65aae5 - Sigstore transparency entry: 700353905
- Sigstore integration time:
-
Permalink:
razorblade23/PyCrucible@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Branch / Tag:
refs/tags/v0.3.8 - Owner: https://github.com/razorblade23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
v0.3-pipeline.yml@2a2d49019f0e9722b98154727995b623cb57c9d7 -
Trigger Event:
release
-
Statement type: