Contributions are warmly welcomed! This guide outlines how to set up your development environment and submit changes.
- Operating System: macOS or Linux (for development)
- Python: 3.x (Python 2 support removed in v5.0.0)
- Rust: 1.63+ (for pngquant v3, see https://rustup.rs)
- Build Tools: make, git, standard C/C++ compiler (for zopfli)
- Testing: tox, black, shellcheck-py (installed via pip), pngcheck (installed via Homebrew)
- Platypus (for macOS GUI app development): https://sveinbjorn.org/platypus
-
Clone the repository:
$ git clone https://github.com/AkatQuas/Crunch.git $ cd Crunch -
Create a Python virtual environment (recommended):
$ python3 -m venv .venv $ source .venv/bin/activate -
Install Python testing dependencies:
$ pip install -r requirements.txt
-
Install system dependencies:
$ brew install pngcheck
-
Build project dependencies (pngquant v3 and zopflipng):
$ make build-dependencies
This runs
src/install-dependencies.shwhich builds:- pngquant v3 - built using Rust/Cargo (requires Rust 1.63+)
- zopflipng - built using Make
-
Verify installation:
$ crunch --version
The macOS GUI application is built using Platypus with the profile/Crunch.platypus configuration file. To rebuild the app:
- Install Platypus:
brew install platypusor download from https://sveinbjorn.org/platypus - Load profile
profile/Crunch.platypusinto Platypus - Click "Create App" to generate
Crunch.app
After Crunch.app is created, you can build the DMG installer:
$ make build-macos-icns # Build macOS icon set (optional)
$ make build-macos-installer # Create DMG installer from Crunch.appNote: The create-dmg tool is required to build the DMG installer.
- For local development (
make build-macos-installer), use: https://github.com/sindresorhus/create-dmg - For distribution builds (
make dist), use: https://github.com/create-dmg/create-dmg
Install via:
$ npm install -g create-dmg-
Python: Follow PEP 8, formatted with
black$ black src/crunch.py
-
Shell: Use shellcheck for validation
$ make test-shell
Run the full test suite:
$ make testIndividual test targets:
$ make test-python # Python unit tests + black
$ make test-shell # shellcheck validation
$ make test-valid-png-output # Verify PNG output validityCompare optimization results:
$ make benchmark- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes with clear commit messages
- Test your changes:
make test - Submit a pull request against
master
- All tests pass (
make test) - Code formatted with
black(Python) - Shell scripts pass
shellcheck - New features documented
- No regression in benchmark results (if applicable)
Use the GitHub issue tracker to report bugs or request features. For bugs, include:
- Operating system and version
- Crunch version (
crunch --version) - Steps to reproduce
- Expected vs actual behavior
- Sample PNG file (if possible)
- Update
ARCHITECTURE.mdfor structural changes - Update
docs/*.mdfor user-facing documentation
By contributing to Crunch, you agree that your contributions will be licensed under the MIT License.