Skip to content

Use package_data to ship typeshed and xml files#5517

Merged
gvanrossum merged 5 commits into
python:masterfrom
emmatyping:pkgdata
Aug 31, 2018
Merged

Use package_data to ship typeshed and xml files#5517
gvanrossum merged 5 commits into
python:masterfrom
emmatyping:pkgdata

Conversation

@emmatyping

@emmatyping emmatyping commented Aug 21, 2018

Copy link
Copy Markdown
Member

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.
@emmatyping emmatyping mentioned this pull request Aug 29, 2018
12 tasks
@ilevkivskyi

Copy link
Copy Markdown
Member

@gvanrossum Could you please review this PR?

@gvanrossum

Copy link
Copy Markdown
Member

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

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

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.

Comment thread 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
Copy Markdown
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
Copy Markdown
Member 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
Copy Markdown
Member

@ethanhs Can you resolve the typeshed conflict?

@emmatyping

Copy link
Copy Markdown
Member Author

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
@emmatyping
emmatyping deleted the pkgdata branch August 31, 2018 21:05
@gvanrossum

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@alexandrul

Copy link
Copy Markdown
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