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 to linting checks #19

Merged
merged 3 commits into from
May 2, 2024
Merged

Conversation

jameslamb
Copy link
Member

Reading through this project's code for work on rapidsai/build-planning#31, I noticed it isn't using type hints or running a type-checking

This proposes the following:

  • adding mypy to checks run via pre-commit
  • adding type hints for a few cases

I think this'll make the code a little easier to understand, and improve the change of catching some types of bugs (like treating a value which can be None as if it was unconditionally not `None) during development.

How I tested this

pre-commit run --all-files

@jameslamb jameslamb added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels May 2, 2024
@jameslamb jameslamb requested a review from a team as a code owner May 2, 2024 19:08
Copy link
Contributor

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Choose a reason for hiding this comment

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

Look good overall, I have one suggestion for more explicit typing of config options

rapids_build_backend/config.py Outdated Show resolved Hide resolved
Copy link
Contributor

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Choose a reason for hiding this comment

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

Looks good. One final optional thought, I'm fine with it either way.

rapids_build_backend/config.py Outdated Show resolved Hide resolved
@KyleFromNVIDIA KyleFromNVIDIA merged commit fdd6b6e into rapidsai:main May 2, 2024
3 checks passed
@jameslamb jameslamb deleted the add-mypy branch May 2, 2024 20:41
KyleFromNVIDIA added a commit that referenced this pull request May 3, 2024
#19 added MyPy
linting, but CI did not run under Python 3.9, so the new type annotation
syntax was used. Use the old syntax to support Python 3.9, and run CI in
Python 3.9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants