Skip to content

Fix leak of violations in site-packages#183

Merged
sobolevn merged 1 commit into
typeddjango:masterfrom
ngnpope:ngnpope/fix-site-package-leak
Mar 12, 2026
Merged

Fix leak of violations in site-packages#183
sobolevn merged 1 commit into
typeddjango:masterfrom
ngnpope:ngnpope/fix-site-package-leak

Conversation

@ngnpope

@ngnpope ngnpope commented Mar 11, 2026

Copy link
Copy Markdown
Member

Makes the following changes to avoid third-party packages being treated as first-party packages which causes errors to be raised where those packages violate settings for mypy that are enabled in the stubs package:

  • Don't use --no-silence-site-packages by default
  • Don't add the test root path to PYTHONPATH

Flags have been added that allow reverting to the previous behavior in case there are users of this plugin that depend on that behavior.

Fixes #134

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to test this? Or is it too complicated?

@ngnpope

ngnpope commented Mar 11, 2026

Copy link
Copy Markdown
Member Author

Is there any way to test this? Or is it too complicated?

I think I can come up with something... But will need to finish off tomorrow.

@ngnpope ngnpope force-pushed the ngnpope/fix-site-package-leak branch 2 times, most recently from 49afe70 to 55cecd4 Compare March 11, 2026 22:50
@ngnpope

ngnpope commented Mar 11, 2026

Copy link
Copy Markdown
Member Author

Is there any way to test this? Or is it too complicated?

I think I can come up with something... But will need to finish off tomorrow.

Scratch that - I got too absorbed so I've done it...

I've come up with something that should hopefully work. Was a little bit awkward 😅

@ngnpope ngnpope force-pushed the ngnpope/fix-site-package-leak branch from 55cecd4 to 3eb4f03 Compare March 11, 2026 22:59
@ngnpope ngnpope requested a review from sobolevn March 11, 2026 22:59
Makes the following changes to avoid third-party packages being treated
as first-party packages which causes errors to be raised where those
packages violate settings for mypy that are enabled in the stubs
package:

- Don't use `--no-silence-site-packages` by default
- Don't add the test root path to `PYTHONPATH`

Flags have been added that allow reverting to the previous behavior in
case there are users of this plugin that depend on that behavior.
@ngnpope ngnpope force-pushed the ngnpope/fix-site-package-leak branch from 3eb4f03 to 9df17fb Compare March 11, 2026 23:01

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Looks great!

@sobolevn sobolevn merged commit 104dfe8 into typeddjango:master Mar 12, 2026
16 checks passed
@ngnpope ngnpope deleted the ngnpope/fix-site-package-leak branch March 12, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Ignore mypy errors from site-packages imports

2 participants