Skip to content
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

Handle cwd correctly in pyinfo #13161

Merged
merged 1 commit into from
Jul 17, 2022
Merged

Conversation

hauntsaninja
Copy link
Collaborator

This fixes a recent regression introduced by the change to
use sys.path

Fixes #12956

@hauntsaninja
Copy link
Collaborator Author

cc @AWhetter @ethanhs

This fixes a recent regression introduced by the change to
use sys.path

Fixes python#12956
@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Jul 17, 2022

In the issue, Ethan mentioned an alternate possible resolution is to also search the pythonpath for stub packages. I think that's a slightly larger change and we can always do it later. I think we'd want this PR regardless, since it keeps behaviour more consistent across mypy --python-executable ..., python -m mypy, mypy

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@emmatyping emmatyping left a comment

Choose a reason for hiding this comment

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

Thank you! Good catch.

@hauntsaninja hauntsaninja merged commit 8a974e1 into python:master Jul 17, 2022
@hauntsaninja hauntsaninja deleted the pyinfo-cwd branch July 17, 2022 02:59
hauntsaninja added a commit to hauntsaninja/mypy that referenced this pull request Jul 17, 2022
This fixes a recent regression introduced by the change to
use sys.path

Fixes python#12956
ilevkivskyi pushed a commit that referenced this pull request Jul 17, 2022
This fixes a recent regression introduced by the change to
use sys.path

Fixes #12956
@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Jul 17, 2022

Just ran into another behaviour that #11143 changed that this PR changes back to that of mypy 0.961.

mypy silences errors on package_path. Since cwd stopped being on package_path, even if we had an editable install of cwd, we stopped silencing these errors. I think the original + this PR, silencing behaviour is actually correct, but I'm not 100% sure.

for dir in manager.search_paths.package_path + manager.search_paths.typeshed_path:

This wouldn't usually affect mypy, since people rarely check a single module within a package, so we'd have a path here for any BuildSource

if not path and source is None:
and not go through findmodule.

(It's still a little unclear what I'd need to do to get mypy to report the pandas errors I was seeing via stubtest. Maybe a configuration thing?)

JukkaL added a commit that referenced this pull request Jul 18, 2022
We run mypy/pyinfo.py as a script, and this means that mypy/types.py
could be picked up instead of the stdlib `types` module, which clearly
doesn't work. This seems to happen at least on macOS, and it broke
PEP 561 tests.

The workaround was accidentally removed as part of #13161.

This should fix #13174 and help with the wheel builds.
JukkaL added a commit that referenced this pull request Jul 18, 2022
…#13176)

We run mypy/pyinfo.py as a script, and this means that mypy/types.py
could be picked up instead of the stdlib `types` module, which clearly
doesn't work. This seems to happen at least on macOS, and it broke
PEP 561 tests.

The workaround was accidentally removed as part of #13161.

This should fix #13174 and help with the wheel builds.
JukkaL added a commit that referenced this pull request Jul 18, 2022
…#13176)

We run mypy/pyinfo.py as a script, and this means that mypy/types.py
could be picked up instead of the stdlib `types` module, which clearly
doesn't work. This seems to happen at least on macOS, and it broke
PEP 561 tests.

The workaround was accidentally removed as part of #13161.

This should fix #13174 and help with the wheel builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sys.path change breaks editable installs of cwd
2 participants