-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Include Python's sys.path into build.default_lib_path? #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The main reason why we don't do it right now it because mypy still often chokes on valid Python code. Once the parser and semantic analyzer are robust enough to handle much/most arbitrary Python code then this would make sense, I think, and could even be a game-changer for mypy! These things would be nice to have in order to enable searching
@lrem Are you interested in moving this forward? At least steps 1 and 2 should not be very tricky and we could start really working on steps 3+4. Step 3 is probably the trickiest to implement. We can start with a kind-of working implementation (E.g., if we could use, say, 50% of the Python standard library, this would already be a useful feature to have. If we can use only 10% of the Python standard library I'd probably be against enabling this feature by default.) Step 4 is open-ended but we can start with something not too fancy. You can always use MYPYPATH to point to whatever directories you want as a workaround until we get the above things fixed/tested, but it's clearly awkward. |
Added issue #487 for investigating parser coverage. |
I'd be very happy for a command-line flag on whether or not to run semantic checks on modules that include |
I'm in favor of having at least the (command line) option of doing some semantic analysis or even some type checking on modules that don't include |
#492 has the flag for looking into sys.path. |
So will a standard pip install now install a mypy version that tracks sys.path? Thanks! |
Not yet. The parser still chokes on some perfectly valid Python. I hope we On Sat, 29 Nov 2014 00:42 Dedoig [email protected] wrote:
|
I think we are pretty close to being able to parse almost arbitrary Python code. The remaining task is to tweak the semantic analyzer and the type checker to be less picky and to ignore things that aren't actual problems in code that doesn't import |
Issue #638 is basically targeting the same problem. Closing this as redundant. |
Mypy refuses to cooperate with any code importing things not in standard library. I see that it doesn't search in sys.path. Any particular reason for that? A single line change like lrem@6e363a0 lets mypy pick up all modules from current environment (not that it parses all of them, looking into that separately from this issue).
The text was updated successfully, but these errors were encountered: