Skip to main content

The easiest way to ship python applications.

Project description

packaged

The easiest way to ship python applications.

Demo apps available on the website: packaged.live

Demo

packaged can take any Python project, and package it into a self contained executable, that can run on other machines without needing Python installed.

Installation

pip install packaged

Usage

packaged <output_path> <build_command> <startup_command> [<source_directory>] [--python-version=3.12]

Such as:

packaged my_project.sh 'pip install .' 'python -m your_package' path/to/project

This will package Python 3.12 with your application by default.

To specify a different Python version, use the --python-version flag, like so:

packaged my_project.sh 'pip install .' 'python -m your_package' path/to/project --python-version=3.10

Examples

All examples below create a self contained executable. You can send the produced binary file to another machine with the same OS and architecture, and it will run the same.

You can also find the pre-built binaries on the Releases page.

Mandelbrot (numpy, matplotlib, GUI)

packaged ./mandelbrot.sh 'pip install -r requirements.txt' 'python mandelbrot.py' ./example/mandelbrot --python-version=3.10

This produces a ./mandelbrot.sh binary with:

  • Python 3.10
  • matplotlib
  • numba
  • llvmlite
  • pillow

That outputs an interactive mandelbrot set GUI.

Minesweeper (using packaged.toml for configuration)

You can use a packaged.toml file and simply do packaged path/to/project to create your package. For example, try the minesweeper project:

packaged ./example/minesweeper

This configuration is used for building the package. The equivalent command to build the project without pyproject.toml would be:

packaged minesweeper.sh 'pip install .' 'python -m minesweeper' ./example/minesweeper

Textual (TUI) Demo

Since the dependencies themselves contain all the source code needed, you can skip the last argument. With this, no other files will be packaged other than what is produced in the build step.

packaged ./textual.sh 'pip install textual' 'python -m textual'

This will simply package the textual library's own demo into a single file.

Aliens (pygame)

Pygame ships with various games as well, pygame.examples.aliens is one of them:

packaged ./aliens 'pip install pygame' 'python -m pygame.examples.aliens'

Another one that you can try out is pygame.examples.chimp.

IPython (console scripts)

Packages that expose shell scripts (like ipython) should also just work when creating a package, and these scripts can be used as the startup command:

packaged ./ipython 'pip install ipython' 'ipython'

Now running ./ipython runs a portable version of IPython!

Local Development / Testing

To test and modify the package locally:

  • Create and activate a virtual environment
  • Run pip install -r requirements-dev.txt to do an editable install
  • Run pytest to run tests
  • Make changes as needed

Type Checking

Run mypy .

Create and upload a package to PyPI

Make sure to bump the version in setup.cfg.

Then run the following commands:

rm -rf build dist
python setup.py sdist bdist_wheel

Then upload it to PyPI using twine:

twine upload dist/*

License

The package is Licensed under GNU General Public License v2 (GPLv2). However, note that the packages created with packaged are NOT licensed under GPL. This is because the archives created are just data for the package, and packaged is not a part of the archives created.

That means that you can freely use packaged for commercial use.

Read the License section for Makeself for more information.

Project details


Download files

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

Source Distribution

packaged-0.6.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

packaged-0.6.0-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file packaged-0.6.0.tar.gz.

File metadata

  • Download URL: packaged-0.6.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for packaged-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ab1579a40e4a9d5461357296b1c99f73c9a7585fbe655c0d5f26fae8cdf7b046
MD5 fb707d0cc3d178dfe8877f92ae874286
BLAKE2b-256 d06a2439d8c1c96e5532aec76cfce6de879a5714884e3f20abd02943e5f338b9

See more details on using hashes here.

File details

Details for the file packaged-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: packaged-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for packaged-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d3bd8473d78cdcdb8cd0e5583f76b7fc5c5faacb4cf305a41b01c7392dac77
MD5 95fb9e8cbc06737be7dd79507baa001f
BLAKE2b-256 8f3d2fdd16e4886d93f465e14f6f618fba1fc6a0c9edbd94035bd9081a68363c

See more details on using hashes here.

Supported by

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