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

Add mypy #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add mypy #167

wants to merge 1 commit into from

Conversation

DavisRayM
Copy link
Contributor

Changes / Features implemented

  • Partially typehint some functions
  • Configure mypy to run on tox

Steps taken to verify this change does what is intended

  • Tested locally

Side effects of implementing this change

  • We may need to figure out how to go about type hinting all of our code.

Closes #151

@DavisRayM DavisRayM force-pushed the 151-add-mypy branch 2 times, most recently from 702e150 to 7bf6f9e Compare January 23, 2020 06:39
@DavisRayM DavisRayM changed the title [WIP] Add mypy Add mypy Jan 23, 2020
setup.cfg Outdated
Comment on lines 16 to 26

[mypy-django.*]
ignore_missing_imports = True

[mypy-django_countries.*]
ignore_missing_imports = True

[mypy-django_filters.*]
ignore_missing_imports = True

[mypy-mptt.*]
ignore_missing_imports = True

[mypy-rest_framework.*]
ignore_missing_imports = True

[mypy-rest_framework_gis.*]
ignore_missing_imports = True
Copy link
Contributor

Choose a reason for hiding this comment

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

why are these necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mypy raises import errors for third party packages that it cannot find, had to silence them so that they do not cause the checks to fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, I am hesitant about this - because I am strongly against relaxing linting rules. Some questions:

  • why cant mypy find these packages (I ask this because I have used it elsewhere and not gotten into this problem)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, I am hesitant about this - because I am strongly against relaxing linting rules. Some questions:

* why cant mypy find these packages (I ask this because I have used it elsewhere and not gotten into this problem)?

Seems like this was just a blunder on my side. Was running it outside of my virtualenv.

After running it in the virtualenv it doesn't seem to raise any errors without the config. I'll make the change.

- Partially typehint some functions
- Configure mypy to run on tox
- Add new travis env for mypy
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.

Add mypy tests
2 participants