This project is a python CLI that aims to make compiling portable python binaries automatable.
It's a binary python distribution (.tar.gz
or .zip
) that can be decompressed
in any folder, and used from there without further ado (ie: no need to run an "installer"
and things like that).
The idea here is to allow for automated systems to:
- Easily obtain a python binary, and use it in their sandbox.
- Install versions of python from binary distributions on laptops/workstations, similarly to how pyenv does it, but without having to compile on target system.
portable-python
is a regular python CLI, it can be installed with:
With pickley:
pickley install portable-python portable-python --help
Using
pip install
:/usr/bin/python3 -mvenv pp ./pp/bin/portable-python --help
From source:
git clone https://github.com/codrsquad/portable-python.git cd portable-python tox -e venv .venv/bin/portable-python --help
Once you've installed portable-python
, you can get going like so:
# Build a binary (for current platform) cd some-temp-folder portable-python build 3.9.6 ls -l dist/3.9.6.tar.gz # Unpack it somewhere tar -C ~/.pyenv/versions/ -xf dist/3.9.6.tar.gz ls -l ~/.pyenv/versions/ # It's ready to be used ~/.pyenv/versions/3.9.6/bin/python --version
Note that you can use --dryrun
mode to inspect what would be done without doing it:
$ portable-python --dryrun build 3.9.6 Would create build/cpython-3.9.2 ... Would untar build/downloads/readline-8.1.tar.gz -> build/cpython-3.9.2/build/readline INFO CFLAGS=-fPIC ... Would run: ./configure --prefix=/deps --disable-shared --with-curses Would run: /usr/bin/make Would run: /usr/bin/make install DESTDIR=build/cpython-3.9.2 ...
portable-python
uses this file structure (build/ and dist/ folders configurable):
build/ cpython-3.9.6/ # Build artifacts for corresponding version are here 3.9.6/ # Full installation (after build completes) build/ # Source code of various modules are here deps/ # --prefix=/deps passed to all ./configure scripts logs/ # Logs for each module build are here, in order of build downloads/ openssl-1.1.1k.tar.gz # Downloaded artifacts (downloaded only once) dist/ 3.9.6.tar.gz # Ready-to-go binary tarball