Skip to content

Latest commit

 

History

History
220 lines (164 loc) · 8.95 KB

readme.md

File metadata and controls

220 lines (164 loc) · 8.95 KB

Pyaket

📦 Easy Python to → Fast Executables 📦



Links • InstallationExamplesDocumentationIssues
GitHubContactChangelogLicense

🔥 Description

📦 Pyaket is a tool that bundles and generates portable executables of your python projects for all platforms. No more convoluted installation steps, give users the convenience they want, with maximum compatibility and dev-centric ease of use compared to alternative solutions.

  • Lightning fast installation that automatically manages python, virtual environments, and dependencies without user intervention that just works, bundle wheels or install from pypi.
  • Max compatibility with how the project is run in the user's machine - pyaket does not reinvent the wheel or compile python with an intermediate, use tools that already exists #
  • Cross compile from anywhere to most platforms and architectures, no docker or virtual machines required, portable immutable executables - see the table below for details! #
  • Intelligently detects partial installations, downloads, archive unpacks, and automatically takes appropriate action - making iterative development easy and resilient against users
  • Standalone executables with no network calls at runtime that bundles all dependencies #
  • Monorepo support in mind, decoupled dependencies and entry point specification
  • Rolling releases where a single binary always runs latest pypi or git branch/tag #
  • PyTorch installation at runtime, automatic backend detection (optional). #

⭐️ Examples

Simple to use

Compile a cowsay binary for the current platform and run it:

$ pyaket app --name cowsay --pypi "cowsay==6.1" run --module cowsay compile
  Compiling libc v0.2.172
  Compiling typenum v1.18.0
  ...
  Finished `release` profile [optimized] target(s) in 9.88s
$ ./release/cowsay-linux-amd64-v0.0.0.bin -t "Hello, Pyaket!"
  ______________
| Hello, Pyaket! |
  ==============
     \
      \
        ^__^
        (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

Blazingly fast

..after the first installation:

$ hyperfine "./release/cowsay-linux-amd64-v0.0.0.bin -t anyhow"
  Time (mean ± σ):      24.3 ms ±   0.9 ms    [User: 8.8 ms, System: 15.4 ms]
  Range (min … max):    22.4 ms …  26.6 ms    100 runs

$ hyperfine "python -m cowsay -t anyhow"
  Time (mean ± σ):      21.2 ms ±   0.9 ms    [User: 15.6 ms, System: 5.3 ms]
  Range (min … max):    19.4 ms …  23.5 ms    100 runs

Cross compile

..to most platforms and architectures easily:

# Windows executables compiled from linux
$ pyaket app -n cowsay -p "cowsay==6.1" run -m cowsay release -t windows compile
  Finished `release` profile [optimized] target(s) in 8.11s

$ wine ./Release/cowsay-windows-amd64-v0.0.0.exe -t "Hello, Wine!"
  ____________
| Hello, Wine! |
  ============
            \
             \
               ^__^
               (oo)\_______
               (__)\       )\/\
                   ||----w |
                   ||     ||
# Intel Macbook @ ./release/cowsay-macos-amd64-v0.0.0.bin
$ pyaket ... release --target macos --arch amd64 compile

# Apple Silicon @ ./release/cowsay-macos-arm64-v0.0.0.bin
$ pyaket ... release --target macos --arch arm64 compile

Bundle wheels

..and install them at runtime, perfect for monorepos:

$ uv build --all-packages --wheel -o dist
  Successfully built dist/shared-1.0.0-py3-none-any.whl
  Successfully built dist/project_a-1.0.0-py3-none-any.whl
  Successfully built dist/project_b-1.0.0-py3-none-any.whl

# Both will share the same virtual environment 🤯
# ./release/{project_a,project_b}-linux-amd64-v0.0.0.bin
$ pyaket app -n project_a -w "dist/*.whl" run -m project_a compile
$ pyaket app -n project_b -w "dist/*.whl" run -m project_b compile

Predownload

..uv and a python instead of runtime download:

# Adds ~18 MB to the final binary
$ pyaket ... uv --bundle compile

# Adds ~20 MB to the final binary (not implemented yet)
$ pyaket ... python --bundle compile

Install pytorch

..at runtime, with automatic backend detection:

# ./release/app-linux-amd64-v0.0.0-auto.bin
$ pyaket ... torch -v 2.7.0 -b auto compile

# ./release/app-linux-amd64-v0.0.0-cu128.bin
$ pyaket ... torch -v 2.7.0 -b cu128 compile

More examples

For more examples, proper configuration and advanced features, check out the website page!

📦 Installation

Warn: Only installation from source is currently available, unreleased elsewhere.

Note: This section does not cover everything and lacks information on setting up a rust toolchain, environment for cross-compilation, workflows, etc. refer to the website below for more details.

From registries

Pyaket is primarily available on pypi and crates.io under the same name and version.

  • The python package bundles the same rust code and provides a command line interface, automatic dependencies installation, and a few extra features (recommended option)
  • The rust crate implements the core functionality and can be used independently by passing environment variables while compiling the executable. Note that writing any code in rust is not needed, but simply compiling the existing one (advanced option)

Install directly with pip with:

python3 -m pip install pyaket

Head out to the website for the latest installation instructions and more!

From releases

For flexing and dogfooding, you can run pyaket executables made with pyaket itself 🤯

  • Grab a file for you platform from the releases page, it just works!

From source

You can install directly from the git repository with:

python3 -m pip install git+https://github.com/BrokenSource/Pyaket

♻️ Community

Be featured here if you're using Pyaket in your projects!

🌵 Such an empty place here, for now..