Skip to content
PyArmorDEMO

Hands-on workshop

Protect Python Applications

A hands-on lab for Python code obfuscation, runtime protection, packaging, and deployment.

PyArmor 9.2.7 · Python 3.12 · FastAPI · Docker · 13 chapters · ~3 h

terminal
$ uv run pyarmor gen -O build/protected -r --exclude app/frontend app
INFO     obfuscate scripts OK

$ head -n 2 build/protected/app/backend/business_logic/scoring.py
# Pyarmor 9.2.7 (trial), 000000, non-profits, 2026-10-08T09:17:16.748765
from pyarmor_runtime_000000 import __pyarmor__

$ uv run python scripts/verify.py --tests
  ✓ every module is obfuscated and present
  ✓ no function names, constant names or long strings found as plain text
38 passed in 0.12s
  ✓ the protected build passes the same tests as the original

What you will see

Real output from the workshop runs.

05 · Obfuscation

Readable source → three-line stub

WEIGHTS = {"value": 0.55, "engagement": 0.45, "risk_penalty": 0.30}

def classify(score: float) -> str:
    """Name the band a business score falls in."""
    for threshold, label in CLASS_THRESHOLDS:
        if score >= threshold:
            return label
    return "watch"
# Pyarmor 9.2.7 (trial), 000000, non-profits, 2026-10-08T09:17:16.748765
from pyarmor_runtime_000000 import __pyarmor__
__pyarmor__(__name__, __file__, b'PY000000\x00\x03\x0c\x00\xcb\r\r\n\x80\x00\x01\x00\x08...
Compare in the Playground →

Verify

Same behaviour

38 / 38

tests pass on the original and the protected build.

Read more →

06 · Runtime

No runtime, no app

ModuleNotFoundError: No module named 'pyarmor_runtime_000000'
Read more →

09 · Docker

No source in the image

$ ls /src
ls: cannot access '/src': No such file or directory
$ id
uid=10001(app) gid=10001(app) groups=10001(app)
Read more →

06 · Expiry

Builds that stop working

RuntimeError: this license key is expired (1:11086)
Read more →

07 · Limits

Still visible at runtime

constant WEIGHTS = {'value': 0.55, 'engagement': 0.45, 'risk_penalty': 0.3}
Security model →

Threat model

Security model →
ScenarioAttacker hasObfuscation
ASource availableRepository or plain .py filesNothing protected
BProtected artifactObfuscated app + runtimeReading and reuse get much harder
CEnvironment controlledShell, files, memory, env varsNot the boundary: protect the host

Chapters

~3 hours
  1. 00Introduction10m
  2. 01Project Setup10m
  3. 02Explore Source10m
  4. 03Baseline App10m
  5. 04PyArmor Setup5m
  6. 05Obfuscation15m
  7. 06Runtime15m
  8. 07Original vs Protected15m
  9. 08Packaging15m
  10. 09Docker20m
  11. 10Deployment15m
  12. 11Security Reality15m
  13. 12Best Practices15m

Run it locally

Site + live Lab on :3300, protected API on :8300. No account, no keys.

Terminal
git clone https://github.com/jars-demo/pyarmor-demo.git
cd pyarmor-demo
docker compose up -d --build