Easily zip your codebase while excluding unnecessary files like a pro! Say goodbye to bloated archives and hello to clean, lightweight packages. π
-
π― Multiple Presets: Choose from 4 built-in presets for different packaging needs
basic: Exclude common build files and cachesgit-friendly: Keep .git directory but exclude large filescomplete: Exclude all unnecessary files including .gitlightweight: Keep only core source code
-
π§Ή Smart Comment Removal: Remove comments from Python, JavaScript, Java, C/C++ files
-
ποΈ Multiple Compression Methods: Support for deflate, lzma, and bzip2 compression
-
π Detailed Statistics: Get comprehensive packaging statistics
-
π Cross-Platform: Works seamlessly on Windows, macOS, and Linux
-
β‘ Fast & Efficient: Optimized for large codebases with blazing-fast execution
When working with large codebases, manual packaging can be a nightmare. CodePackager simplifies the process by:
- Automatically skipping files you don't need (e.g.,
node_modules,*.log,__pycache__) - Providing flexible preset configurations for different scenarios
- Offering advanced features like comment removal and multiple compression methods
- Keeping your archives clean and deploy-ready
- Saving time and reducing human errors
-
Clone the repository
git clone https://github.com/Deali-Axy/code-packager.git cd code-packager -
Install dependencies
pdm install
# Basic packaging with default preset
python -m src.code_packager /path/to/source output.zip
# Use a specific preset
python -m src.code_packager /path/to/source output.zip --preset git-friendly
# Remove comments and use LZMA compression
python -m src.code_packager /path/to/source output.zip --preset complete --remove-comments --compression lzma
# List all available presets
python -m src.code_packager --list-presetsUsage: python -m src.code_packager [OPTIONS] SOURCE_DIR OUTPUT_ZIP
Arguments:
SOURCE_DIR Source code directory to package
OUTPUT_ZIP Output zip file path
Options:
-p, --preset PRESET Choose preset: basic, git-friendly, complete, lightweight (default: basic)
-c, --config CONFIG Use custom configuration file
-r, --remove-comments Remove comments from source code files
--compression METHOD Compression method: deflate, lzma, bzip2 (default: deflate)
-l, --list-presets List all available presets
-v, --verbose Show detailed output
-h, --help Show help message| Preset | Description | Use Case |
|---|---|---|
basic |
Excludes common build files, caches, and IDE files | General development projects |
git-friendly |
Keeps .git directory but excludes large objects | Sharing projects with version history |
complete |
Excludes everything unnecessary including .git | Final release or distribution |
lightweight |
Keeps only essential source code | Minimal code sharing |
Before packaging:
project/
βββ src/
β βββ main.py
β βββ utils/
β βββ helpers.py
βββ node_modules/ # Excluded
βββ __pycache__/ # Excluded
βββ build/ # Excluded
βββ .git/ # Depends on preset
βββ .vscode/ # Excluded
βββ .gitignore
After packaging (basic preset):
code_package.zip
βββ src/
β βββ main.py
β βββ utils/
β βββ helpers.py
βββ .git/
βββ .gitignore
Supports removing comments from:
- Python (
.py) - JavaScript (
.js,.jsx,.ts,.tsx) - Java (
.java) - C/C++ (
.c,.cpp,.h,.hpp)
Create your own exclusion rules by using the --config option with a custom configuration file.
- deflate: Fast compression, good compatibility (default)
- lzma: Best compression ratio, slower
- bzip2: Good balance between speed and compression
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For bug reports and feature requests, please open an issue.
This project is licensed under the MIT License. See LICENSE for details.
Made with β€οΈ by DealiAxy