Skip to main content

Python SHIV-version, which creates user owned directires if SHIV_ROOT is used. SHIV is a command line utility for building fully self contained Python zipapps.

Project description

pypi ci codecov docs license supported

snake

shiv

Python SHIV-version, which creates user owned directires if SHIV_ROOT is used.

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

quickstart

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

-c flake8 specifies the console script that should be invoked when the executable runs, -o ~/bin/flake8 specifies the location of the generated executable file and flake8 is the dependency that should be installed from PyPI.

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 -m venv venv
source ./venv/bin/activate
python3 -m pip install --upgrade build
python3 -m build
python3 -m pip install -e .

Don't forget to run and write tests:

python3 -m pip install tox
tox

To build documentation when you changed something in docs:

python3 -m 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-userdirs-1.0.3.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

shiv_userdirs-1.0.3-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file shiv-userdirs-1.0.3.tar.gz.

File metadata

  • Download URL: shiv-userdirs-1.0.3.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for shiv-userdirs-1.0.3.tar.gz
Algorithm Hash digest
SHA256 cf72f64f85b384134fe4447d470c3cf38711eb517eaabdab5454fae497b61595
MD5 9b9e2cbc5ad4a948bc8a5626a368df1c
BLAKE2b-256 10719a950c79be20f0c8d27bedcd25cefc95ee61fc3ff0e51ee354b0d20fc917

See more details on using hashes here.

File details

Details for the file shiv_userdirs-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for shiv_userdirs-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 734b62499e9f2e2481f87b254732aa2c3e11474d44dc7785302839528b9ea6e6
MD5 18d665d94b015abe808c45d9bcaf26fd
BLAKE2b-256 eb6af690ed263f78a4dc739784fc39bc86cc7a3ccfe393d38e8cf9d0ee6acede

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