Skip to content
Discussion options

You must be logged in to vote

Since Ruff currently does not support cross-file analysis to infer type information across module boundaries, metadata regarding runtime-evaluated classes like pydantic.BaseModel is indeed lost during import. This is a known limitation of static analysis in the current architecture.

As a more scalable alternative to inline # noqa: TC001 comments, you can utilize the per-file-ignores configuration in your pyproject.toml. This allows you to exclude specific modules or directories (such as dependency definitions or schemas) from the TC001 rule without disabling it globally:

[tool.ruff.lint.per-file-ignores]
"**/dependencies.py" = ["TC001"]
"**/schemas/*.py" = ["TC001"]

Additionally, for the …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ntBre
Comment options

ntBre Mar 5, 2026
Maintainer

Comment options

You must be logged in to vote
0 replies
Answer selected by fschulze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants