Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 2.18 KB

README.md

File metadata and controls

49 lines (36 loc) · 2.18 KB

batify - Package Python scripts into standalone .bat files for easy sharing and execution

alt text

A basic tool for creating Windows batch (.bat) files that contains Python code.

Rationale

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.

Features

  • 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 and UV to use Python/uv that is not in the path
  • Allows specifying custom pypi host

Examples

  • Only standard libraries: Use this for scripts with no external dependencies.
  • Requirements file: Include external dependencies by specifying a requirements.txt file.
  • PEP 723 support: Embed dependencies directly into your Python script (requires Python 3.11 or later).

Run batify --help for more options

Inspiration

Alternative

  • uvx: A versatile tool for running standalone Python scripts.
  • pipx: Focuses on isolated installation of Python applications.
  • PyInstaller: Converts Python applications into standalone executables.