Command-line interface¶
The fluxlit console script (or python -m fluxlit) is built with Typer.
Setup¶
fluxlit version: 0.13.3
CLI help (real output)¶
fluxlit --help
Usage: fluxlit [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ dev Run the unified stack for local development (Streamlit subprocess │
│ + Uvicorn gateway). │
│ shutdown Stop ``fluxlit dev`` or ``fluxlit run`` using the PID file they │
│ write. │
│ run Run the unified stack for production-style use (no Uvicorn │
│ reload). │
│ workbench Run the unified stack for Posit Workbench / Posit Connect-style │
│ path proxies. │
│ doctor Print PASS/WARN/FAIL diagnostics (imports, deps, bind, env). │
│ config Print effective FluxLit configuration after precedence rules │
│ (env, project file, app). │
│ build Emit a minimal ``Dockerfile`` and ``.dockerignore`` for container │
│ deployment. │
│ new Create ``<name>/app.py`` with a sample API route and Streamlit │
│ home page. │
│ pages Streamlit page tooling. │
╰──────────────────────────────────────────────────────────────────────────────╯
Tip
fluxlit dev — local development; optional --reload and --reload-scope. fluxlit run — production-style process (no reloader). fluxlit workbench (or --workbench on dev / run) — Posit Workbench / Connect-style proxy headers plus a printed loopback URL hint. All start the same gateway + Streamlit stack.
Resolving target¶
The optional [target] argument is a module:attribute import path (e.g. app:app) pointing at your FluxLit instance.
Resolution order:
Explicit CLI argument, if given.
targetfromfluxlit.tomlor[tool.fluxlit]inpyproject.toml(if present).Literal
app:app.
The working directory should be the project root so Python can import the module. Use PYTHONPATH or pip install -e . for src-layout packages.
Commands¶
Command |
Description |
|---|---|
|
Development: Streamlit subprocess + gateway. See reload options below. |
|
Production-style: same stack, no Uvicorn reload. |
|
Same as |
|
Static diagnostics (imports, bind, env); |
|
Effective resolved settings (redacted), binding, and warnings; |
|
Writes |
|
Creates |
|
Stops a running |
Common options (dev / run)¶
--host,--port,--log-level--debug— setsFLUXLIT_DEBUG=1before loading the app (gateway access logs, API request logging, default log leveldebugwhen stillinfo,GET /__fluxlit/debug,get_clientrequest-id propagation); see Configuration and Troubleshooting--workbench— Posit Workbench / Connect-style: enable Uvicornproxy_headersand print loopback URL hints (see Platform recipes)--proxy-headers,--forwarded-allow-ips(Uvicorn / reverse proxy trust)--pidfile/--no-pidfile— PID file path forfluxlit shutdown(default file orFLUXLIT_PIDFILE; skip with--no-pidfileorFLUXLIT_NO_PIDFILE=1)
Environment-only knobs (no matching CLI flag) still apply: for example FLUXLIT_UVICORN_GRACEFUL_SHUTDOWN_TIMEOUT_S, when set, is forwarded to Uvicorn as timeout_graceful_shutdown — see Deployment and Configuration.
shutdown¶
fluxlit shutdown sends SIGTERM to the process recorded in the PID file (then optional SIGKILL with --force after --wait seconds). Use the same working directory and --pidfile as the server, or set FLUXLIT_PIDFILE to an absolute path.
On Windows, --force runs taskkill /T /F (POSIX uses SIGKILL). If shutdown still fails, use Task Manager or taskkill manually.
Doctor¶
fluxlit doctor prints one line per check with PASS, WARN, or FAIL.
Exits
1if any check is FAIL, unless--warnings-onlyis set (then always 0).WARN does not fail the run; fix when practical (Streamlit version, proxy trust on subpaths, etc.).
--strictupgrades selected WARN checks to FAIL:forwarded_allow_ipswhentrust_proxyis on butFLUXLIT_FORWARDED_ALLOW_IPSis unset or*,public_base_urlwhen its URL path does not matchroot_path/ public mount,public_base_url_precedencewhen bothPUBLIC_BASE_URLandFLUXLIT_PUBLIC_BASE_URLdiffer,oauth_public_base_urlwhen a subpath is set withoutpublic_base_url,proxy_headerswhen a subpath is set withouttrust_proxy,gateway_max_proxy_bodywhentrust_proxyis on with unlimited proxied body size,gateway_upstream_timeoutswhen the HTTP read timeout is very low,gateway_forward_rejected_nameswhen the forward allowlist contains rejected names, and CORS + security headers mismatch. Use in CI when you want production-style gates without treating every advisory as blocking.Use
--jsonin CI or deployment scripts for a stable machine-readable shape:
fluxlit doctor app:app --json
With --verbose (or -v), plain-text mode prints an extra Verbose section after the
check table (redacted settings, resolved bind, discovered pages, OpenAPI paths, URL-session
env flags, and short hints). Combine with --json to add a top-level verbose object
(same redacted snapshot) for machines.
The JSON object contains status, target, warnings_only, and a checks array
with name, status, and detail for each diagnostic. With --verbose, it also
includes verbose (omit --verbose to keep JSON minimal).
Doctor checks are additive. Current diagnostics include import resolution, the loaded
module file path, the first few sys.path entries, ambiguous app / main candidates,
gateway bind availability, effective API prefix, URL-session test/disable state, proxy
fields, public-base-url precedence, optional auth/metrics extras, Streamlit upstream
state when available, readiness route shape, WebSocket upgrade expectations, gateway
upstream timeout hints, async page-depends posture, optional client-header forwarding
(including gateway_forward_rejected_names when the allowlist names headers that
are never forwarded), and (with --verbose) a compact gateway_proxy summary
block (timeouts, max proxied body bytes, max concurrent upstream HTTP, forward-header list).
fluxlit config mirrors related WARN rows (for example rejected forward-header
names and trust_proxy with an unlimited proxied upload body cap); use --strict
in CI to fail on warnings — see Cookbook.
Reload (dev only)¶
--reload enables Uvicorn’s file watcher. Scope is controlled by --reload-scope:
Value |
Behavior |
|---|---|
|
Only the ASGI gateway process reloads; Streamlit keeps running. |
|
Gateway reload and Streamlit sidecar restart on changes (uses |
Example:
fluxlit dev --reload --reload-scope=full
full is best-effort dev ergonomics; for production use fluxlit run without reload.
Unknown scopes are rejected by the CLI and again in the runtime before the Streamlit subprocess starts.
build¶
--output/-o— directory for generated files (default: current directory).--force/-f— overwrite existingDockerfile/.dockerignore.The
targetembedded inCMDfollows the same resolution rules as other commands.
The template ships with a digest-pinned python:3.12-slim base and USER appuser (UID 1000). For production, add your own dependency lockfile (pip-tools, uv, Poetry export, etc.); see Deployment and examples/docker_compose/ for a pip-compile example. You can still switch to multi-stage builds or a different base by editing the generated files.
Entry point¶
The Typer application lives in fluxlit.cli; the console script calls main().