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 pre-commit #2068

Merged
merged 10 commits into from
Mar 20, 2024
Merged

Add mypy to pre-commit #2068

merged 10 commits into from
Mar 20, 2024

Conversation

davorrunje
Copy link
Collaborator

Why are these changes needed?

Ideally, pre-commit hook should check types for files that will be checked by mypy in CI. This PR:

  • adds to mypy configuration in pyproject.toml the list of files to be checked
  • add optional dependency target [types] to setup.py including mypy and other packages that needs to be installed for type checking
  • adds mypy check to pre-commit hook
  • refactors the existing workflow in CI to use the same configuration as pre-commit

As a consequence, we can run mypy locally on a subset of files as specified in pyproject.toml by simply executing the following command:

$ mypy

Related issue number

Checks

@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.32%. Comparing base (6cab643) to head (0d589b4).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2068       +/-   ##
===========================================
+ Coverage   36.88%   48.32%   +11.44%     
===========================================
  Files          68       68               
  Lines        7062     7062               
  Branches     1540     1668      +128     
===========================================
+ Hits         2605     3413      +808     
+ Misses       4228     3360      -868     
- Partials      229      289       +60     
Flag Coverage Δ
unittests 48.20% <ø> (+11.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davorrunje
Copy link
Collaborator Author

do we want to change any docker file to preconfigure it?

@sonichi no need, it is automatically setup through existing pre-commit hook

@sonichi sonichi added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit 99e48dc Mar 20, 2024
60 of 68 checks passed
@sonichi sonichi deleted the add-mypy-to-pre-commit branch March 20, 2024 06:00
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* Add mypy check in pre-commit

* Add mypy check in pre-commit

* bug fix

* CI fix

* add python version matrix for checking types in CI

* added 3.12 to CI

---------

Co-authored-by: Eric Zhu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants