DEV Community

Cover image for Standalone Python CLI Distribution Made Simple
crimson206
crimson206

Posted on

Standalone Python CLI Distribution Made Simple

Want to share your Python CLI tool with non-technical users? Let's make it simple - no Python installation required!

Why Standalone Binaries?

Traditional Python CLI tools depend on the Python environment present during installation. For more reliable service delivery, sometimes we need to distribute a standalone package with Python compiled into it.

Quick Solution

I've created a template repository that handles all the complexity for you:
python-standalone-binary

This template provides:

  • A simple example CLI implementation
  • Installation scripts
  • Release workflow
  • Cross-platform support (Linux, Windows, macOS)

With these tools, you can easily distribute standalone Python CLI binaries on GitHub using a simple installation command:

curl -fsSL https://raw.githubusercontent.com/{user}/{repo}/main/scripts/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Try Our Example

Want to see it in action? Test our example CLI with these commands:

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/crimson206-templates/python-standalone-binary/main/scripts/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Windows (PowerShell)

irm https://raw.githubusercontent.com/crimson206-templates/python-standalone-binary/main/scripts/install.ps1 | iex
Enter fullscreen mode Exit fullscreen mode

Running the CLI

  • Linux/macOS: Simply type example-cli in your terminal
  • Windows: The installer will show "Installed to: {path}"
    • Example path: C:\path-to\example-cli.exe
    • Run the shown path in PowerShell

Deploying Your Own CLI

The release action is configured to run automatically when version tags are pushed.

To deploy this example in your own repository:

  1. Fork the repository:
   gh repo fork crimson206-templates/python-standalone-binary
Enter fullscreen mode Exit fullscreen mode
  1. Create a release:
   source scripts/tagging.sh v0.1.0
Enter fullscreen mode Exit fullscreen mode
  1. After the action completes successfully, test your deployment:
   # Linux/macOS
   curl -fsSL https://raw.githubusercontent.com/{user}/python-standalone-binary/main/scripts/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Resources

Ready to make your Python CLI more accessible? Check out the template repository and start building!

Top comments (0)