Skip to main content
Contributions to SuperCompress are welcome — bug fixes, new baseline policies, improved training data, documentation updates, or anything else that improves the library. The project uses pytest for testing and ruff for linting, both of which run automatically in CI on every push and pull request.

Dev environment setup

1

Clone the repository

2

Install all development dependencies

The dev extra adds pytest, ruff, and httpx. The serve extra adds FastAPI and Uvicorn, which are required for test_local_server.py.
3

Verify the test suite passes

All 52 tests should pass on a clean checkout:
Expected output ends with something like:
4

Run the linter

Ruff is configured to check supercompress/, tests/, and scripts/. A clean pass produces no output.

Project layout

Test suites

test_local_server.py requires the serve extra. If you install only .[dev], those tests are automatically skipped — this is expected behaviour, not a failure.

Linting and code style

SuperCompress uses Ruff with the following configuration from pyproject.toml:
This enforces PEP 8 errors (E), Pyflakes (F), import ordering (I), and pycodestyle warnings (W). The scripts/ directory has E402 (module-level import not at top of file) suppressed because the scripts manually prepend the repo root to sys.path.
Run ruff check --fix . to auto-fix import ordering and other safe issues before committing.

CI/CD

GitHub Actions runs the full CI pipeline on every push to main and on every pull request targeting main. The workflow matrix tests Python 3.11 and 3.12. Each CI run executes the following steps in order:
  1. Installpip install -e ".[dev,serve]" and pip install ruff
  2. Ruffruff check supercompress tests scripts
  3. Export browser modelpython scripts/export_model_json.py
  4. Pytestpytest tests/ -q
  5. Benchmark JSONpython scripts/benchmark_web.py
  6. Verify web assets — asserts that web/assets/data/model.json, web/assets/data/benchmarks.json, web/assets/js/compress-engine.js, web/assets/img/chart-kv-savings.svg, web/assets/img/chart-impact.svg, and web/assets/video/launch.mp4 all exist
CI does not run generate_charts.py because SVG generation depends on matplotlib and the chart files are committed to the repository. The verify step only checks that the committed files are present.

Submitting a pull request

Before opening a PR, confirm that:
  • pytest tests/ -q shows 52 passed (or more if you have added tests)
  • ruff check . exits with no errors
  • Any new public function is documented in docs/API.md
  • If you retrained the checkpoint, python scripts/export_model_json.py succeeds and you have committed the updated web/assets/data/model.json

License

SuperCompress is released under the MIT License. By contributing you agree that your changes will be distributed under the same terms.