Problem
fastapi, uvicorn, and jinjax are currently listed as core (mandatory) dependencies in pyproject.toml:
dependencies = [
"fastapi>=0.109.0",
"uvicorn[standard]>=0.27.0",
"jinjax>=0.41",
"pydantic>=2.0", # ← only this belongs here
]
This forces Django users (and any future Flask/Litestar users) to install FastAPI, Uvicorn, and JinjaX even when they will never use them. A Django app using django-cotton for templating must still pull in FastAPI and JinjaX as transitive baggage.
Root-cause analysis
The core package (component_framework/core/) has no imports from fastapi, uvicorn, or jinjax. Those imports exist only inside the adapter files:
| File |
Imports |
adapters/fastapi.py |
from fastapi import ... |
adapters/fastapi_websocket.py |
from fastapi import ... |
adapters/jinjax_renderer.py |
from jinjax import Catalog |
Neither __init__.py is non-empty, so there are no eager re-exports that would force the adapters to load at install time. The fix is purely a pyproject.toml change.
Proposed fix
Move framework-specific packages to optional extras and keep only pydantic as a hard dependency:
dependencies = [
"pydantic>=2.0",
]
[project.optional-dependencies]
fastapi = [
"fastapi>=0.109.0",
"uvicorn[standard]>=0.27.0",
"jinjax>=0.41",
]
django = [
"django>=4.2",
"django-cotton>=0.9",
"channels>=4.0",
"channels-redis>=4.1",
]
websockets = [
"websockets>=12.0",
]
dev = [...]
Install examples:
pip install component-framework[fastapi] # FastAPI + JinjaX
pip install component-framework[django] # Django + Channels
pip install component-framework[fastapi,django] # both
Note: This is a minor breaking change for users who relied on implicit FastAPI availability. Should be released in 0.3.0 or with a deprecation path.
Missing adapters
The project currently has no adapters for:
- Flask — widely used WSGI framework; would need a renderer + event dispatcher + optional flask-sock for WebSockets
- Litestar (formerly Starlite) — ASGI, similar surface to FastAPI, growing adoption
These can be tracked as follow-on issues once the optional-extras refactor lands.
CI impact
The test matrix should be updated to verify each extra in isolation (e.g. a [fastapi]-only install doesn't accidentally import django, and vice versa).
Problem
fastapi,uvicorn, andjinjaxare currently listed as core (mandatory) dependencies inpyproject.toml:This forces Django users (and any future Flask/Litestar users) to install FastAPI, Uvicorn, and JinjaX even when they will never use them. A Django app using
django-cottonfor templating must still pull in FastAPI and JinjaX as transitive baggage.Root-cause analysis
The core package (
component_framework/core/) has no imports fromfastapi,uvicorn, orjinjax. Those imports exist only inside the adapter files:adapters/fastapi.pyfrom fastapi import ...adapters/fastapi_websocket.pyfrom fastapi import ...adapters/jinjax_renderer.pyfrom jinjax import CatalogNeither
__init__.pyis non-empty, so there are no eager re-exports that would force the adapters to load at install time. The fix is purely apyproject.tomlchange.Proposed fix
Move framework-specific packages to optional extras and keep only
pydanticas a hard dependency:Install examples:
Note: This is a minor breaking change for users who relied on implicit FastAPI availability. Should be released in 0.3.0 or with a deprecation path.
Missing adapters
The project currently has no adapters for:
These can be tracked as follow-on issues once the optional-extras refactor lands.
CI impact
The test matrix should be updated to verify each extra in isolation (e.g. a
[fastapi]-only install doesn't accidentally import django, and vice versa).