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

enable type hints when importing nox #274

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

cs01
Copy link
Contributor

@cs01 cs01 commented Jan 20, 2020

Because nox is not marked as containing type hints, any libraries that imports nox will get a mypy error saying the library is untyped. To fix this, users have had to do

import nox  # type: ignore

to avoid errors such as

error: Cannot find implementation or library stub for module named 'nox'
note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

This PR implements instructions in the mypy documentation to tell mypy that nox does indeed have inline types (https://mypy.readthedocs.io/en/latest/installed_packages.html#making-pep-561-compatible-packages). Though rather strange and arbitrary, this is the standard way to do this. GvR himself committed a py.typed to mypy here.

If this code is merged, the # type: ignore comment will no longer be necessary for users of nox, and they can be confident their code doesn't have type errors.

@cs01 cs01 requested a review from theacodes January 20, 2020 00:35
@theacodes theacodes merged commit e0ffd4f into wntrblm:master Jan 20, 2020
@theacodes
Copy link
Collaborator

Thanks, @cs01!

@cs01 cs01 deleted the cs01/add-mypy-marker-file branch January 20, 2020 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants