numcodecs icon indicating copy to clipboard operation
numcodecs copied to clipboard

Drop headers

Open jakirkham opened this issue 3 years ago • 4 comments

Convert code from header files to Cython (generated C code is equivalent). Then drop the headers. These were there primarily for Windows compatibility with old Python versions (namely 2.7), but shouldn't be needed any more.

xref: https://github.com/zarr-developers/numcodecs/pull/368 xref: https://github.com/zarr-developers/numcodecs/pull/369

TODO:

  • [ ] Unit tests and/or doctests in docstrings
  • [ ] tox -e py310 passes locally
  • [ ] Docstrings and API docs for any new/modified user-facing classes and functions
  • [ ] Changes documented in docs/release.rst
  • [ ] tox -e docs passes locally
  • [ ] GitHub Actions CI passes
  • [ ] Test coverage to 100% (Coveralls passes)

jakirkham avatar Oct 28 '22 18:10 jakirkham

@DimitriPapadopoulos, Idk how familiar you are with Cython/C, but would appreciate your review here (if you have time 🙂)

jakirkham avatar Oct 28 '22 22:10 jakirkham

I'll have a look, but I actually don't know much about Cython. I am more experienced in Python bindings for C++ libraries using SIP.

DimitriPapadopoulos avatar Oct 29 '22 06:10 DimitriPapadopoulos

I think I get it:

  • Use uint8_t/uint32_t instead of char/int, this clarifies the intent and avoids any accidental bad cast (95963d9cb79a8d258d0436ebf9f5ea4d42d69abd).
  • Most of the contents of stdint_compat.h are moved to _utils.pxd (d3250aebe3b98c3fbf65a860ec241712559a1657).
  • The now (almost) empty stdint_compat.h is dropped (2fb1d412a204e9dee801f7ca0a498ac77f1439b6).

It looks goods. :+1:

DimitriPapadopoulos avatar Oct 29 '22 07:10 DimitriPapadopoulos

Yeah the dropping Python 2.7 & C files in your other two PRs reminded me there was some leftover compatibility code in this header for Windows Python 2.7. So this cleans that out and consolidates things into Cython (with some readability/code quality improvements).

jakirkham avatar Oct 29 '22 09:10 jakirkham

Thanks Josh! 🙏

Nope the header isn't installed. It is only used as part of the build process.

jakirkham avatar Oct 29 '22 20:10 jakirkham