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 type hint checking with mypy #460

Merged
merged 12 commits into from
Nov 12, 2024
Merged

Conversation

dstansby
Copy link
Contributor

@dstansby dstansby commented Aug 26, 2023

This is a starting point to work towards #443. It:

  • Adds configuration to run mypy
  • pre-commit-config.yaml to run the type checking using pre-commit.
  • Fixes type checking errors so that running mypy at least passes on the current code base.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

@pep8speaks
Copy link

pep8speaks commented Dec 27, 2023

Hello @dstansby! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 109:33: E261 at least two spaces before inline comment

Line 9:44: E261 at least two spaces before inline comment

Line 4:47: E261 at least two spaces before inline comment

Line 8:25: E261 at least two spaces before inline comment

Comment last updated at 2024-05-07 11:58:59 UTC

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.81%. Comparing base (ab86bcc) to head (e518a56).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
numcodecs/tests/test_zarr3.py 87.50% 2 Missing ⚠️
numcodecs/checksum32.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
- Coverage   99.92%   99.81%   -0.12%     
==========================================
  Files          62       62              
  Lines        2692     2712      +20     
==========================================
+ Hits         2690     2707      +17     
- Misses          2        5       +3     
Files with missing lines Coverage Δ
numcodecs/abc.py 100.00% <100.00%> (ø)
numcodecs/compat.py 100.00% <100.00%> (ø)
numcodecs/lzma.py 100.00% <100.00%> (ø)
numcodecs/ndarray_like.py 100.00% <100.00%> (ø)
numcodecs/registry.py 100.00% <100.00%> (ø)
numcodecs/tests/test_lzma.py 100.00% <100.00%> (ø)
numcodecs/tests/test_zfpy.py 100.00% <100.00%> (ø)
numcodecs/zarr3.py 100.00% <100.00%> (ø)
numcodecs/zfpy.py 100.00% <100.00%> (ø)
numcodecs/checksum32.py 98.86% <80.00%> (-1.14%) ⬇️
... and 1 more

@dstansby dstansby marked this pull request as draft August 11, 2024 09:27
@dstansby dstansby marked this pull request as ready for review August 24, 2024 07:16
@dstansby dstansby force-pushed the typing-errors branch 2 times, most recently from 1d216e2 to 4e3fd65 Compare October 28, 2024 22:17
@dstansby
Copy link
Contributor Author

Since this has been floating around with no objections for a while now, I propose to self-merge after #524 is merged, unless anyone objects.

@dstansby dstansby marked this pull request as draft October 29, 2024 20:07
@dstansby dstansby force-pushed the typing-errors branch 2 times, most recently from f638394 to ce83f63 Compare November 9, 2024 19:52
@dstansby
Copy link
Contributor Author

@normanrz I had to fix some typing in the zarr3 code, so would be good if you could check this. Once this is merged I was planning on doing as new release so we can get the zarr3 stuff released.

@dstansby dstansby marked this pull request as ready for review November 11, 2024 11:19
@dstansby dstansby mentioned this pull request Nov 11, 2024
@dstansby dstansby merged commit 23223dc into zarr-developers:main Nov 12, 2024
24 of 26 checks passed
@dstansby dstansby deleted the typing-errors branch November 12, 2024 21:12
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.

4 participants