Contributing to Redline¶
Thank you for considering it. This document is the whole of what you need: how to get a working environment, how to run the checks, how the packages relate, and the conventions the codebase enforces.
By participating you agree to the Code of Conduct.
The layout¶
One repository, one uv workspace, five distributions released in lockstep:
| Directory | Distribution | Module | Depends on |
|---|---|---|---|
packages/redline-core |
redline-core |
redline_core |
nothing (ships the bundled UI) |
packages/django-redline |
django-redline |
django_redline |
core (exact pin), Django |
packages/fastapi-redline |
fastapi-redline |
fastapi_redline |
core (exact pin), FastAPI, SQLAlchemy |
packages/flask-redline |
flask-redline |
flask_redline |
core (exact pin), Flask, SQLAlchemy |
packages/litestar-redline |
litestar-redline |
litestar_redline |
core (exact pin), Litestar, SQLAlchemy |
Plus the React frontend (frontend/), the shared documentation site (mkdocs.yml,
docs/), runnable examples (examples/django, examples/fastapi, examples/flask), benchmarks
(benchmarks/) and helper scripts (scripts/).
Where does a change go? If it is about what the profiler records or reports (trace model, recorder, SQL fingerprinting, detectors, EXPLAIN analysis, storage, redaction, the JSON API, the load tester), it belongs in the core, and every adapter picks it up. If it is about how a framework talks to the core (middleware, SQL hooks, URL routing, management commands, fix suggesters for an ORM), it belongs in that adapter. The core imports no framework, ever.
Set up¶
That creates .venv/ with all three packages installed in editable mode plus the dev
tools. Prefix commands with uv run; there is no need to activate anything.
Run the tests¶
Each package has its own pytest configuration (pytest-django needs a settings module that the others must not see), so the suites run one per package. From the repository root:
uv run python scripts/run_tests.py # all five packages, one summary
uv run python scripts/run_tests.py core flask # a subset
uv run python scripts/run_tests.py core -- -x -k n_plus_one # extra pytest arguments
uv run python scripts/run_tests.py --cov # with coverage
or one package directly, from its directory:
Release checks that need the network: scripts/check_clean_install.py (fresh-venv install
from PyPI or built wheels) and scripts/check_store_upgrade.py (a store written by an
older release opens with this one); the Compatibility workflow runs both weekly.
To measure overhead on your own app over HTTP, see benchmarks/real_app.py.
Postgres-only tests (EXPLAIN against a real server) skip cleanly when no Postgres server is available, and they say so in the output.
Frontend¶
The UI is a React 19 + Vite + TypeScript + Tailwind app in frontend/. Its build output
is committed into packages/redline-core/src/redline_core/ui/static/, so the wheels
ship a ready-made bundle and users never need Node.js.
After changing anything under frontend/, rebuild the bundle:
CI fails if the committed bundle is stale, so always commit the rebuilt static files together with the source change.
Lint and format¶
Build the docs¶
uv run --with mkdocs-material mkdocs serve
uv run --with mkdocs-material mkdocs build --strict # what CI runs
The site is published to https://pythondeveloper6.github.io/redline/ by
.github/workflows/docs.yml when changes land on main.
Conventions this codebase enforces¶
- The request path never raises into the application. Capture failures are logged (rate-limited) and the request continues unaffected. A test should prove any new failure mode does the same.
- The recorder costs nothing when inactive. Anything that runs on every query or
every request must short-circuit when no trace is active. Benchmarks in
benchmarks/guard this. - Captured data is redacted before it is stored. Anything that reaches the store
passes through
redact.py. Adding a new capture point means adding it to the redaction tests. - Storage is separate from the application database. Redline never writes to the
app's own database. New stores must pass the store contract tests in
redline_core. - Lockstep versions. All five packages carry the same version and the adapters pin
redline-core==that version.scripts/check_versions.pyenforces it.
Commit messages¶
Say what changed and why in the body. The history is the design record.
Releasing¶
Releases are cut by the maintainer. The packages are not on PyPI yet, so users install from GitHub; this repository contains no PyPI publish automation. Only the documentation is deployed automatically (to GitHub Pages).