Skip to content

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Jul 1, 2025

Summary

Temporarily modify UseDefMapBuilder::reachability for star imports in order for new definitions to pick up the right reachability. This was already working for UseDefMapBuilder::place_states, but not for UseDefMapBuilder::reachable_definitions.

closes astral-sh/ty#728

Test Plan

Regression test

@sharkdp sharkdp added the ty Multi-file analysis & type inference label Jul 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2025

mypy_primer results

Changes were detected when running on open source projects
alerta (https://github.com/alerta/alerta)
- TOTAL MEMORY USAGE: ~106MB
+ TOTAL MEMORY USAGE: ~117MB

rich (https://github.com/Textualize/rich)
-     memo fields = ~106MB
+     memo fields = ~117MB

trio (https://github.com/python-trio/trio)
- error[invalid-type-form] src/trio/_core/_run.py:138:41: List literals are not allowed in this context in a type expression: Did you mean `list[BaseExcT]`?
- error[invalid-type-form] src/trio/_core/_run.py:1344:28: List literals are not allowed in this context in a type expression
+ warning[unused-ignore-comment] src/trio/_core/_run.py:1510:59: Unused blanket `type: ignore` directive
- error[invalid-type-form] src/trio/_core/_run.py:1512:27: List literals are not allowed in this context in a type expression
+ warning[unused-ignore-comment] src/trio/_core/_run.py:1739:54: Unused blanket `type: ignore` directive
- error[invalid-type-form] src/trio/_core/_run.py:1737:40: List literals are not allowed in this context in a type expression
- error[invalid-type-form] src/trio/_core/_run.py:1737:50: List literals are not allowed in this context in a type expression: Did you mean `tuple[()]`?
- error[invalid-type-form] src/trio/_core/_run.py:1738:44: List literals are not allowed in this context in a type expression
- error[invalid-type-form] src/trio/_core/_run.py:1738:54: List literals are not allowed in this context in a type expression: Did you mean `tuple[()]`?
- error[invalid-type-form] src/trio/_core/_run.py:1933:28: List literals are not allowed in this context in a type expression
- error[invalid-type-form] src/trio/_core/_run.py:2065:28: List literals are not allowed in this context in a type expression
- error[invalid-type-form] src/trio/_core/_run.py:2132:28: List literals are not allowed in this context in a type expression
- error[invalid-argument-type] src/trio/_core/_run.py:2685:48: Argument is incorrect: Expected `bool`, found `@Todo(Support for `typing.TypeAlias`) | Literal[0] | list[Unknown]`
+ error[invalid-argument-type] src/trio/_core/_run.py:2685:48: Argument is incorrect: Expected `bool`, found `@Todo(Support for `typing.TypeAlias`) | list[Unknown]`
- Found 890 diagnostics
+ Found 882 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
-     memo fields = ~207MB
+     memo fields = ~189MB

pylox (https://github.com/sco1/pylox)
-     memo fields = ~54MB
+     memo fields = ~49MB

paasta (https://github.com/yelp/paasta)
-     memo fields = ~171MB
+     memo fields = ~156MB

freqtrade (https://github.com/freqtrade/freqtrade)
-     memo fields = ~304MB
+     memo fields = ~276MB

static-frame (https://github.com/static-frame/static-frame)
-     memo fields = ~334MB
+     memo fields = ~304MB

openlibrary (https://github.com/internetarchive/openlibrary)
-     memo fields = ~171MB
+     memo fields = ~189MB

rotki (https://github.com/rotki/rotki)
-     memo fields = ~490MB
+     memo fields = ~445MB

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- TOTAL MEMORY USAGE: ~717MB
+ TOTAL MEMORY USAGE: ~652MB

@sharkdp sharkdp force-pushed the david/fix-728 branch 2 times, most recently from 8aad0c5 to 6279ef2 Compare July 1, 2025 08:38
@sharkdp sharkdp marked this pull request as ready for review July 1, 2025 08:41
@sharkdp
Copy link
Contributor Author

sharkdp commented Jul 1, 2025

Merging this without review because #18955 depends on it, and I'd like to see the updated ecosystem results.

@sharkdp sharkdp merged commit 7d468ee into main Jul 1, 2025
36 checks passed
@sharkdp sharkdp deleted the david/fix-728 branch July 1, 2025 09:06
iyakushev pushed a commit to iyakushev/ruff that referenced this pull request Jul 1, 2025
…ps (astral-sh#19066)

## Summary

Temporarily modify `UseDefMapBuilder::reachability` for star imports in
order for new definitions to pick up the right reachability. This was
already working for `UseDefMapBuilder::place_states`, but not for
`UseDefMapBuilder::reachable_definitions`.

closes astral-sh/ty#728

## Test Plan

Regression test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nonlocal names do not respect star-import reachability constraints

2 participants