Package your python code into one zip file, even a virtual environment.
Project description
zipapps
Package your python code into one zip file, even a virtual environment. Also compatible for win32.
Inspired by shiv, to publish applications easily. Unlike shiv, this lib will not create cache folders while running apps.
Requirements
Only python3.6+
Install
pip install zipapps -U
Usage
python3 -m zipapps -h
0. package your code without any requirements
> python3 -m zipapps -c -a ./simple_package -p /usr/bin/python3 -o simple_package.pyz
> ./simple_package.pyz
OR
> python3 -m zipapps -c -a ./simple_package -o simple_package.pyz
> python3 simple_package.pyz
------------------------------------
1. use zipapps to make a standalone app which need bottle installed
> python3 -m zipapps -c -a bottle_server.py -m bottle_server:main bottle
> python3 app.pyz
OR
> python3 -m zipapps -c -a bottle_server.py -m bottle_server:main bottle
> python3 app.pyz
------------------------------------
2. use zipapps for venv
> python3 -m zipapps -c bottle
> python3 app.pyz bottle_server.py
OR
> python3 -m zipapps -c -p /usr/bin/python3 bottle
> ./app.pyz bottle_server.py
------------------------------------
3. advanced usages
3.1 more args
python3 -m zipapps -c -a package1,package2 -o server.pyz -m package1.server:main -p /usr/bin/python3 -r requirements.txt
./server.pyz
PS: all the unknown args will be used by "pip install".
===========================================================================
optional arguments:
-h, --help show this help message and exit
--output OUTPUT, -o OUTPUT
The name of the output file, defaults to "app.pyz".
--python INTERPRETER, -p INTERPRETER
The name of the Python interpreter to use (default: no shebang line).
--main MAIN, -m MAIN The main function of the application. Format like package.module:function.
--compress, -c Compress files with the deflate method, defaults to uncompressed.
--includes INCLUDES, -a INCLUDES
The files/folders of given dir path will be copied into cache-path, which can be import from PYTHONPATH). The path string will be splited by ",".
--cache-path CACHE_PATH
The cache path of zipapps to store site-packages and `includes` files, which will be treat as PYTHONPATH. If not set, will create and clean-up automately.
--shell Only while `main` is not set, used for shell=True in subprocess.Popen
Project details
Release history Release notifications | RSS feed
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 Distributions
File details
Details for the file zipapps-2020.10.20-py3-none-any.whl
.
File metadata
- Download URL: zipapps-2020.10.20-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92ffd99716de9c87c60b5824766e6d138d0ce22525fb1b49ea0ded6acb5657bf |
|
MD5 | 3253181b598ecfe81cdff4a1eca68ccb |
|
BLAKE2b-256 | 2856e514679c957e8118064ee6b32b8f1438aa2c91fdab14b5f53d8b011c37fc |
File details
Details for the file zipapps-2020.10.20-py2-none-any.whl
.
File metadata
- Download URL: zipapps-2020.10.20-py2-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b83ae4eb0dc246cdeba4d967eca074f9623ec9527021022b18749176e76d4c45 |
|
MD5 | 4f92d7b9301f9ee0453f96ffb8415c2a |
|
BLAKE2b-256 | fe2068849b12d6d44c2b587b173092e1c075968d3d67e424ac9cf33e21d00d4d |