Repository navigation
Add an option to disable the PYTHONPATH warning - #5662
Open
Primeteumm wants to merge 1 commit into
Open
Primeteumm wants to merge 1 commit into
Primeteumm wants to merge 1 commit into
Conversation
Build and test systems often need PYTHONPATH set, so the warning Pyrefly prints when it queries an interpreter with PYTHONPATH set is noise for those users, and it gets long when PYTHONPATH is long. Fixes pyrefly-org#5315. Add a `disable-pythonpath-warning` config option and an equivalent `--disable-pythonpath-warning` flag; the flag overrides the config value. The warning now lives on `ConfigFile`, where the option is available, instead of in the interpreter query itself. It is emitted before the CLI and the language server query an interpreter. Because PYTHONPATH is fixed for the life of the process, it is printed at most once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Primeteumm
force-pushed
the
disable-pythonpath-warning
branch
from
November 18, 2026 18:11
d80226a to
00194da
Compare
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D132949590. (Because this pull request was imported automatically, there will not be any future comments.) |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5315
When
PYTHONPATHis set, Pyrefly previously logged a long warning every time it queried a Python interpreter, which adds a lot of noise in build and test environments that rely onPYTHONPATH.This adds a
disable-pythonpath-warningsetting (defaulting tofalse) inpyrefly.toml/pyproject.tomland a matching--disable-pythonpath-warning[=true|false]CLI flag that overrides the config in either direction. To respect the config, I moved the warning check out of the interpreter query and intoConfigFile, so it now applies to bothpyrefly checkand the LSP and fires at most once per run. I also updated the warning message to mention how to turn it off, along with the docs and JSON schema.I claimed #5315 in the issue comments earlier, though the claim bot hasn't assigned me yet.
Test Plan
disable_pythonpath_warning_flagunit test to verify the CLI flag overrides the config value both ways, and ran the existingpyrefly_config,config_finder, andworkspacetests.test/interpreter.mdcovering the default warning, CLI flag suppression, and config suppression. Sincescrutisn't available on my Windows machine, I ran the commands manually against the built binary (CI will run them).AI Disclosure
The code and tests were written with Claude Code; I reviewed and verified the changes myself.