diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee81616..63bcdf0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,8 +46,30 @@ repos: - id: flake8 args: - --show-source + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v1.10.0' + hooks: + - id: mypy + args: + - --config-file=pyproject.toml + - --exclude + - '^test/examples/' + - src/ + - test/ + pass_filenames: false + additional_dependencies: + - --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple + - bashlex + - freezegun + - gitpython + - packaging + - pytest + - rapids-metadata>=0.3.1 + - rich + - tomlkit + - types-PyYAML - repo: https://github.com/rapidsai/pre-commit-hooks - rev: v0.1.0 + rev: v0.3.1 hooks: - id: verify-copyright files: | diff --git a/pyproject.toml b/pyproject.toml index 1b5b269..994bb5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,3 +67,7 @@ profile = "black" testpaths = [ "test", ] + +[[tool.mypy.overrides]] +module = "bashlex.*" +ignore_missing_imports = true diff --git a/src/rapids_pre_commit_hooks/alpha_spec.py b/src/rapids_pre_commit_hooks/alpha_spec.py index 4a1e507..78f056b 100644 --- a/src/rapids_pre_commit_hooks/alpha_spec.py +++ b/src/rapids_pre_commit_hooks/alpha_spec.py @@ -19,6 +19,7 @@ import yaml from packaging.requirements import InvalidRequirement, Requirement +from rapids_metadata.metadata import RAPIDSVersion from rapids_metadata.remote import fetch_latest from .lint import LintMain @@ -42,7 +43,7 @@ def node_has_type(node, tag_type): return node.tag == f"tag:yaml.org,2002:{tag_type}" -def get_rapids_version(args: argparse.Namespace) -> str: +def get_rapids_version(args: argparse.Namespace) -> RAPIDSVersion: md = all_metadata() return ( md.versions[args.rapids_version]