Skip to content

πŸ”§A basic Python source code bundler that combines multiple .py files into a single executable file. Simple and lightweight, best for basic project structures.

License

Notifications You must be signed in to change notification settings

mwarcc/PyBundler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PyBundler

A basic Python source code bundler that combines multiple Python files into a single executable file.

⚠️ Important Note: This is a basic implementation with limitations. It may not work with complex project structures or certain import patterns.

Overview

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.

Supported Project Structure Example

ProjectRoot/
    β”œβ”€β”€ models/
    β”‚   β”œβ”€β”€ user.py
    β”‚   └── product.py
    β”œβ”€β”€ services/
    β”‚   β”œβ”€β”€ auth.py
    β”‚   └── data.py
    β”œβ”€β”€ utils/
    β”‚   └── helpers.py
    └── main.py

Features

  • ✨ 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

Limitations

  • 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

Usage

Basic usage example:

python -m pybundler -p ./project_folder -f main.py -o bundled_output.py

Arguments

  • -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)

Example

python -m pybundler -p ./MyProject/src/ -f main.py -o ./dist/bundle.py

Output

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

Development

This project is in early stages and contributions are welcome. Feel free to submit issues and pull requests.

License

MIT License - see LICENSE file for details.

Disclaimer

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

About

πŸ”§A basic Python source code bundler that combines multiple .py files into a single executable file. Simple and lightweight, best for basic project structures.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages