Contributions to SuperCompress are welcome — bug fixes, new baseline policies, improved training data, documentation updates, or anything else that improves the library. The project usesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/arjunkshah/supercompress/llms.txt
Use this file to discover all available pages before exploring further.
pytest for testing and ruff for linting, both of which run automatically in CI on every push and pull request.
Dev environment setup
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.Verify the test suite passes
All 52 tests should pass on a clean checkout:Expected output ends with something like:
Project layout
| Path | Description |
|---|---|
supercompress/ | Core library — ~5K-param eviction policy, baselines, features, simulator |
supercompress/api/ | Hosted API layer — key management, Firebase auth, usage tracking |
web/ | Static landing page, browser demo, and dashboard |
scripts/ | benchmark_web.py, local_web_server.py, export_model_json.py, generate_charts.py |
tests/ | test_supercompress, test_api_hard, test_api_keys, test_api_server, test_local_server |
checkpoints/default.pt | Trained weights (included in the repo) |
docs/ | API reference, integrations, environment impact, dashboard guide |
Test suites
| File | Coverage |
|---|---|
test_supercompress.py | Core compress_context, compare_policies, CompressResult fields, oracle recall, edge cases |
test_api_hard.py | Hard validation edge cases — invalid budget_ratio, oversized payloads, malformed JSON |
test_api_keys.py | API key generation format (sc_live_…), hashing, and equality checks |
test_api_server.py | FastAPI route behaviour — status codes, response schema, authentication |
test_local_server.py | Full integration tests for the local dev server using httpx.AsyncClient |
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 frompyproject.toml:
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.
CI/CD
GitHub Actions runs the full CI pipeline on every push tomain 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:
- Install —
pip install -e ".[dev,serve]"andpip install ruff - Ruff —
ruff check supercompress tests scripts - Export browser model —
python scripts/export_model_json.py - Pytest —
pytest tests/ -q - Benchmark JSON —
python scripts/benchmark_web.py - 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, andweb/assets/video/launch.mp4all 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/ -qshows 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.pysucceeds and you have committed the updatedweb/assets/data/model.json