Skip to content

fix: annotate context managers with AsyncGenerator for ty 0.0.85 - #68

Merged
lesnik512 merged 1 commit into
mainfrom
fix/ty-0-0-85
Oct 7, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/ty-0-0-85

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Fixes the scheduled lint-ci failure. Closes #67

ty 0.0.85 ships a typeshed that deprecates the asynccontextmanager overload for functions annotated -> AsyncIterator[T], so ty check now warns on both lifespan functions. Annotating them -> AsyncGenerator[T] uses the non-deprecated overload. The type comes from collections.abc because typing.AsyncGenerator needs both type arguments before Python 3.13.

Changes

  • modern_di_fastapi/main.py: the composed lifespan returns collections.abc.AsyncGenerator[...] instead of typing.AsyncIterator[...].
  • tests/test_lifespan.py: same change for user_lifespan.

Checklist

  • Lint and format pass (ruff)
  • Type check passes (ty)
  • Tests pass and new behavior is covered
  • Build succeeds (uv build) if packaging or build config changed
  • Repo metadata stays consistent across the three surfaces (GitHub description, pyproject description, profile blurb) if this touches packaging

@lesnik512
lesnik512 merged commit 63f041b into main Oct 7, 2026
12 checks passed
@lesnik512
lesnik512 deleted the fix/ty-0-0-85 branch October 7, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduled dependency check failed

1 participant