docs: add "Writing an integration" guide#253
Merged
Merged
Conversation
Agent-facing spec for authoring official modern-di integrations, distilled from the FastAPI/FastStream/Litestar/Typer/pytest packages: the five-point integration contract, lifecycle and scope-mapping rules, a per-framework realization table, repo scaffolding, and a checklist. Adds the page to the Integrations nav. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Frameworks without a per-handler injection seam (Typer/Click, argparse, task runners) can't use the native-marker FromDI path. Document the decorator injection pattern generalized from modern-di-typer's @Inject: inert FromDI marker, decoration-time signature rewrite, call-time resolution, plus the pitfalls (setting __signature__, stripping only DI params, decorator order, ctx.meta isolation). Splits FromDI into two modes, adds a dedicated section and table, and a checklist item. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a published docs page, Integrations → Writing an integration, aimed at agents authoring official modern-di integrations.
The guide is distilled from the five existing integration packages (
modern-di-fastapi,-faststream,-litestar,-typer,-pytest) and covers:ContextProviders,setup_di,fetch_di_container, per-unit-of-work child-container builder,FromDI+Dependencyresolver), each with signature and responsibility.ContainerClosedError), always close the child infinally,close_async/close_syncmatching.main.py+ re-exporting__init__.py,pyproject.tomlshape, test layout, mirrored tooling, and a docs/nav entry in this repo.Adds the page to the
mkdocs.ymlIntegrations nav.Verification
just docs-build(mkdocs build --strict) passes — broken links or nav warnings would fail the strict build.🤖 Generated with Claude Code