Skip to content

Commit

Permalink
Remove mypy from pre-commit.
Browse files Browse the repository at this point in the history
Fix mypy config in pyproject.toml.
  • Loading branch information
Alexei95 committed Mar 12, 2022
1 parent 074318c commit 98d1cba
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
40 changes: 21 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@ repos:
rev: 3.7.9
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1 # Use the sha / tag you want to point at
hooks:
- id: mypy
# the additional dependencies are installed if required in the
# execution
# additional_dependencies: [
# cupy>=9.4.0,
# numpy,
# pytorch-lightning>=1.4.5,
# sqlalchemy>=1.4.22,
# torch>=1.9,
# ]
args: [
# --no-strict-optional,
# mypy is used from a venv, so it will not have all the
# dependencies available
--ignore-missing-imports
]
# mypy and pre-commit hooks are not nice together if the project
# has dependencies which are difficult to install
# for now we simply run it locally and later also in a CI
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.910-1 # Use the sha / tag you want to point at
# hooks:
# - id: mypy
# # the additional dependencies are installed if required in the
# # execution
# # additional_dependencies: [
# # cupy>=9.4.0,
# # numpy,
# # pytorch-lightning>=1.4.5,
# # sqlalchemy>=1.4.22,
# # torch>=1.9,
# # ]
# args: [
# # mypy is used from a venv, so it will not have all the
# # dependencies available
# --ignore-missing-imports
# ]
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ extend-exclude = '''
'''

[tool.mypy]
# Typing tests is low priority, but enabling type checking on the
# untyped test functions (using `--check-untyped-defs`) is still
# high-value because it helps test the typing.
# taken from https://github.com/PyTorchLightning/pytorch-lightning/blob/1c8ad3a94bce2d0b5e62b5e5a4395bb6fb25642d/setup.cfg#L95
python_version = "3.9"
disallow_untyped_defs = true
# ignore_missing_imports = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true

# we skip the errors because of the import problems
# however this needs to be added only for the pre-commit hook
# [[tool.mypy.overrides]]
# module = "enpheeph.*"
# ignore_errors = true

# use the following section as example for custom mypy module configurations
# [[tool.mypy.overrides]]
Expand Down

0 comments on commit 98d1cba

Please sign in to comment.