Contributing & Development Setup¶
This guide covers local polyglot workspace setup, verification commands, and architectural conventions for contributors working on Litestar Vite (Python) and litestar-vite-plugin (TypeScript).
Prerequisites¶
- Python: 3.10 or newer managed with
uv - Node.js:
20+(or22+LTS) withnpm - Vite:
7.0.0+(enforced across all runtime and test suites)
Workspace Installation¶
Clone the repository and install both the Python virtual environment (all dependency groups) and TypeScript workspace packages:
Build the TypeScript plugin artifacts (dist/) and Python wheel/sdist before running integration tests:
Verification & Quality Gates¶
| Gate | Command | What It Checks |
|---|---|---|
| Python Unit & Integration Tests | NO_PROXY=localhost,127.0.0.1,::1 uv run pytest |
Full Python test suite (src/py/tests/) |
| TypeScript Contract & Unit Tests | npm test |
Vitest suite (npx vitest run --config ./src/js/vitest.config.ts) |
| Format & Auto-Fix | make fix |
uv run ruff format + Biome formatting across Python and TypeScript |
| Static Type & Lint Gate | make check |
ruff, mypy, pyright, slotscheck, biome, and tsc --noEmit |
| Docstring & Field Hygiene | uv run python tools/docs/scan_public_docstrings.py |
Enforces 1-sentence PEP 257 inline field docstrings, zero duplicate Attributes: blocks, and zero rST syntax |
| CLI & TypeScript Auto-Docs | uv run python tools/docs/generate_cli_docs.py --check && uv run python tools/docs/generate_ts_docs.py --check |
Verifies docs/reference/cli.md and docs/reference/typescript/*.md match live source |
| Documentation Snippet Gate | DOCS_EXAMPLES_STRICT=1 uv run python tools/check_docs_examples.py |
Validates fenced code blocks in docs/**/*.md and executes docs/examples/**/*.py |
| Full Documentation Build Gate | uv run python tools/docs/verify_docs_artifacts.py --strict-warnings |
Runs documentation build, postbuild.py, HTML size/TOC budgets, and redirect checks |
Running Example Applications Locally¶
The examples/ directory contains full runnable applications for every supported framework and operating mode (react, react-inertia, vue, vue-inertia, svelte, sveltekit, nuxt, astro, angular, htmx, jinja-htmx):
uv run litestar --app-dir examples/vue-inertia assets install
uv run litestar --app-dir examples/vue-inertia run --reload
Architectural Guardrails¶
- Google-Style Docstrings & Inline Field Docstrings: All public Python classes, functions, and
@dataclass/TypedDictattributes use concise Markdown Google-style docstrings and PEP 257 inline"""..."""field docstrings (0inline#comments in Python source files). - Single-Port AnyIO Streaming Proxy:
ViteProxyMiddleware(src/py/litestar_vite/handler/_proxy.py) usesanyio.connect_tcpandwsprotofor WebSocket HMR andhttpx2for pooled HTTP proxying. - Granian
StaticPlacement.NATIVECompatibility: Static metadata blocking (BLOCKED_STATIC_METADATA_FILES) and immutable caching use picklable slotted router-level hooks (_StaticBeforeRequestHook,_StaticAfterRequestHook) soStaticFilesConfig.has_asgi_overrides()staysFalse. - Private OpenAPI Seam: All access to Litestar's internal OpenAPI schema builders is confined to
src/py/litestar_vite/codegen/_openapi.py. - Documentation Structure: The documentation site is configured in
zensical.tomlwith custom styling indocs/stylesheets/extra.css, branding assets indocs/assets/logo.svganddocs/assets/favicon.svg, and reference generators undertools/docs/.