A basic Python source code bundler that combines multiple Python files into a single executable file.
PyBundler is a simple tool that helps you bundle multiple Python files into a single file. It's particularly useful for basic projects with straightforward import structures.
ProjectRoot/
βββ models/
β βββ user.py
β βββ product.py
βββ services/
β βββ auth.py
β βββ data.py
βββ utils/
β βββ helpers.py
βββ main.py
- β¨ Combines multiple Python files into a single file
- π Provides basic dependency analysis
- π Handles simple import structures
- π Generates bundle statistics
- π¨ Maintains code readability with section headers
- Does not support complex circular dependencies
- May not handle all import patterns correctly
- Limited support for certain Python features
- Not recommended for production use with complex projects
- May not work with dynamic imports or complex package structures
Basic usage example:
python -m pybundler -p ./project_folder -f main.py -o bundled_output.py
-p, --path
: Path to the source folder containing your Python files-f, --file
: Main Python file (entry point)-o, --output
: Output file path for the bundled code-v, --verbose
: Enable verbose logging (optional)
python -m pybundler -p ./MyProject/src/ -f main.py -o ./dist/bundle.py
The bundler will generate a single Python file that:
- Contains all the necessary code from your project
- Preserves imports from standard library and third-party packages
- Includes section headers for better code organization
- Provides statistics about the bundling process
This project is in early stages and contributions are welcome. Feel free to submit issues and pull requests.
MIT License - see LICENSE file for details.
This is a basic implementation intended for simple use cases. For production applications or complex projects, consider using more robust packaging solutions like PyInstaller or cx_Freeze.
Made with β€οΈ by Steven