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

Use package_data to ship typeshed and xml files #5517

Merged
merged 5 commits into from
Aug 31, 2018

Conversation

ethanhs
Copy link
Collaborator

@ethanhs ethanhs commented Aug 21, 2018

Data files have caused many issues where mypy cannot find typeshed.
Using package_data allows us to find typeshed relative to the mypy
package itself, which avoids a lot of fragile path computation.

Fixes #5307
Fixes #5319

Data files have caused many issues where mypy cannot find typeshed.
Using package_data allows us to find typeshed relative to the mypy
package itself, which avoids a lot of fragile path computation.
@ethanhs ethanhs mentioned this pull request Aug 29, 2018
12 tasks
@ilevkivskyi
Copy link
Member

@gvanrossum Could you please review this PR?

@gvanrossum
Copy link
Member

Yes, I will review it. Tomorrow at the earliest. (I am in favor of the idea.)

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

This is good to go. I'd like to land it soon, as I expect that there may be some issues in our internal integration due to the move of the typeshed submodule into the mypy folder.

mypy/build.py Outdated
raise RuntimeError("Broken installation: can't determine base dir")
def default_data_dir() -> str:
"""Returns directory containing typeshed directory."""
return str(pathlib.Path(__file__).parent)
Copy link
Member

Choose a reason for hiding this comment

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

Why not os.path.dirname(__file__)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I have a pipe dream of eventually moving to pathlib for most things, but that probably isn't realizable, so I went ahead with using dirname.

@gvanrossum
Copy link
Member

@ethanhs Can you resolve the typeshed conflict?

@ethanhs
Copy link
Collaborator Author

ethanhs commented Aug 31, 2018

Can you resolve the typeshed conflict?

Done. I also used dirname, as I think its probably better, and faster anyway.

@gvanrossum gvanrossum merged commit 5e8815e into python:master Aug 31, 2018
@ethanhs ethanhs deleted the pkgdata branch August 31, 2018 21:05
@gvanrossum
Copy link
Member

FWIW this is causing problems. Apparently submodules are global, not per-branch, and now I've got some very unhappy internal integrations.

@gvanrossum
Copy link
Member

I think it's a problem of my own making (though affecting other Dropboxers), I can handle it internally.

@alexandrul
Copy link
Contributor

It was a long time ago, but everything was working nice on my PC when using a slightly different submodule definition:

[submodule "mypy_res/typeshed"]
    path = mypy_res/typeshed

It was painful enough to keep this submodule change in a separate commit: alexandrul-ci@5dc3f76

My apologies if your root cause is different.

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.

4 participants