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

Cleanup crc32c soft dependency #637

Merged
merged 3 commits into from
Nov 17, 2024

Conversation

jakirkham
Copy link
Member

Instead of creating a wrapper function around the call to crc32c's to check if it can be imported. Try importing crc32c when numcodecs.checksum32 is imported. If it cannot be imported, don't define the CRC32C class and skip registering it at the top-level with other Codecs.

This matches the behavior that Numcodecs has with all other optional codecs and cuts out unneeded overhead when using this checksum routine.

xref: #613


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)

@jakirkham jakirkham force-pushed the cleanup_crc32_c_soft branch 2 times, most recently from f2c5a8b to 2cc8d48 Compare November 14, 2024 01:14
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.88%. Comparing base (ad1ad67) to head (8e7e0b4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #637   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files          62       62           
  Lines        2708     2723   +15     
=======================================
+ Hits         2705     2720   +15     
  Misses          3        3           
Files with missing lines Coverage Δ
numcodecs/__init__.py 100.00% <100.00%> (ø)
numcodecs/checksum32.py 100.00% <100.00%> (ø)
numcodecs/tests/test_checksum32.py 100.00% <100.00%> (ø)

@jakirkham jakirkham force-pushed the cleanup_crc32_c_soft branch 3 times, most recently from 822f376 to e5d4566 Compare November 14, 2024 01:36
Copy link
Member Author

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Seeing some issues with mypy below. Flagged relevant lines that may need changes. Please let me know if there is a good way to address this

numcodecs/checksum32.py Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@jakirkham jakirkham force-pushed the cleanup_crc32_c_soft branch from 59fa05c to afce731 Compare November 14, 2024 02:27
@jakirkham
Copy link
Member Author

Fixed the mypy issues in recent changes

Copy link
Contributor

@dstansby dstansby 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 - just needs a changelog entry 👍

@jakirkham
Copy link
Member Author

Thanks David! 🙏

Please let me know if there is anything else

@dstansby dstansby added this to the 0.14.1 milestone Nov 16, 2024
@jakirkham
Copy link
Member Author

jakirkham commented Nov 17, 2024

Closing and reopening for CI (specifically coverage)

@jakirkham jakirkham closed this Nov 17, 2024
@jakirkham jakirkham reopened this Nov 17, 2024
@dstansby dstansby merged commit 145f57c into zarr-developers:main Nov 17, 2024
46 of 50 checks passed
@jakirkham jakirkham deleted the cleanup_crc32_c_soft branch November 18, 2024 08:02
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.

2 participants