85

GitHub - linkedin/shiv: shiv is a command line utility for building fully self c...

 5 years ago
source link: https://github.com/linkedin/shiv
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

PyPI Build Status Coverage Status Documentation Status License

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.

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 aws-cli with shiv:

$ shiv -e awscli.clidriver:main -o aws awscli
$ ./aws --version
aws-cli/1.14.2 Python/3.6.1 Linux/3.10.0-514.21.2.el7.x86_64 botocore/1.8.6
complex example involving a wheel cache

Creating an interactive executable with a downloaded wheel of boto:

$ python3 -m pip download boto
Collecting boto
  File was already downloaded /tmp/tmp.iklsO1qyd3/boto-2.48.0-py2.py3-none-any.whl
Successfully downloaded boto
$ shiv -o boto.pyz --find-links . --no-index boto
 shiv! ?
Collecting boto
Installing collected packages: boto
Successfully installed boto-2.48.0
 done
$ ./boto.pyz
Python 3.6.1 (default, Apr 19 2017, 21:58:41)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import boto
>>>

installing

You can install shiv via pip / pypi

pip install shiv

You can even create a pyz of shiv using shiv!

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

developing

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

git clone [email protected]: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

gotchas

Zipapps created with shiv are not cross-compatible with other architectures. For example, a pyz file built on a Mac will only work on other Macs, likewise for RHEL, etc.

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 ocassionally clean this directory.


Logo by Juliette Carvalho


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK