Tool to generate python -c bash scripts as if they were a package format.
dashc lets you bundle Python source code (a single file or an entire package) into a executable shell script.
Instead of shipping loose files, you can hand over a bash command (or .sh script) that self-contains your Python logic and runs without needing to touch the filesystem.
Features:
- Single file mode – wrap a single
.pyinto a compressed string or plain text. - Module mode – zip up a package with
__main__.pyor a specifiedmodule:functionentrypoint. - Bash-friendly – outputs either a plain (
python -c '...') or a script with a shebang. - Validates syntax – checks both Python and Bash syntax before generating.
It is recommended to install with pipx:
pipx install dashcThis keeps dashc isolated in its own environment while making the CLI available globally.
Run with:
dashc [--version] [--verbose|--quiet|--dry-run] <command> [options]Global options:
--version– show version--verbose– debug logging--quiet– suppress logs except errors--dry-run– simulate actions without writing files
file– Compile a single.pyinto a script.module– Package a directory and run__main__.pyor a chosen entrypoint.
Single file to script:
dashc file send_email.py --out run_send_email.sh
./run_send_email.sh --to test@example.comSingle file to script:
dashc file send_email.py --one-line
# -> prints a bash command like: python -c '...'Module with __main__.py:
dashc module ./send_email --out run_pkg.sh
./run_pkg.sh --config config.yamlModule with function entrypoint:
dashc module ./send_email --entrypoint send_email.cli:main --out run_cli.sh
./run_cli.sh --to test@example.com- zipapp (
python -m zipapp) – Standard library tool for packaging Python code into.pyzarchives runnable with Python. - shiv, pex – Build self-contained Python executables with full dependency resolution.
- pyinstaller – Freezes Python programs into standalone executables.