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

Proof of concept for depending on external blosc python package #571

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dstansby
Copy link
Contributor

@dstansby dstansby commented Aug 31, 2024

This is a proof of concept for depending on the blosc Python package for blosc compression, instead of using the sources we build ourselves. The goal here is to proove it's possible in as few as lines as possible.

If we go ahead with this we would need to first deprecate the following functions in numcodecs.blosc before the replacement could be done:

[
'destroy',
'init',
'compname_to_compcode',
'cbuffer_sizes',
'cbuffer_metainfo',
'err_bad_cname',
'decompress_partial'
]

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)

Copy link

codecov bot commented Aug 31, 2024

Codecov Report

Attention: Patch coverage is 91.02564% with 7 lines in your changes missing coverage. Please review.

Project coverage is 98.44%. Comparing base (6c0ea0f) to head (f83a176).

Files with missing lines Patch % Lines
numcodecs/blosc.py 90.14% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #571      +/-   ##
==========================================
- Coverage   99.92%   98.44%   -1.48%     
==========================================
  Files          62       63       +1     
  Lines        2752     2770      +18     
==========================================
- Hits         2750     2727      -23     
- Misses          2       43      +41     
Files with missing lines Coverage Δ
numcodecs/__init__.py 100.00% <ø> (ø)
numcodecs/tests/test_blosc.py 100.00% <100.00%> (ø)
numcodecs/blosc.py 90.14% <90.14%> (ø)

... and 1 file with indirect coverage changes

@d-v-b
Copy link
Contributor

d-v-b commented Sep 1, 2024

looking back at the commit history, it seems like blosc has been vendored in this repo for a very long time. @alimanfoo and / or @jakirkham what do you think about this PR?

@normanrz
Copy link
Member

normanrz commented Nov 9, 2024

Since we are using the zstd and lz4 code from within the c-blosc repo, how would we deliver those codecs when using the blosc wheels?

@alimanfoo
Copy link
Member

Hi @dstansby, this was a while ago now but IIRC part of the original motivation for vendoring was to be able to minimise memory copies. So maybe worth a check on whether using the Python blosc package would introduce any extra memory copies.

@normanrz
Copy link
Member

normanrz commented Jan 4, 2025

Hey @dstansby, can you remind me why it is desirable to use the external blosc package instead of the submodule? I can see a number of downsides but I am not clear about the upsides.

@dstansby
Copy link
Contributor Author

dstansby commented Jan 4, 2025

My idea here was to do a minimal proof of concept, to see if the tests still pass (ie, data is still encoded the same way) if we depend on the blosc Python package.

For me, the advantages would be:

  • Remove the need to compile c-blosc every time numcodecs is installed from source
  • Remove a bunch of wrapper code from numcodecs, reducing maintenance burden

I'm not really sure if this is desirable or not overall though, and from reading various PRs and issues I think there's still an open question about the future of numcodecs. I certainly don't intend to merge this any time soon and without wider discusssion (which unfortunately I don't have the time to make happen). Hopefully this shows that it's technically possible to switch to the Python blosc package though.

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