A basic tool for creating Windows batch (.bat) files that contains Python code.
This tool simplifies the process of sharing Python scripts in a Windows environment by encapsulating all necessary setup into a single, executable batch file. It ensures that less tech-savvy users can run complex Python programs without needing to manually set up virtual environments or install dependencies, requiring only Python to be pre-installed.
- Everything is self-contained, only one .bat file
- Only update dependencies if needed
- Allows specifying requirements directly in the Python file using PEP 723 (Python 3.11+ required)
- Uses uv if available
- Allows specifying environment variables
PYTHON
andUV
to use Python/uv that is not in the path - Allows specifying custom pypi host
- Only standard libraries: Use this for scripts with no external dependencies.
- hello_world.py
batify -s examples/hello_world.py
- Requirements file: Include external dependencies by specifying a requirements.txt file.
- hello_world.py
- requirements.txt
batify -s examples/hello_world_req.py -r examples/requirements.txt
- PEP 723 support: Embed dependencies directly into your Python script (requires Python 3.11 or later).
- hello_world_pep723.py
batify -s examples/hello_world_pep723.py
Run batify --help
for more options
- uvx: A versatile tool for running standalone Python scripts.
- pipx: Focuses on isolated installation of Python applications.
- PyInstaller: Converts Python applications into standalone executables.