Documentation & Recipes

Production How-To Manual.

Complete CLI workflows for protecting Python 3.12–3.14 backends, desktop apps, ML pipelines, and on-premises appliances.

How-To 01

Install PyKevlar & Register Multiple Build Devices

PyKevlar ships as a single 1.1 MB native binary with zero Python package dependencies, so it never pollutes your application's virtualenv.

# 1. Install standalone binary (~/.local/bin/pykevlar)
curl -fsSL https://pykevlar.com/install.sh | sh

# 2A. Activate a developer workstation & claim a seat via Portal Code:
pykevlar register "PKA1-PK-PRO-8F2A19-..." --label "MacBook Pro M5"

# 2B. Or register 100% air-gapped / offline with your signed PKV1 token or .lic file:
pykevlar register ./pykevlar-pk-pro-8f2a19.lic

# 3. Inspect active tier, seat count & capabilities:
pykevlar license

Moving to a new laptop? Run pykevlar license remove --code PKA1-... or click Deauthorize inside the License Portal to free the seat immediately.

How-To 02

Ship a Django or FastAPI On-Premises Single Binary in Under 2 Seconds

Replace brittle pyarmor gen + pyinstaller app.spec pipelines with one parallel pykevlar build command. Third-party wheels stay cleanly frozen while your proprietary packages are ChaCha20-encrypted and compiled to C.

pykevlar build run_server.py \
    --name acme-appliance \
    --python .venv/bin/python \
    --protect apps --protect core --protect billing \
    --enable-rft --mix-str --enable-bcc --anti-debug \
    --collect-submodules uvicorn --collect-submodules fastapi \
    --add-data staticfiles:staticfiles \
    -F -O dist

# Automatically verify 0 leaked .py files exist inside the executable:
pykevlar verify dist/acme-appliance --protect apps,core,billing
How-To 03

Defeat pyinstxtractor, PyLingual, GhidraMCP & Frida with --anti-llm

Passing --anti-llm (alias --stealth or --anti-rea) activates all 7 static and runtime countermeasures: SPZ2 stream-encrypted archives, CREAM semantic AST poisoning, 64-bit MBA opaque predicates, hidden ELF/Mach-O symbols with decoy honey-functions, PEP 669 sys.monitoring blocking, and Anti-Frida checks.

# Build maximum-stealth single-file executable:
pykevlar build inference_engine.py -F --anti-llm --enable-bcc -O dist

# Self-audit against strings & symbol inspection:
strings dist/inference_engine | grep -i "inference_engine"   # -> 0 matches
pykevlar verify dist/inference_engine
How-To 04

Bind Customer Deployments to Hardware UUIDs & Expiration Dates (--outer)

Build your application binary once with --outer, then mint tiny 198-byte pyarmor.rkey license files per customer in 6 ms—without ever recompiling your codebase.

# Step 1 (Once per release): Build binary requiring external pyarmor.rkey
pykevlar build run_onprem.py -F --anti-llm --outer \
    --project-key .acme_release.key -O dist

# Step 2 (On customer target server): Read host hardware token
./run_onprem --hdinfo   # or: pykevlar hdinfo -> spa-dev-a7256ca34bcac081

# Step 3 (Per customer, 6.2 ms): Mint hardware-locked + expiring key + custom JSON payload
pykevlar key --project-key .acme_release.key -O dist/client_bank_a \
    -b spa-dev-a7256ca34bcac081 \
    -e 2027-12-31 \
    --period 1h \
    --bind-data '{"tenant":"everest-bank","max_users":250}'
How-To 05 · Team Tier

Zero-Docker Mac → Linux Cross-Builds & GitHub Actions CI/CD

With a Team ($79/yr) license, cross-compile native glibc 2.28+ Linux binaries straight from macOS, or store your signed key in PYKEVLAR_LICENSE for unlimited ephemeral CI containers.

# Build Linux x86_64 ELF64 binary directly on Apple Silicon macOS (zero Docker!):
pykevlar build app.py --target linux-x86_64 --anti-llm --enable-bcc -F -O dist-linux

# GitHub Actions (.github/workflows/release.yml):
# env:
#   PYKEVLAR_LICENSE: ${{ secrets.PYKEVLAR_LICENSE }}
# run: |
#   curl -fsSL https://pykevlar.com/install.sh | sh
#   ~/.local/bin/pykevlar build app.py -F --anti-llm -O dist
How-To 06

5-Minute Migration from PyArmor + PyInstaller

PyKevlar accepts familiar PyArmor and PyInstaller flags directly:

Legacy Workflow PyKevlar Single-Binary Equivalent
pyarmor gen -r --enable-rft --mix-str --enable-bcc -O dist src/ pykevlar gen -r --enable-rft --mix-str --enable-bcc -O dist src/
pyarmor gen --pack onefile main.py pykevlar build main.py -F --anti-llm -O dist
pyarmor gen key -e +30d -b <dev> pykevlar key -e +30d -b <dev> -O dist
pyinstaller -F --hidden-import foo --add-data a:b main.py pykevlar build main.py -F --hidden-import foo --add-data a:b