build-pyenv
The build-pyenv tool is a high-performance CLI tool designed to prepare Python environments for air-gapped or
restricted-network servers. It automates the process of downloading, building (if necessary), and caching
Python packages files(.whl) and their dependencies.
✨ Key Features
Smart Caching: Tracks successfully downloaded packages in a .cache_pkg file to skip redundant work.Automatic Build: If the required package does not provide a.whlfile, it will build them from source locally and generate the.whlfile.Detailed Logging: Separate output.log for full process history and error.log for quick troubleshooting.Modern CLI: Built with Typer for a polished terminal experience and shell auto-completion.Air-Gap Ready: Resolves and bundles all sub-dependencies, ensuring your offline installation is complete.
🚀 Quick Start
This tool is released as a python package and executable. You need to have python and pip to install it.
Build your local environment
As we mentioned before, this tool may build locally the .whl files. So if the OS, CPU architecture or python
version of your build environment are not compatible with the target machine, the downloaded or generated .whl will
not be compatible in the target machine. The python version which you use to run the tool will define the downloaded installed
Before build your local environment, check the below things:
- What is the
OSof your target machine? (e.g. Windows, Linux, MacOS) - What is the
CPU architectureof your target machine? (e.g. x86, ARM, etc.) - What is the
python versionof your target python environment (e.g. 3.11, 3.12, etc.)
For example if you target environment is a Windows Server 2019 with x86 CPU and python 3.11. Your local environment
should also be Windows, x86, and python 3.11.
We recommend you to use a virtual environment to run the tool. Your local environment must have internet access.
For example, you can create a virtual environment for python 3.11 with conda.
conda create --name my_test python=3.11
Installation
Here we suppose you already have the required python, pip and virtual environment.
pip install build-pyenv
Basic Usage
After installation, you can view all available options of the tool with build-pyenv.exe --help
> build-pyenv.exe --help
Usage: build-pyenv [OPTIONS]
Main command to download and cache python packages.
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --requirements -r FILE Path to the requirements.txt file. [required] │
│ --output -o DIRECTORY Directory to store downloaded wheels. [default: ./target] │
│ --logs -l PATH Directory to store log files. [default: ./logs] │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
The only required option is -r, user must provide a requirements.txt file which specifies all the required python
packages. The syntax of the requirements.txt is the standard syntax rules defined by PEP 508.
For example, if you have a requirements.txt like
pandas
numpy
When you run the tool, you should see the below outputs
(my_test) C:\Users\toto\Documents\tmp>build-pyenv.exe -r requirements.txt
INFO: Logging initialized. Errors -> error.log, All -> output.log
🚀 Starting build process...
INFO: Starting download packages to: C:\Users\toto\Documents\tmp\target
INFO: Processing: pandas...
INFO: [OK] pandas is ready in C:\Users\toto\Documents\tmp\target
INFO: Processing: numpy...
INFO: [OK] numpy is ready in C:\Users\toto\Documents\tmp\target
INFO: Cache updated at C:/Users/toto/Documents/tmp/target/.cache_pkg (Total: 2 packages)
INFO: Wheel files are stored in: C:/Users/toto/Documents/tmp/target/pkgs
INFO: --- All done! ---
✨ Success! Wheels are in C:\Users\toto\Documents\tmp\target
If you don't specify the output dir and log path, the tool will create a default output dir
target, and a default log dirlogsin the current directory.
🛠 Workflow for using the output packages
To use the output packages in an Air-Gapped Server:
- Copy the folder
pkgsto the target server. - In the target server, activate your python virtual environment
- run
pip install --no-index --find-links ./pkgs -r requirements.txt
Metadata
Release files for build-pyenv 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| build_pyenv-0.2.0.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| build_pyenv-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / build_pyenv-0.2.0.tar.gz
| Download URL | build_pyenv-0.2.0.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f67a2eceab38be344f5d329116fc1e5b000a6b680e6ca0ce97e34b907b5d5e05
|
|
BLAKE2b-256 checksum How to use checksums |
958e8d81772c6c0b865ddf3e46f67ea70d672f025236d0d1488b0d4264f97067
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / build_pyenv-0.2.0-py3-none-any.whl
| Download URL | build_pyenv-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82877f223718f420e68921e6bb227d2aa67a2a72f88b4a8bdb66bd822fb9da2d
|
|
BLAKE2b-256 checksum How to use checksums |
2821177b36b906564866b67737567b0ee66c8c960601b758e35c177db668d865
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|