Skip to content

Conversation

@github-actions
Copy link
Contributor

Close and reopen this PR to trigger CI

@github-actions github-actions bot added the internal An internal refactor or improvement label Apr 15, 2025
@github-actions github-actions bot requested a review from dcreager as a code owner April 15, 2025 00:30
@carljm carljm closed this Apr 15, 2025
@carljm carljm reopened this Apr 15, 2025
@github-actions
Copy link
Contributor Author

github-actions bot commented Apr 15, 2025

mypy_primer results

Changes were detected when running on open source projects
packaging (https://github.com/pypa/packaging)
+ error[lint:unsupported-operator] /tmp/mypy_primer/projects/packaging/src/packaging/_tokenizer.py:39:26: Operator `|` is unsupported between objects of type `Literal[str]` and `GenericAlias`
+ error[lint:unsupported-operator] /tmp/mypy_primer/projects/packaging/src/packaging/_tokenizer.py:101:26: Operator `|` is unsupported between objects of type `Literal[str]` and `GenericAlias`
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:38:38: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:39:37: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:40:40: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:55:55: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:56:52: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_musllinux.py:57:58: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/_musllinux.py:30:25: Argument `major` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/_musllinux.py:30:48: Argument `minor` does not match any known parameter of function `__new__`
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_parser.py:83:36: Too many positional arguments to function `__new__`: expected 1, got 5
- error[lint:non-subscriptable] /tmp/mypy_primer/projects/packaging/src/packaging/metadata.py:286:68: Cannot subscript object of type `Literal[list]` with no `__class_getitem__` method
- error[lint:unsupported-operator] /tmp/mypy_primer/projects/packaging/src/packaging/metadata.py:302:20: Operator `|` is unsupported between objects of type `Literal[str]` and `Literal[list]`
- error[lint:non-subscriptable] /tmp/mypy_primer/projects/packaging/src/packaging/metadata.py:302:26: Cannot subscript object of type `Literal[list]` with no `__class_getitem__` method
- error[lint:non-subscriptable] /tmp/mypy_primer/projects/packaging/src/packaging/metadata.py:303:25: Cannot subscript object of type `Literal[list]` with no `__class_getitem__` method
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:206:13: Argument `epoch` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:207:13: Argument `release` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:208:13: Argument `pre` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:209:13: Argument `post` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:212:13: Argument `dev` does not match any known parameter of function `__new__`
- error[lint:unknown-argument] /tmp/mypy_primer/projects/packaging/src/packaging/version.py:213:13: Argument `local` does not match any known parameter of function `__new__`
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:195:36: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:198:36: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:201:36: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:231:39: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:234:43: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:245:58: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/src/packaging/_manylinux.py:254:64: Too many positional arguments to function `__new__`: expected 1, got 2
+ error[lint:unsupported-operator] /tmp/mypy_primer/projects/packaging/src/packaging/metadata.py:302:20: Operator `|` is unsupported between objects of type `Literal[str]` and `GenericAlias`
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:493:72: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:563:72: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:642:50: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:643:51: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:644:46: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:645:48: Too many positional arguments to function `__new__`: expected 1, got 2
- error[lint:too-many-positional-arguments] /tmp/mypy_primer/projects/packaging/tests/test_tags.py:682:72: Too many positional arguments to function `__new__`: expected 1, got 2
- Found 348 diagnostics
+ Found 318 diagnostics

@sharkdp
Copy link
Contributor

sharkdp commented Apr 15, 2025

The tests are failing because line numbers in typeshed have changed, and so we need to update some diagnostics snapshots that show code snippets from typeshed (referencing the function that was called). I guess we could look into ignoring linenumber-only changes automatically somehow via insta redactions, if it turns out to be annoying.

Or we could auto-update snapshots in the typeshed CI workflow, but the we would need to carefully review the diffs (outside the vendored typeshed folder).

@sharkdp
Copy link
Contributor

sharkdp commented Apr 15, 2025

The ecosystem changes are somewhat obscure. We now emit fewer false positives on NamedTuple construction, but for the wrong reasons.

  • In drop py38 support in builtins python/typeshed#13762, Python 3.8 support was dropped.
  • This included a change in class tuple, which previously had a sys.version_info-guarded __class_getitem__ method:
    if sys.version_info >= (3, 9):
            def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
    that was now changed to be unconditionally available:
    def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
  • It took me a while to understand why this had any effect, since I was sure we used 3.9 by default. And we do, in MDtests. And we also use 3.9 in the CLI by default. But in mypy_primer, we run Red Knot from inside the ruff repository. Which means that we pick up the requires-python bound here:
    requires-python = ">=3.7"
    (Edit: that is not true. This is just something that confused me locally, when I was running Red Knot via cargo run --bin red_knot from the ruff repository). But if the project has a requires-python bound that is set to a lower version, we will use 3.7 or 3.8.

I will merge this PR, as it is not the source of the problem. But I think that we need to change something here. We should probably drop support for 3.7 and 3.8? And maybe we should also change the requires-python discovery in such a way that it doesn't pick up a pyproject.toml from CWD if explicit paths outside the CWD are specified?! Not sure. (CC @MichaReiser)

@sharkdp sharkdp merged commit 4894f52 into main Apr 15, 2025
23 checks passed
@sharkdp sharkdp deleted the typeshedbot/sync-typeshed branch April 15, 2025 07:16
@AlexWaygood
Copy link
Member

Apparently this typeshed update sped up the cold benchmark by 3%, and the micro benchmark by 2%: https://codspeed.io/astral-sh/ruff/branches/typeshedbot%2Fsync-typeshed. I guess that's because we create fewer visibility-constraint predicates in builtins and other modules heavily used by tomllib, now that typeshed's dropped support for Python 3.8?

dcreager added a commit that referenced this pull request Apr 15, 2025
* main: (31 commits)
  [red-knot] Add some knowledge of `__all__` to `*`-import machinery (#17373)
  Update taiki-e/install-action digest to be7c31b (#17379)
  Update Rust crate mimalloc to v0.1.46 (#17382)
  Update PyO3/maturin-action action to v1.49.1 (#17384)
  Update Rust crate anyhow to v1.0.98 (#17380)
  dependencies: switch from `chrono` to `jiff`
  Update Rust crate bstr to v1.12.0 (#17385)
  [red-knot] Further optimize `*`-import visibility constraints (#17375)
  [red-knot] Minor 'member_lookup_with_policy' fix (#17407)
  [red-knot] Initial support for `dataclass`es (#17353)
  Sync vendored typeshed stubs (#17402)
  [red-knot] improve function/bound method type display (#17294)
  [red-knot] Move relation methods from `CallableType` to `Signature` (#17365)
  [syntax-errors] `await` outside async functions (#17363)
  [red-knot] optimize is_subtype_of for literals (#17394)
  [red-knot] add a large-union-of-string-literals benchmark (#17393)
  Update pre-commit dependencies (#17383)
  [red-knot] mypy_primer: Fail job on panic or internal errors (#17389)
  [red-knot] Document limitations of diagnostics-silencing in unreachable code (#17387)
  [red-knot] detect unreachable attribute assignments (#16852)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants