Skip to main content

No project description provided

Project description

Python Bundler (experimental)

This repo creates executable zipfiles similar to zipapp, pex, and shiv.

It's useful when one:

  • Wants to create compiled packages from a lockfile
  • Wants to be able to debug the resulting environment without unzipping
  • Doesn't mind an initial startup cost to create the virtualenv
  • Wants to use mostly python tooling instead of rejiggering everything to e.g. Bazel

It does not solve some of the core problems with python and its packaging, such as:

  • Some python packages will not work on different python versions, architectures, etc
  • Python takes up a lot of space relative to its functionality
  • Python is duck-typed at runtime

Alternatives:

Package Name Is publicly supported Requires different directory structure Installs all dependencies automatically Easy to debug
zipapp yes, included with python Maybe, must have __main__.py No, they must be manually included via pip install -r requirements.txt --target <directory> before build time No, must unzip the file to edit
pex yes, large project No, works on console scripts Can specify requirements.txt manually at build time No, must unzip the file to edit
shiv yes, past 1.0.0, by linkedin No, works on console scripts No, must specify the dependencies on the command line at build time No, must unzip the file to edit
this repo no No, works on console scripts Yes, uses poetry lockfile Yes, can edit the installation venv
bazel yes, but many modern-python conveniences have a time lag Yes One can wire it up with requirements.txt No, but it can made to be with some effort

Rough Comparisons:

Package Name Runtime Command English definition Size
zipapp 1.9-2.5s pip install . --target python_bundler && python -m zipapp python_bundler/ Install the current package to the target directory, then make a zipapp out of said directory 48M
pex 5s for the first run, then 3.2-3.5s pex '.' --console-script python_bundler --output project_bundle.pex Make a pex env containing the current package, then make an executable pexfile out of the python_bundler console script 21M
shiv 2.5s for the first run, then 0.6-0.8s shiv -c python_bundler -o python_bundler.shiv '.' Make a shiv file using python_bundler console script. Install the current directory. 20M
this repo 11s for the first run, then 0.6-0.7s python_bundler python_bundler Use the current directory's lockfile to create an executable zipfile from the python_bundler console script 16M
bazel n/a n/a n/a n/a

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_bundler-0.1.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file python_bundler-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_bundler-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for python_bundler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bef0065b71f57d3b380e4d74b65f060934bcc0673dbe3709435c1a1d94312a7
MD5 f5907c90bb6991566dd6a5d6124c7e46
BLAKE2b-256 d01c9f0f85d7d240b57530e51ecdacc661a452df043de9433588dba208f4576c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page