$ show ofek/pyapp
PyApp is a Rust-based CLI tool that builds standalone executables for Python applications. At build time, it embeds a Python distribution (CPython or PyPy) and the target Python project (as a wheel, source distribution, or dependency file) into a single binary. At runtime, the binary bootstraps itself by extracting the Python distribution, creating a virtual environment (or using full isolation), installing the project (optionally via pip or uv), and executing the specified Python code (module, script, notebook, or arbitrary code). It exposes optional management commands for cache management, metadata display, pip invocation, Python shell, self-update, and removal. The architecture is a monolith with clear module separation: build script (build.rs), runtime initialization (app.rs), distribution handling, compression, process management, and network download. The codebase is well-structured, uses modern Rust patterns (edition 2021, anyhow for error handling, clap for CLI), and includes comprehensive CI/CD pipelines. It is not a data research project; it is a packaging and deployment tool for Python applications.
The LLM identified 2 files worth highlighting for reuse:
Provides two reusable low-level file utilities: `acquire_lock` that implements cross-process file locking with a try-lock-first-then-block-with-spinner pattern (using `fs4` crate), and `move_temp_file` that handles atomic file moves across filesystem boundaries by falling back to copy+delete. Both are self-contained, demonstrate careful error handling, and can be extracted into a separate library with minimal modification. The locking pattern is non-obvious and valuable for any application requiring resource synchronization.
Contains `wait_for` for spawning a command, piping stdout+stderr, and returning captured output with a progress spinner, and `exec` which replaces the current process on Unix (using `execvp`) or spawns and exits on Windows, with a special GUI mode that detaches. The `wait_for` function demonstrates a clean pattern for running setup commands with visual feedback, and the Unix `exec` is a non-obvious pattern for launcher tools. Both are loosely coupled (depend only on `os_pipe` and `indicatif`) and could be reused as a small utility crate for command execution.