Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions planning/releases/2.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# modern-di-flask 2.1.0 — adopt the modern-di integration kit

Maintenance release. **No public API change** — `FromDI`, `inject`,
`setup_di`, `fetch_di_container`, and `flask_request_provider` keep their
signatures and behavior. Swaps this package's hand-rolled connection
dispatch and marker resolution for the shared primitives in
[`modern_di.integrations`](https://github.com/modern-python/modern-di/blob/main/architecture/integration-kit.md),
shipped in
[modern-di 2.28.0](https://github.com/modern-python/modern-di/releases/tag/2.28.0).
Fifth of 13 planned adapter conversions across the `modern-di` ecosystem
(after
[`modern-di-starlette` 2.2.0](https://github.com/modern-python/modern-di-starlette/releases/tag/2.2.0),
[`modern-di-fastapi` 2.10.0](https://github.com/modern-python/modern-di-fastapi/releases/tag/2.10.0),
[`modern-di-litestar` 2.13.0](https://github.com/modern-python/modern-di-litestar/releases/tag/2.13.0),
and
[`modern-di-aiohttp` 2.2.0](https://github.com/modern-python/modern-di-aiohttp/releases/tag/2.2.0)).
The simplest conversion so far: Flask has exactly one connection type and is
fully synchronous.

## Internal refactors

- **`_enter_request` now derives scope/context via
`integrations.bind(flask_request_provider, connection)`** instead of
hand-writing `scope=Scope.REQUEST, context={Request: connection}`. Flask
has no WebSocket counterpart, so there's only ever one provider — no
`classify_connection` dispatch is needed anywhere.
- **No `Container` context-manager block is introduced.** Flask's
`before_request`/`teardown_appcontext` stay two separate hook callbacks,
unchanged in shape — unlike the middleware-wrapping pattern used in the
starlette/fastapi/litestar/aiohttp conversions.
- **`_FromDI`/`_parse_inject_params` are gone.** `FromDI =
integrations.from_di`; `inject` now composes
`integrations.parse_markers`/`integrations.resolve_markers`.
- **The three hand-written `"__modern_di_injected__"` string-attribute
touch points are now `integrations.is_injected`/`integrations.mark_injected`** —
same underlying attribute name, so this is a behavioral no-op.

## Packaging

- Bumps the `modern-di` floor to `>=2.28,<3`.

## Downstream

No action needed — the public API (`FromDI`, `inject`, `setup_di`,
`fetch_di_container`, `flask_request_provider`) is unchanged. Upgrading
only requires `modern-di>=2.28.0`.

## Internals

- 100% line coverage; `ruff`, `ty` clean across Python 3.10–3.14.
- Built via `subagent-driven-development`: 4 planned tasks, each with an
independent spec+quality review; a whole-branch review before merge.