You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MYPYPATH environment variable should override the mypy_path config file option (not extend it).
Pitch
I propose the ability to override the mypy_path config file option with the the MYPYPATH environment variable. To make Visual Studio Code work with the Mypy extension for namespace packages, it is necessary to set mypy_path and explicit_package_bases, whereas I would like to disable the mypy_path option when running Tox (to typecheck the installed package). It is usually the case that environment variables have higher precedence over config file options, and this change would make Mypy consistent with the expected behavior.
The text was updated successfully, but these errors were encountered:
I don’t think it will be possible to change the semantics of MYPYPATH and mypy_path at this point, since many workflows likely rely on the current documented behavior.
We could new options to help support overriding/ignoring mypy_path, but that a) would further complicate how mypy’s search path is defined (which already can be confusing), and b) is arguably redundant, since this can already be done by using separate config files.
I’m a little surprised that you need to set those config options to make the extension work. Maybe there are other configurations you haven’t considered? It sounds like you have the extension set up to use the bundled mypy binary to type check the in-tree sources. Have you tried using the "fromEnvironment" mypy binary to type check the installed package instead?
Also, in case it helps your usecase, do note that the relationship between mypy_path and MYPYPATH is actually the other way around: mypy_path extends MYPYPATH, and is only searched if a match isn’t found in MYPYPATH. In that sense, MYPYPATH already “overrides” mypy_path.
Feature
The
MYPYPATH
environment variable should override themypy_path
config file option (not extend it).Pitch
I propose the ability to override the
mypy_path
config file option with the theMYPYPATH
environment variable. To make Visual Studio Code work with the Mypy extension for namespace packages, it is necessary to setmypy_path
andexplicit_package_bases
, whereas I would like to disable themypy_path
option when running Tox (to typecheck the installed package). It is usually the case that environment variables have higher precedence over config file options, and this change would make Mypy consistent with the expected behavior.The text was updated successfully, but these errors were encountered: