Add an indirect dependency check - #25027
Draft
zsol wants to merge 5 commits into
Draft
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 94.36%. The percentage of expected errors that received a diagnostic held steady at 88.82%. The number of fully passing files held steady at 93/134. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-import |
0 | 4 | 0 |
| Total | 0 | 4 | 0 |
Large timing changes:
| Project | Old Time | New Time | Change |
|---|---|---|---|
itsdangerous |
0.04s | 16.91s | +43072% |
rclip |
0.09s | 27.79s | +31524% |
AutoSplit |
0.16s | 29.95s | +19128% |
jinja |
0.11s | 20.25s | +18323% |
hydra-zen |
0.19s | 33.35s | +17887% |
egglog-python |
0.29s | 49.52s | +17150% |
pwndbg |
0.32s | 23.13s | +7226% |
git-revise |
0.08s | 4.76s | +6184% |
pydantic |
0.72s | 30.46s | +4123% |
ibis |
0.53s | 19.04s | +3503% |
isort |
0.25s | 8.00s | +3146% |
strawberry |
0.13s | 2.26s | +1695% |
pytest-robotframework |
0.17s | 2.75s | +1555% |
bidict |
0.06s | 0.92s | +1553% |
starlette |
0.10s | 1.66s | +1525% |
svcs |
0.06s | 0.99s | +1508% |
altair |
0.28s | 4.22s | +1418% |
mongo-python-driver |
0.26s | 3.49s | +1218% |
Tanjun |
0.16s | 1.84s | +1085% |
rotki |
0.58s | 6.50s | +1021% |
attrs |
0.13s | 1.19s | +805% |
django-stubs |
0.19s | 1.68s | +778% |
pylox |
0.08s | 0.72s | +777% |
django-modern-rest |
0.10s | 0.83s | +694% |
werkzeug |
0.14s | 1.01s | +646% |
mypy_primer |
0.09s | 0.60s | +600% |
urllib3 |
0.15s | 0.87s | +500% |
scipy-stubs |
0.51s | 2.88s | +463% |
operator |
0.17s | 0.93s | +444% |
kornia |
0.19s | 1.04s | +442% |
mypy-protobuf |
0.13s | 0.70s | +418% |
docstring-adder |
0.13s | 0.65s | +392% |
zulip |
0.87s | 3.66s | +319% |
ecosystem-analyzer |
0.11s | 0.42s | +287% |
prefect |
1.23s | 4.54s | +270% |
xarray-dataclasses |
0.31s | 0.92s | +200% |
mitmproxy |
0.66s | 1.86s | +182% |
sphinx |
0.31s | 0.70s | +125% |
Raw diff:
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/__init__.py:6:15 error[unresolved-import] Module `prefect` has no member `_build_info`
- src/prefect/_internal/analytics/client.py:19:10 error[unresolved-import] Cannot resolve imported module `prefect._internal.analytics._config`
urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/__init__.py:17:7 error[unresolved-import] Cannot resolve imported module `._version`
- src/urllib3/connection.py:44:7 error[unresolved-import] Cannot resolve imported module `._version`
zsol
force-pushed
the
zsol/meow-indirect
branch
2 times, most recently
from
May 11, 2026 08:56
140c153 to
40cd020
Compare
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.
Note
this is not yet ready for review
This PR adds a check that highlights imports that use dependencies that are not declared directly in
pyproject.toml(but are present in the environment one way or another).Overview
To implement this, a hidden
--dependency-metadatacommand line flag is added to thechecksubcommand, that takes a path to a json file. The json file should be shaped like the output ofuv workspace metadata --sync(which is added in astral-sh/uv#19122 ), and provides:The check collects imports from the current project, resolves each import to a module, maps that module to its owning distribution, and compares that distribution against the current project’s declared direct dependencies. If the imported distribution is missing, ty emits
missing-direct-dependencywith the dependency the user should add.The check is disabled when no dependency metadata is provided.
Nuances
Future work
uv workspace metadata --syncthe right way, instead of expecting the json file -> this way the check will also work in a language server environment