feat(examples): canonical minimal-DI example + README link - #8
Merged
Conversation
Rolls the faststream-piloted canonical-example pattern to modern-di-celery: a runnable examples/app.py (Settings + GreetingService via @inject/FromDI), a smoke test exercising it eagerly, and the README Usage example: link.
CI floats ruff to latest (unpinned lint dep); 0.16.0's markdown docstring-code-format tightens comment/statement spacing that 0.15.x left alone. Mechanical, no semantic change.
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.
Summary
examples/app.py(+examples/__init__.py): the smallest runnable celery app —Settings(APP scope) +GreetingService(REQUEST scope, auto-injected by type) wired into one@app.task+@injecttask viatyping.Annotated[GreetingService, FromDI(Dependencies.service)],setup_di(app, container). Usesbroker="memory://", backend="cache+memory://"(same no-extra-dep transporttests/conftest.pyalready uses) since even eagerapply_asyncresolves the transport class up front.tests/test_example.py: eager-mode smoke test (mirrorstests/conftest.py'sappfixture idiom) asserting the task's real return value; coversexamples/app.pyto 100% (no coverage exclusion).Usage example: [examples/](./examples)line, matching the merged faststream pilot's placement.pyproject.toml: addsCPY001to the ruff ignore list (no per-file copyright header), matching the faststream pilot.planning/changes/2026-07-25.01-canonical-example-onramp.md: design-lane change file recording the rollout and thecurrent_apppollution fix.Follows the locked pattern from the merged faststream pilot.
Test plan
just test-ci— 100% coverage, 14 passedjust lint-ci— cleanjust check-planning— OKuvx ruff@0.16.0 check --no-fix .— cleanuvx ruff@0.16.0 format --check .— clean (only pre-existing, unrelated drift in README.md/an older planning doc, present on main before this branch)🤖 Generated with Claude Code