py-to-exe
Convert Python scripts to standalone executables with one command. Zero config.
Why py-to-exe?
Existing tools like PyInstaller are powerful but painful:
- Missing imports — hours of
--hidden-importdebugging loops - Cryptic errors — stack traces instead of solutions
- Too many flags — 20+ options when you just want an exe
- No guidance — trial and error is the only workflow
py-to-exe wraps PyInstaller with smart defaults and automatic fixes:
pip install py-to-exe[pyinstaller]
py-to-exe your_script.py
That's it. Your executable is in ./dist/.
Features
- One command —
py-to-exe script.pyhandles everything - Auto dependency detection — scans your imports, adds hidden imports automatically
- GUI auto-detect — detects tkinter/PyQt/wx and hides the console window
- Human error messages — translates PyInstaller errors into "what happened + how to fix it"
- Environment checks —
py-to-exe doctorvalidates your setup before you build - Interactive mode — run
py-to-exewith no arguments for a guided walkthrough
Installation
pip install py-to-exe[pyinstaller]
Requires Python 3.10 or newer.
Quick Start
One-command build
# Build your script (output in ./dist/)
py-to-exe app.py
# See what would happen without building
py-to-exe app.py --dry-run
# Check your environment first
py-to-exe doctor
Interactive mode
Run without arguments for a step-by-step guide:
py-to-exe
py-to-exe v0.1.0
Python script to convert: app.py
Analyzing dependencies...
✓ Found imports: requests
✓ Auto-added hidden imports for: certifi, charset_normalizer, idna, urllib3
Output name (app):
Show console window? [y/n] (y):
Package as single file? [y/n] (n):
Output directory (./dist):
▸ Building...
✓ Done! Output: ./dist/app/app (4.2s)
Usage
Common options
py-to-exe app.py --name MyApp # Custom executable name
py-to-exe app.py --icon app.ico # Custom icon
py-to-exe app.py --onefile # Single file (default: directory)
py-to-exe app.py --no-console # Hide console (auto for GUI apps)
py-to-exe app.py -o ./build # Custom output directory
py-to-exe app.py --add-data "data/:data/" # Include data files
py-to-exe app.py --hidden-import foo # Add hidden imports manually
py-to-exe app.py -v # Verbose output
Environment doctor
# Check Python version, virtual env, and PyInstaller
py-to-exe doctor
# Also check a specific script
py-to-exe doctor app.py
How it works
- Analyze — Scans your script's AST for imports, matches against a database of known hidden imports
- Detect — Identifies GUI frameworks (tkinter, PyQt, wx) and auto-configures console settings
- Build — Calls PyInstaller with optimized defaults
- Translate — If the build fails, maps the error to a human-readable fix
Comparison
| Feature | py-to-exe | PyInstaller | auto-py-to-exe |
|---|---|---|---|
| Zero-config build | Yes | No (many flags) | GUI required |
| Auto hidden imports | Yes | No | No |
| Human error messages | Yes | No | No |
| GUI auto-detection | Yes | No | Manual |
| Environment doctor | Yes | No | No |
| Interactive mode | Yes (TUI) | No | Yes (GUI) |
FAQ
How do I convert a Python script to an exe?
Install py-to-exe and run one command:
pip install py-to-exe[pyinstaller]
py-to-exe your_script.py
Why does my exe get flagged as a virus?
PyInstaller's packaging method can trigger antivirus false positives. This happens because the self-extracting format resembles patterns used by some malware. Options:
- Use
--onefilesparingly (directory mode triggers fewer alerts) - Sign your executable with a code signing certificate
- Submit false positive reports to your antivirus vendor
How do I reduce the exe file size?
- Use a virtual environment to avoid bundling unnecessary packages
- The minimum size is ~15-25 MB (Python runtime itself)
- Run
py-to-exe doctorto verify you're in a clean virtual environment
Can I build a Windows exe on macOS or Linux?
No. You must build on the target platform. For cross-platform builds, use GitHub Actions:
# .github/workflows/build.yml
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install py-to-exe[pyinstaller]
- run: py-to-exe your_script.py
py-to-exe vs PyInstaller
py-to-exe uses PyInstaller under the hood. It adds automatic dependency detection, human-readable errors, and zero-config defaults. If you need full control over every PyInstaller option, use PyInstaller directly.
py-to-exe vs auto-py-to-exe
auto-py-to-exe is a GUI wrapper for PyInstaller. py-to-exe is a CLI wrapper with smart defaults. Choose auto-py-to-exe if you prefer a graphical interface. Choose py-to-exe if you want a one-command workflow or CI/CD integration.
Limitations
- Platform-specific builds — Must build on the target OS (no cross-compilation)
- Antivirus false positives — Cannot be fully eliminated with PyInstaller
- Dynamic imports —
__import__(var)/importlib.import_module()need manual--hidden-import - Minimum size ~15-25 MB — Python runtime itself sets the floor
- PyInstaller only (v0.1) — Nuitka support planned for v0.2
Contributing
Contributions welcome! Areas that need help:
- Adding more packages to the hidden imports database
- Testing on Windows and Linux
- Error pattern coverage
License
MIT
Metadata
Release files for smart-py-to-exe 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smart_py_to_exe-0.1.0.tar.gz | 14.1 kB | Without provenance | Details for smart_py_to_exe-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smart_py_to_exe-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for smart_py_to_exe-0.1.0-py3-none-any.whl |
Total release size: 29.7 kB
Release files / smart_py_to_exe-0.1.0.tar.gz
| Download URL | smart_py_to_exe-0.1.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bc8f3bd838e234398ba1bc1fc7e787c335343a0fea9ad7048a745b1132a7d7e
|
|
BLAKE2b-256 checksum How to use checksums |
f45f309436110192adcc0da086687f507c737b4c6c55a862f14043664a2353c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / smart_py_to_exe-0.1.0-py3-none-any.whl
| Download URL | smart_py_to_exe-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6375894d6dcf50280fc7bd4edab8889f20a99ec19b11a2fb7a50b0eee32a64be
|
|
BLAKE2b-256 checksum How to use checksums |
ae1c8189aef92ce8c543bcc016c019f1713c7c3d6fec2b02e4c6540309c045c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for smart-py-to-exe 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.