Contributing¶
Contributing to FluxLit¶
Thanks for helping improve FluxLit.
Setup¶
git clone https://github.com/eddiethedean/fluxlit.git
cd fluxlit
python -m pip install -e ".[dev]"
Public API stability¶
Refactors should keep the documented public surface stable unless you are shipping a semver breaking release (see Releases below).
Stable: symbols exported from
src/fluxlit/__init__.py, thefluxlitCLI entrypoint (src/fluxlit/cli.py), and documented kwargs onFluxLit,build_gateway,run_unified, and related settings types.Internal: names prefixed with a single leading underscore (e.g.
_proxy_httpused only in tests), anything under afluxlit._*package if introduced later, and modules not listed in__all__. Prefer extending behavior via new optional parameters or new public helpers rather than renaming stable entrypoints.
Quality checks¶
ruff check src tests
ruff format src tests
python -m pytest -n auto -m "not slow"
python -m mypy src/fluxlit
ty (Astral static analysis) is required in CI via the ty-check workflow job (ty check, pinned ty version; install pip install -e ".[dev,metrics]" locally so optional imports resolve). Run ty check from the repo root before pushing when you touch typed code. For stricter checking on tests/ (same rules as src/), run ty check --config-file ty.strict-tests.toml (may report many diagnostics until tests are tightened).
Coverage: fast CI runs use --cov-fail-under=100 on src/fluxlit (see docs/testing.md). Locally: pytest -n auto -m "not slow" --cov=fluxlit --cov-report=term-missing --cov-fail-under=100.
Documentation (Sphinx)¶
Hosted on Read the Docs once the project is connected to this repository. User-facing guides include docs/deployment.md (containers, probes, scaling), docs/troubleshooting.md, docs/production-tls.md (TLS, HSTS, forwarded_allow_ips, CSP notes, path-prefixed mounts such as /apps/my-app), docs/secrets.md (logs, secret stores, JWT/OIDC rotation), and runnable nginx + FluxLit stacks under docker/proxy-deployment/ (validated by run-all-proxy-smokes.sh in CI).
Build locally:
python -m pip install -e ".[docs]"
sphinx-build -b html docs docs/_build/html
Open docs/_build/html/index.html in a browser. Configuration lives in docs/conf.py; .readthedocs.yaml drives RTD builds.
Testing notes¶
Full guide: docs/testing.md (coverage, e2e / slow markers, Playwright, proxy smoke, fast suite highlights). Dev reload: fluxlit dev --reload --reload-scope=full restarts Streamlit on changes; default gateway reloads FastAPI only — see docs/cli.md.
Prefer FluxLit’s wrapper
FluxLitTestClientfor gateway-level API tests (so prefix stripping and/healthzbehavior are exercised through the gateway).Use Streamlit’s built-in
streamlit.testing.v1.AppTestfor UI tests where possible (version-dependent).
Design constraints¶
Keep FluxLit sidecar-first (Streamlit subprocess + gateway) until an embedded ASGI story is proven stable.
Avoid adding opinionated “magic” around FastAPI and Streamlit—prefer small, composable helpers.
Treat WebSocket proxy stability as a first-class requirement.
Reload behavior¶
fluxlit dev --reload uses Uvicorn’s reloader on the gateway factory only. The Streamlit child process is not restarted automatically; document this when changing runtime or UX code paths.
Security¶
Report undisclosed vulnerabilities privately per
SECURITY.md(GitHub Security Advisories), not via a public issue.CI runs
pip-auditonpip install -e ".[auth]"and uploads a CycloneDX JSON SBOM for the same environment (artifactcyclonedx-sbomon thesecurity-auditworkflow run). See SECURITY.md for download notes.httpxupgrades:ApiClientmirrorshttpx.Client.requesttypes viahttpx._types/httpx._client. After bumping httpx, run the full test suite;tests/test_httpx_import_contract.pyfails early if those private modules no longer export the expected names.Optional local dependency audit (same scope as CI — core +
auth):python -m pip install pip-audit python -m pip install -e ".[auth]" pip-audit
For a broader scan (includes dev/docs/Streamlit transitive deps), install
".[dev,auth,docs]"beforepip-audit.When you change
examples/docker_compose/requirements.in, regeneraterequirements.txtwithpip-compile(see that example’s README) so the Docker image stays reproducible.
Releases (maintainers)¶
For a PyPI / tag release of FluxLit itself:
CHANGELOG — add a dated section under
CHANGELOG.md(move items from Unreleased if present).Version — bump
versioninpyproject.toml(semver 0.x; document breaking changes in CHANGELOG). Keepsrc/fluxlit/__init__.py__version__identical so imports andfluxlit doctorstay consistent; CI’s docs job regeneratesdocs/_generated/setup.txtfromimportlib.metadata.version("fluxlit"), which must match the committed file afterpip install -e ..Upgrade note — if CLI, env, import behavior, or defaults changed, add a short “Upgrading from X.Y.Z” note in CHANGELOG (commands to run, renamed env vars, removed shims, and test-layout notes).
Tag —
git tag vX.Y.Zafter merge to the release branch /mainper your workflow.Read the Docs — confirm the stable build points at the new tag when applicable.
Examples lockfile — bump
examples/docker_compose/requirements.in(for examplefluxlit>=0.13,<1.0) and runuv pip compile examples/docker_compose/requirements.in -o examples/docker_compose/requirements.txtso the pinned example matches installable releases. If that range is not on PyPI yet, runuv build -o /tmp/fluxlit-wheelsand add--find-links /tmp/fluxlit-wheelsto the compile command (see the comment block inrequirements.in).
Before tagging, run the canonical smoke app once locally when runtime or deployment behavior changed:
./scripts/run_smoke_app.sh
BASE_URL=http://127.0.0.1:8000 PATH_SUFFIX=/api/smoke COUNT=50 ./scripts/soak_http.sh
Support expectations for Python and dependencies are summarized in docs/support-matrix.md.
Public-facing polish checklist¶
Before merging changes that affect user-visible behavior, check the public surface for drift:
README and docs entry points — keep
README.md,docs/index.md, anddocs/quickstart.mdaligned on install commands, default port (8000), API prefix (/api), and the recommended first run.Roadmap and changelog — when a feature moves from planned to shipped, update both
CHANGELOG.mdandROADMAP.md; avoid leaving “TBD” or “not implemented yet” language for released behavior.Examples — verify example READMEs use the gateway URL FluxLit prints, not Streamlit’s internal sidecar port.
Generated snippets — regenerate
docs/_generated/snippets when CLI help or setup output changes.Links — prefer relative links inside repository Markdown; use canonical GitHub URLs when the rendered docs need to point readers back to source files, workflows, or security advisories.
Pull requests¶
Include tests when changing routing/runtime behavior.
Update docs (
README.md,docs/,PLAN.md,ROADMAP.md) when you change public behavior.