skills/pyapp/SKILL.md
Use when building standalone Python executables with PyApp, bundling Python runtimes, preparing air-gapped or multi-architecture binaries, patching PyApp defaults, or compiling single-binary assets.
npx skillsauth add cofin/flow pyappInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enable building self-contained, air-gapped, multi-architecture standalone executables for any Python application using PyApp and uv.
Standard pyapp installation bootstraps the environment on first run, which usually requires internet access. For air-gapped or network-isolated environments, you must embed the entire Python distribution and its dependencies ahead of time.
This skill documents the Bundle-Patch-Compile workflow:
site-packages, and repackage.Instead of installing at runtime, we build a hybrid distribution:
python-build-standalone).site-packages via uv pip install --target.In your pyproject.toml, configure the Hatch target or custom builder to use specific variables.
[tool.hatch.build.targets.binary]
scripts = ["myapp"]
pyapp-version = "v0.29.0"
[tool.hatch.build.targets.binary.env]
PYAPP_DISTRIBUTION_EMBED = "1"
PYAPP_FULL_ISOLATION = "1"
PYAPP_ALLOW_UPDATES = "1"
</example>
To enable fully offline operations, follow these steps using an automation script (see scripts/bundler.py):
install_only_stripped version for the Target Rust arch (e.g., x86_64-unknown-linux-gnu).uv pip install with specific cross-compilation flags:
--target <extracted_python_site_packages>--python-platform <uv_supported_platform>--upgrade.tar.gz.By default, PyApp stores user data in standard local data folders. If you require strict isolation (e.g., ~/.myapp), you can patch the PyApp source code just before cargo build:
# Conceptual example of patching src/app.rs
import re
content = app_rs.read_text()
pattern = re.compile(r"platform_dirs\(\)\s*\.data_local_dir\(\)...")
replacement = "std::path::PathBuf::from(\"~/.myapp\")"
app_rs.write_text(pattern.sub(replacement, content))
</example>
To maintain maximum glibc backward-compatibility (e.g., supporting RHEL 7+ / manylinux2014 baseline):
cargo zigbuild --release --target <target>.2.17Ensure your GitHub Action includes:
.whl files.x86_64-linux-gnu, aarch64-linux-gnu, aarch64-apple-darwin, etc.).[!TIP] Always test inside a non-networked container:
docker run --network none -v $(pwd):/app ubuntu:20.04 /app/myapp-binary --help
scripts/bundler.py (in this skill directory)examples/release-action.yml (in this skill directory)cargo zigbuild --target <arch>.2.17 to ensure compatibility with older Linux distributions (e.g., RHEL 7+).PYAPP_DISTRIBUTION_EMBED = "1" to ensure the binary is fully self-contained and does not require internet access on first run..pyc, __pycache__, tests) to keep the executable manageable.
</guardrails>
--network none) environmentldd --version on the target platformsite-packagesdevelopment
Use when tracing execution paths, mapping dependencies, understanding unfamiliar code, following data flow, investigating end-to-end behavior, debugging call chains, or deciding which files to read next.
development
Use when reviewing authentication, authorization, user input, secrets, API keys, database queries, file uploads, session management, external API calls, OWASP risks, or data handling attack surface.
testing
Use when analyzing tradeoffs, comparing approaches, weighing options, assessing risks, stress-testing conclusions, identifying blind spots, or applying multiple viewpoints to a decision.
development
Use when reviewing hot paths, slow code, database queries, N+1 risks, memory usage, loops, I/O, caching strategy, concurrency, latency-sensitive paths, or resource efficiency.