feat: five modern-Python patterns — catalog complete at 32 units - #8
Merged
Conversation
New group patterns/modern/: - dependency_injection (pythonic) — Protocol seams, kwarg defaults; sorted(key=), json.dumps(cls=) - repository (use-with-care) — Protocol + in-memory fake + sqlite impl - context_manager (pythonic) — __enter__/__exit__, @contextmanager, ExitStack - registry (pythonic) — decorator-filled dispatch dict; codecs - async_producer_consumer (use-with-care) — asyncio.Queue + TaskGroup with backpressure and tested shutdown; thread version for contrast Adds pytest-asyncio (auto mode). 211 tests; ruff/mypy --strict clean; all 96 demos run as modules. Co-Authored-By: Claude Fable 5 <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.
Phase 9 — the planned catalog is complete: 32 units (1 principle + 3 Python-native + 23 GoF + 5 modern).
sorted(key=),json.dumps(cls=)sqlite3impl beside the in-memory fakecontextlib.ExitStackcodecsregistryasyncio.Queue+TaskGroupDeps:
pytest-asyncio(dev, auto mode).Gates: ruff ✅ mypy
--strict✅ pytest 211 ✅ all 96 demos run (python -m patterns.<group>.<slug>.<variant>) ✅🤖 Generated with Claude Code