Skip to content

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

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 #48

ty 0.0.85 bundles a typeshed that deprecates the asynccontextmanager overload for functions annotated -> AsyncIterator[T], so ty check reported two deprecated warnings.

Changes

  • modern_di_starlette/main.py: _compose_lifespan's inner composed now returns collections.abc.AsyncGenerator[...].
  • tests/test_lifespan.py: same change for user_lifespan; the typing import was left unused and is removed.

collections.abc is used because typing.AsyncGenerator needs both type arguments before Python 3.13.

Checklist

  • just lint-ci passes locally with ty 0.0.85 (it failed with the two warnings before the change)
  • just test passes locally (15 passed)

@lesnik512
lesnik512 merged commit 62a34a0 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