Overview
Add a first-class Litestar adapter to component-framework, giving Litestar users the same ergonomics as the existing FastAPI and Django adapters.
Background
FastAPI and Django adapters ship today. Flask (#5) and Litestar (this issue) were identified as gap in #4 during the 0.3.0 dependency refactor.
Required Components
1. Optional Extras Group
Add a [litestar] optional extras group in pyproject.toml:
[project.optional-dependencies]
litestar = ["litestar>=2.0"]
2. Adapter Module (adapters/litestar.py)
LitestarRenderer subclass of Renderer using Litestar's template engine
- HTTP endpoint handler (mirrors
adapters/fastapi.py structure)
- ImportError guard at module top using
_require_extra("litestar", "litestar")
3. Optional WebSocket Handler (adapters/litestar_websocket.py)
- Async WebSocket consumer following the FastAPI WebSocket adapter pattern
- ImportError guard advertising
[litestar] extra
4. Test File (tests/test_litestar_adapter.py)
pytest.importorskip("litestar", ...) skip guard
- Adapter-level tests mirroring
test_fastapi_adapter.py
5. Documentation
- Add Litestar to the Adapter Support table in README.md
- Add install instructions:
pip install "component-framework[litestar]"
- Add example in
examples/litestar_example.py
Constitution Adapter Contract
Per the project constitution (Adapter Contract principle), this adapter must:
- Live entirely in
adapters/ — zero changes to core/
- Ship with its own optional extras group
- Have ImportError guards with actionable messages
- Be covered by its own CI isolation matrix row
Reference
Overview
Add a first-class Litestar adapter to component-framework, giving Litestar users the same ergonomics as the existing FastAPI and Django adapters.
Background
FastAPI and Django adapters ship today. Flask (#5) and Litestar (this issue) were identified as gap in #4 during the 0.3.0 dependency refactor.
Required Components
1. Optional Extras Group
Add a
[litestar]optional extras group inpyproject.toml:2. Adapter Module (
adapters/litestar.py)LitestarRenderersubclass ofRendererusing Litestar's template engineadapters/fastapi.pystructure)_require_extra("litestar", "litestar")3. Optional WebSocket Handler (
adapters/litestar_websocket.py)[litestar]extra4. Test File (
tests/test_litestar_adapter.py)pytest.importorskip("litestar", ...)skip guardtest_fastapi_adapter.py5. Documentation
pip install "component-framework[litestar]"examples/litestar_example.pyConstitution Adapter Contract
Per the project constitution (Adapter Contract principle), this adapter must:
adapters/— zero changes tocore/Reference
src/component_framework/adapters/fastapi.py