fix: declare typing-extensions and packaging as runtime dependencies - #257
Merged
Merged
Conversation
that_depends imports typing_extensions at module level in most modules, and the faststream integration imports packaging, but neither was declared, so a clean install failed on import. Add a test that every top-level third-party import is a declared requirement, and drop the zero-dependencies claim.
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Declaring typing-extensions changed the lowest-direct resolution in the floors job. That exposed faststream>=0.3.14 as a false floor: on 0.3.14 and 0.4.x DIContextMiddleware cannot be constructed, and the suite needs 0.5.19. On Python 3.14 the floors job only installs wheels, so pydantic must be 2.12+, which needs typing-extensions>=4.14.1. The packaging test now reads pyproject.toml, because the floors job does not install the project itself.
…verywhere Skipping it on 3.10 dropped coverage below the 100% gate.
5 of 6 tasks
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
that_dependsimportstyping_extensionsat module level in most modules, but the package declared no runtime dependencies, sopip install that-dependsfollowed byimport that_dependsfails withModuleNotFoundErroron a clean environment (reproduced on 3.10 and 3.11). It only worked where something else had already installedtyping-extensions.The new packaging test found a second case:
integrations/faststream.pyimportspackaging, which faststream does not depend on, sothat-depends[faststream]failed the same way.Declaring the dependency was chosen over keeping the package zero-dependency: staying dependency-free would mean moving
override,Self,TypeIsandTypeVardefaults behindTYPE_CHECKINGor version checks across about 15 modules, andtyping-extensionsis already present in nearly every environment.Changes
typing-extensions>=4.14.1is a runtime dependency, removed from the dev group. The code itself needs 4.10 (TypeIs) on 3.10-3.12 and 4.12.0 on 3.13+ (older releases fail with'__default__' of 'typing.TypeVar' objects is not writable). The floor is 4.14.1 because the floors job installs wheels only, and on 3.14 the first pydantic with wheels (2.12) requires it; any lower floor makes the resolver fall back to pydantic 1, which breaks faststream.faststream>=0.5.19(was 0.3.14). On 0.3.14 and 0.4.xDIContextMiddlewarecannot be constructed (BaseMiddleware.__init__() missing ... 'msg'), and the test suite needsbroker.requestfrom 0.5.19. Main's floors job never caught this: faststream 0.3.14 fails to import next to current pydantic, sotests/integrations/faststreamwas skipped.packagingis added to thefaststreamextra.tests/test_packaging.py: every top-level third-party import in core modules must be an unconditional requirement, and every one inintegrations/must be declared at least in an extra. It readspyproject.tomlbecause the floors job does not install the project; on 3.10 it usestomli, added to the dev group.docs/dev/main-decisions.mdrecords the decision.Known gap, unchanged by this PR: the floors job still skips the faststream tests on every Python, because faststream 0.5.19 cannot import next to pydantic 2.13.
Checklist
ruff)mypyandpyrefly)uv build) if packaging or build config changed: built wheels install and import in clean 3.10 (core) and 3.12 ([faststream]) venvsdescription, profile blurb) if this touches packaging: descriptions unchanged