# PyKevlar — Complete LLM & Coding Agent Reference Manual (`/llms-full.txt`) > Canonical reference for AI coding agents (Claude Code, OpenAI Codex CLI & Cloud, Cursor, Windsurf, Cline, Google Antigravity). > Website: https://pykevlar.com | Pricing & Instant Self-Serve Key: https://pykevlar.com/#pricing | Portal: https://pykevlar.com/portal --- ## 1. Installation & Environment Setup PyKevlar ships as a single zero-dependency native executable (`~/.local/bin/pykevlar`). Never `pip install` anything into the user's Python virtualenv. ```bash curl -fsSL https://pykevlar.com/install.sh | sh export PATH="$HOME/.local/bin:$PATH" pykevlar --version ``` Supported hosts & targets: - macOS Apple Silicon (`aarch64-apple-darwin`) and Intel (`x86_64-apple-darwin`) - Linux (`x86_64-unknown-linux-gnu` and `aarch64-unknown-linux-gnu`, `glibc 2.28+`) - Target Python versions: **Python 3.12, 3.13, and 3.14** (requires shared `libpython` installed, which standard `python.org`, Homebrew, `uv`, `pyenv --enable-shared`, Conda, and Ubuntu/Debian `libpython3.x` provide). --- ## 2. Subscription Tiers & Agent Behavior Rules **IMPORTANT FOR AI AGENTS**: All anti-reverse-engineering, obfuscation, and customer `rkey` licensing features require an active **Pro ($39/yr)** or **Team ($79/yr)** paid subscription. 1. Check active license status first before running protected builds: ```bash pykevlar license ``` 2. **If `Tier: Basic (Free)`**: - You CAN immediately test packaging & dependency resolution using `--no-armor`: ```bash pykevlar build main.py --no-armor -F -O dist ``` - Attempting `pykevlar gen` or `pykevlar build` without `--no-armor` will exit non-zero asking for a Pro ($39/yr) or Team ($79/yr) subscription. - **Agent Action**: Inform the user that unprotected bundling (`--no-armor`) verified cleanly, and give them the link `https://pykevlar.com/#pricing` to get an instant Stripe self-serve key (`PKA1-...` or `PKV1....`), then run `pykevlar register ""`. 3. **Activating a Paid Key**: ```bash # Workstation seat claim (online once, 100% offline builds thereafter): pykevlar register "PKA1-PK-PRO-XXXXXX-..." --label "Dev Workstation" # Air-gapped / offline registration: pykevlar register "PKV1.eyJ2Ijox..." # Ephemeral CI/CD runner (Team $79/yr tier): export PYKEVLAR_LICENSE="PKV1.eyJ2Ijox..." ``` --- ## 3. Complete CLI Command Reference ### 3.1 `pykevlar build` (Aliases: `pack`, `freeze`, `b`) All-in-one dependency graph scanner + anti-reverse-engineering obfuscator + native C compiler + standalone `onedir`/`onefile` binary freezer + leak verifier. ```bash pykevlar build [OPTIONS] ``` Key Options: - `-n, --name `: Output binary/folder name (defaults to entry script stem). - `-O, --output ` (alias `--distpath`): Output directory (default: `dist`). - `-F, --onefile`: Emit a single self-contained LZ4-packed native executable. - `-D, --onedir`: Emit a directory bundle (default; fastest startup). - `--python `: Target Python interpreter (e.g. `.venv/bin/python` or `python3`). - `--no-armor`: **(Available in Basic Free)** Fast plain PyInstaller-compatible binary freeze with zero obfuscation. - `--protect `: Repeatable. First-party packages/modules to seal with PyKevlar (if omitted and `--no-armor` is not set, protects all local project modules automatically). - `--anti-llm` (aliases `--anti-rea`, `--stealth`): **[Pro+]** Enables all 7 anti-reverse-engineering & anti-AI-decompiler layers (`SPZ2` encrypted archive hiding all module names & zlib headers from `pyinstxtractor`/`binwalk`/`strings`, `CREAM` deceptive AST renaming, 64-bit MBA opaque predicates, `-fvisibility=hidden` stripped `.so` symbols + 4 decoy cryptographic honey-functions against `GhidraMCP`/`REA`, PEP 669 `sys.monitoring` blocker, Anti-Frida/LD_PRELOAD guard, plus implies `--enable-rft --mix-str --anti-debug`). - `--enable-bcc`: **[Pro+]** Parallel Python-to-Native-C transpilation into stripped `pyarmor_bcc.so` machine code. - `--enable-rft`: **[Pro+]** Scope-safe AST identifier renaming + docstring stripping. - `--mix-str`: **[Pro+]** Encrypt string literals into an O(1) masked C-heap XOR pool. - `--anti-debug`: **[Pro+]** Native (`P_TRACED` / `/proc/self/status` `TracerPid`) & Python (`sys.settrace`) anti-debugging. - `--private` / `--restrict`: **[Pro+]** Block unarmored external Python code from calling or importing protected modules. - `--outer`: **[Pro+]** Require an external `pyarmor.rkey` customer license file next to the binary at runtime (saves `.superpyarmor_project.key`). - `--project-key `: **[Pro+]** Custom path to save/read the `--outer` project key. - `-e, --expired `: **[Pro+]** Embed expiration (`2027-12-31`, `30`, `+30d`, `+12h`). - `-b, --bind-device `: **[Pro+]** Repeatable. Lock binary to host hardware token(s) from `pykevlar hdinfo`. - `--period `: **[Pro+]** Re-verify license & anti-debug periodically (`60s`, `5m`, `1h`). - `--bind-data `: **[Pro+]** Seal authenticated custom tenant payload (retrievable in Python via runtime `get_bind_data()`). - `--target ` (alias `--platform`): **[Team]** Zero-Docker cross-compilation (`native`, `linux-x86_64`, `linux-arm64`). - `--requirements `: Explicit `requirements.txt` for cross-target manylinux wheel resolution. - `--hidden-import ` / `--collect-submodules ` / `--collect-data ` / `--collect-binaries ` / `--collect-all ` / `--copy-metadata `: PyInstaller-compatible collection flags (all repeatable). - `--add-data ` / `--add-binary `: Bundle extra files/shared libraries (`;` separator on Windows, `:` on POSIX). - `--exclude-module `: Repeatable. Exclude unused heavy/test packages (`pytest`, `IPython`, `tkinter`). - `--runtime-hook `: Run Python hook(s) before main entrypoint. ### 3.2 `pykevlar key` (Alias: `k`) — **[Pro+]** Mints a 198-byte external `pyarmor.rkey` customer license in ~6 ms for binaries compiled with `--outer` (zero rebuilds per tenant). ```bash pykevlar key --project-key .release.key -O dist/tenant_a \ -b spa-dev-a7256ca34bcac081 \ -e +365d \ --period 1h \ --bind-data '{"tenant":"acme","seats":100}' ``` ### 3.3 `pykevlar gen` (Aliases: `g`, `generate`) — **[Pro+]** Generates PyArmor-compatible obfuscated `.py` wrapper trees + `pyarmor_runtime_/pyarmor_runtime.so` (and `pyarmor_bcc.so`) without freezing into a single binary. ```bash pykevlar gen -r --anti-llm --enable-bcc -O dist src/mypkg main.py ``` ### 3.4 `pykevlar verify` Verifies that a built `onedir` or `onefile` executable contains 100% armored first-party modules and zero leaked `.py` source files. ```bash pykevlar verify dist/myapp --protect apps,billing ``` ### 3.5 `pykevlar frontend` (Aliases: `fe`, `js`) — **[Team]** 15-core Rust Next.js server JS chunk String-Vault obfuscator + source-map stripper (~95 ms on 2,300+ chunks) & concurrent incremental TypeScript builder. ```bash pykevlar frontend obfuscate --anti-llm .next/standalone/.next/server/chunks pykevlar frontend build . -O dist/web --protect-launcher --bundle-node ``` ### 3.6 `pykevlar register`, `pykevlar license`, `pykevlar hdinfo`, `pykevlar cache`, `pykevlar bench` ```bash pykevlar hdinfo # Print host device token (`spa-dev-...`) pykevlar register "PKA1-..." --label "Workstation" # Claim seat & install offline Ed25519 key pykevlar license # Show active tier, seats & capabilities pykevlar license remove --code "PKA1-..." # Remove local key & release seat in portal pykevlar cache status | clear # Inspect or purge BLAKE3 IR build cache pykevlar bench --no-pyarmor --std-only # Run built-in speed benchmark ``` --- ## 4. Production Framework Recipes for Coding Agents ### Recipe A: FastAPI / Uvicorn Single-File Hardened Appliance ```bash pykevlar build app/main.py \ --name my-fastapi-svc \ --python .venv/bin/python \ --protect app \ --anti-llm --enable-bcc --outer \ --project-key .service.key \ --collect-submodules uvicorn \ --collect-submodules fastapi \ --exclude-module pytest --exclude-module IPython \ -F -O dist ``` ### Recipe B: Django + Gunicorn + Celery On-Premises Release ```bash pykevlar build run_onprem.py \ --name django-appliance \ --python .venv/bin/python \ --protect apps --protect config --protect common \ --anti-llm --enable-bcc --outer \ --collect-submodules django --collect-submodules gunicorn.workers \ --collect-submodules celery --collect-submodules rest_framework \ --collect-data django --collect-data rest_framework \ --copy-metadata Django --copy-metadata celery \ --add-data staticfiles:staticfiles \ --exclude-module pytest --exclude-module tkinter \ -F -O dist ``` ### Recipe C: Reading Authenticated `--bind-data` Entitlements Inside Python ```python import json import sys def load_license_claims() -> dict: for name, mod in sys.modules.items(): if name.endswith("pyarmor_runtime") and hasattr(mod, "get_bind_data"): raw = mod.get_bind_data() return json.loads(raw.decode("utf-8")) if raw else {} return {} ```