Skip to content

[red-knot] Early return from project.is_file_open for vendored files#17580

Merged
MichaReiser merged 1 commit intomainfrom
micha/is-file-open
Apr 23, 2025
Merged

[red-knot] Early return from project.is_file_open for vendored files#17580
MichaReiser merged 1 commit intomainfrom
micha/is-file-open

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Apr 23, 2025

This is partially addresses astral-sh/ty#114

It avoids reading files or open_file_set, which both have low durability for typeshed files. This prevents downgrading typeshed queries to durability low if we happen to emit a diagnostic in them.

Ideally, we'd also short-circuit for third-party files but it's less clear to me how we would do that while supporting open-file-set (we could check the included_paths). That's why I decided to only optimize this for typeshed for now.

The incremental benchmarks improve by 2% which suggests that we try to emit diagnostics for at least some typeshed files.

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Apr 23, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 23, 2025

mypy_primer results

No ecosystem changes detected ✅

@MichaReiser MichaReiser marked this pull request as ready for review April 23, 2025 13:01
@MichaReiser MichaReiser changed the title [red-knot] Try to early return from project.is_file_open [red-knot] Early return from project.is_file_open for vendored files Apr 23, 2025
@MichaReiser MichaReiser merged commit 8abf93f into main Apr 23, 2025
34 checks passed
@MichaReiser MichaReiser deleted the micha/is-file-open branch April 23, 2025 13:32
dcreager added a commit that referenced this pull request Apr 23, 2025
…tructor

* origin/main:
  [red-knot] Trust module-level undeclared symbols in stubs (#17577)
  [`airflow`] Apply auto fixes to cases where the names have changed in Airflow 3 (`AIR301`) (#17355)
  [`pycodestyle`] Auto-fix redundant boolean comparison (`E712`) (#17090)
  [red-knot] Detect semantic syntax errors (#17463)
  Fix stale diagnostics in Ruff playground (#17583)
  [red-knot] Early return from `project.is_file_open` for vendored files (#17580)
dcreager added a commit that referenced this pull request Apr 23, 2025
…var-instance

* dcreager/generic-constructor:
  Revert FunctionLiteral type
  [red-knot] Trust module-level undeclared symbols in stubs (#17577)
  [`airflow`] Apply auto fixes to cases where the names have changed in Airflow 3 (`AIR301`) (#17355)
  [`pycodestyle`] Auto-fix redundant boolean comparison (`E712`) (#17090)
  Clean this up a bit
  clippy
  [red-knot] Detect semantic syntax errors (#17463)
  Fix stale diagnostics in Ruff playground (#17583)
  [red-knot] Early return from `project.is_file_open` for vendored files (#17580)
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.

2 participants