Skip to content

Commit

Permalink
Run mypy in pre-commit (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA authored Aug 23, 2024
1 parent 5d453f2 commit 7b44e64
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
24 changes: 23 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ profile = "black"
testpaths = [
"test",
]

[[tool.mypy.overrides]]
module = "bashlex.*"
ignore_missing_imports = true
3 changes: 2 additions & 1 deletion src/rapids_pre_commit_hooks/alpha_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down

0 comments on commit 7b44e64

Please sign in to comment.