Architecture
Each box links to what it is and where it lives in the repo.
01Developer
your machineWrites and tests the readable source. Runs the workshop commands with uv.
02Python source
app/backend/The FastAPI app. business_logic/ holds the scoring model worth protecting. Never shipped.
03PyArmor build
scripts/obfuscate.py · verify.pyRuns pyarmor gen -O build/protected -r app, fails on PyArmor errors (it exits 0 on some), then checks every module is obfuscated and the tests still pass.
04Protected application
build/protected/app/The same package structure; each .py is a three-line stub with an encrypted payload.
05Runtime components
build/protected/pyarmor_runtime_000000/A compiled extension that decodes the protected code in memory. Tied to one platform and one Python minor version.
06Docker image
app/backend/DockerfileTwo stages: the builder obfuscates, the runtime image gets only the protected build and hash-pinned dependencies. Non-root, read-only code.
07Deployment
docker-compose.yml · deploy/Locally: published on 127.0.0.1 only. On a server: behind Caddy with HTTPS, health checks, log rotation and a restart policy.
08FastAPI API
:8300/health, /api/info (reports the build), /api/analyze, /api/report. Identical answers from both builds.
09Client
curl · the Lab page · your appSees only HTTP. Cannot tell the builds apart except through /api/info, which reports it on purpose.