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

mypy seemingly can't find types for this package #26

Closed
ezyang opened this issue Mar 7, 2019 · 4 comments
Closed

mypy seemingly can't find types for this package #26

ezyang opened this issue Mar 7, 2019 · 4 comments
Assignees
Milestone

Comments

@ezyang
Copy link

ezyang commented Mar 7, 2019

When I attempt to run mypy, I get:

ghstack/github_fake.py:1: error: Cannot find module named 'graphql'
ghstack/github_fake.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

Now, I know that you guys have types... but the mypy docs seem to suggest that you need to do something extra to get mypy to treat the third party package as having types?

As a temporary workaround, I've symlinked graphql in my local directory to graphql-core-next/graphql and that convinces mypy to check the ytpes.

@Cito
Copy link
Member

Cito commented Mar 7, 2019

How exactly did you call mypy? Note that the mypy command line tool expects a module file or folder name on the file system, not the name of an installed package.

@ezyang
Copy link
Author

ezyang commented Mar 11, 2019

I just did mypy my_module.py, where my_module imports GraphQL-core-next

I believe the problem is that you need a py.typed file in your package directory. See https://mypy.readthedocs.io/en/latest/installed_packages.html#making-pep-561-compatible-packages

@Cito
Copy link
Member

Cito commented Mar 12, 2019

Oh, ok, now I understand. Yes, I believe you're right, there should be such an (empty) file as a marker. Will add this to the next version. Need to rethink the packaging anyway (#22).

Thanks a lot for pointing this out!

@Cito Cito self-assigned this Mar 12, 2019
@Cito Cito added this to the v1.0.3 milestone Mar 12, 2019
@Cito
Copy link
Member

Cito commented May 3, 2019

Version 1.0.3 with this fix is now available.

@Cito Cito closed this as completed May 3, 2019
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

No branches or pull requests

2 participants