Skip to content

fix: declare typing-extensions and packaging as runtime dependencies - #257

Merged
lesnik512 merged 3 commits into
mainfrom
fix/declare-typing-extensions
Oct 3, 2026
Merged

lesnik512 merged 3 commits into
mainfrom
fix/declare-typing-extensions

Conversation

@lesnik512

@lesnik512 lesnik512 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Summary

that_depends imports typing_extensions at module level in most modules, but the package declared no runtime dependencies, so pip install that-depends followed by import that_depends fails with ModuleNotFoundError on a clean environment (reproduced on 3.10 and 3.11). It only worked where something else had already installed typing-extensions.

The new packaging test found a second case: integrations/faststream.py imports packaging, which faststream does not depend on, so that-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, TypeIs and TypeVar defaults behind TYPE_CHECKING or version checks across about 15 modules, and typing-extensions is already present in nearly every environment.

Changes

  • typing-extensions>=4.14.1 is 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.x DIContextMiddleware cannot be constructed (BaseMiddleware.__init__() missing ... 'msg'), and the test suite needs broker.request from 0.5.19. Main's floors job never caught this: faststream 0.3.14 fails to import next to current pydantic, so tests/integrations/faststream was skipped.
  • packaging is added to the faststream extra.
  • tests/test_packaging.py: every top-level third-party import in core modules must be an unconditional requirement, and every one in integrations/ must be declared at least in an extra. It reads pyproject.toml because the floors job does not install the project; on 3.10 it uses tomli, added to the dev group.
  • README, AGENTS.md: drop the zero-dependency claim. docs/dev/main-decisions.md records 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

  • Lint and format pass (ruff)
  • Type check passes (mypy and pyrefly)
  • Tests pass and new behavior is covered
  • Build succeeds (uv build) if packaging or build config changed: built wheels install and import in clean 3.10 (core) and 3.12 ([faststream]) venvs
  • Docs updated if behavior or public API changed
  • Repo metadata stays consistent across the three surfaces (GitHub description, pyproject description, profile blurb) if this touches packaging: descriptions unchanged

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

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tests/test_packaging.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@lesnik512
lesnik512 merged commit 8d7c068 into main Oct 3, 2026
18 checks passed
@lesnik512
lesnik512 deleted the fix/declare-typing-extensions branch October 3, 2026 09:39
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.

1 participant