Skip to content

Move mypy configs from pre-commit to mypy config #5110

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

Merged
merged 6 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ repos:
rev: v0.812
hooks:
- id: mypy
# Copied from setup.cfg
exclude: "properties|asv_bench"
Copy link
Member

@andersy005 andersy005 Apr 12, 2021

Choose a reason for hiding this comment

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

Now that setup.cfg has

[mypy]
exclude = properties|asv_bench|doc

do we still need this exclude option here? It's my understanding that mypy pre-commit hook should be able to retrieve values defined in setup.cfg

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do, unfortunately.

I guess that pre-commit gives it a list of files, and when passed a list of files mypy doesn't honor the exclusions.

# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
# - repo: https://github.com/asottile/pyupgrade
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ default_section = THIRDPARTY
known_first_party = xarray

[mypy]
exclude = properties|asv_bench|doc
files = xarray/**/*.py
show_error_codes = True

# Most of the numerical computing stack doesn't have type annotations yet.
Expand Down Expand Up @@ -238,7 +240,6 @@ ignore_missing_imports = True
[mypy-xarray.core.pycompat]
ignore_errors = True


[aliases]
test = pytest

Expand Down