Skip to main content

A command line utility for building fully self contained Python zipapps.

Project description

PyPI Build Status Coverage Status Documentation Status License Supported

snake

shiv

shiv is a command line utility for building fully self-contained Python zipapps as outlined in PEP 441, but with all their dependencies included!

shiv's primary goal is making distributing Python applications fast & easy.

Full documentation can be found here.

sys requirements

  • python3.6+
  • linux/osx/windows

how to

shiv has a few command line options of its own and accepts almost all options passable to pip install.

simple cli example

Creating an executable of flake8 with shiv:

$ shiv -c flake8 -o ~/bin/flake8 flake8
$ ~/bin/flake8 --version
3.7.8 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.4 on Darwin

Creating an interactive executable with the boto library:

$ shiv -o boto.pyz boto
Collecting boto
Installing collected packages: boto
Successfully installed boto-2.49.0
$ ./boto.pyz
Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import boto
>>> boto.__version__
'2.49.0'

installing

You can install shiv by simply downloading a release from https://github.com/linkedin/shiv/releases or via pip / pypi:

pip install shiv

You can even create a pyz of shiv using shiv!

python3 -m venv .
source bin/activate
pip install shiv
shiv -c shiv -o shiv shiv

developing

We'd love contributions! Getting bootstrapped to develop is easy:

git clone git@github.com:linkedin/shiv.git
cd shiv
python3 setup.py venv
. activate
python3 setup.py develop

Don't forget to run and write tests:

pip install tox
tox

To build documentation when you changed something in docs:

pip install -r docs/requirements.txt
sphinx-build docs build/html

gotchas

Zipapps created with shiv are not guaranteed to be cross-compatible with other architectures. For example, a pyz file built on a Mac may only work on other Macs, likewise for RHEL, etc. This usually only applies to zipapps that have C extensions in their dependencies. If all your dependencies are pure python, then chances are the pyz will work on other platforms. Just something to be aware of.

Zipapps created with shiv will extract themselves into ~/.shiv, unless overridden via SHIV_ROOT. If you create many utilities with shiv, you may want to occasionally clean this directory.


acknowledgements

Similar projects:

Logo by Juliette Carvalho

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

shiv-0.1.3.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

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

shiv-0.1.3-py2.py3-none-any.whl (18.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file shiv-0.1.3.tar.gz.

File metadata

  • Download URL: shiv-0.1.3.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for shiv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 444a9552f18e30e346e4d97eeb9f62aa3a83317c9e982ae0fe88ad49fc152efe
MD5 94c8b2e80c9e73ab0aba980a3d60aedd
BLAKE2b-256 eba32031169d8e9b423f436382688c6560951f7eb497e993f21e4817e22bb21b

See more details on using hashes here.

File details

Details for the file shiv-0.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: shiv-0.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for shiv-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e8784fb9dc07041de547936863884b777c6ffa4ffdd03d9e363e64776ee5a32c
MD5 d1be152b4ff12bb3fa771ae2061968d1
BLAKE2b-256 262a077b749c5b4794673de29a0a8110b24d191663e3c58b7a4d9cc1cfe0a629

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