Skip to content

Commit

Permalink
Merge branch 'main' into rtd-doc-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby authored Oct 19, 2023
2 parents 25abf4d + 8c4098e commit 949ef2e
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 33 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ exclude =
fixture,
notebooks,
numcodecs.egg-info,
numcodecs/version.py,
6 changes: 3 additions & 3 deletions .github/workflows/ci-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
run: |
conda activate env
export DISABLE_NUMCODECS_AVX2=""
python -m pip install -v -e .[test,msgpack,zfpy]
python -m pip install -v -e .[test,test_extras,msgpack,zfpy]
- name: List installed packages
shell: "bash -l {0}"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-osx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -49,8 +49,8 @@ jobs:
shell: "bash -l {0}"
run: |
conda activate env
export CC=clang
python -m pip install -v -e .[test,msgpack,zfpy]
export DISABLE_NUMCODECS_AVX2=""
python -m pip install -v -e .[test,test_extras,msgpack,zfpy]
- name: List installed packages
shell: "bash -l {0}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -42,7 +42,7 @@ jobs:
shell: "bash -l {0}"
run: |
conda activate env
python -m pip install -v -e .[test,msgpack,zfpy]
python -m pip install -v -e .[test,test_extras,msgpack,zfpy]
- name: List installed packages
shell: "bash -l {0}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
# note: CIBW_ENVIRONMENT is now set in pyproject.toml

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: pypa/cibuildwheel@v2.14.1
- uses: pypa/cibuildwheel@v2.16.2

- uses: actions/upload-artifact@v3
with:
Expand All @@ -37,7 +37,7 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand Down
34 changes: 32 additions & 2 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Release notes
# to document your changes. On releases it will be
# re-indented so that it does not show up in the notes.

.. _unreleased:

Unreleased
Expand All @@ -15,10 +14,41 @@ Unreleased
Enhancements
~~~~~~~~~~~~

Fix
~~~

Maintenance
~~~~~~~~~~~

.. _release_0.12.1:

0.12.1
------

Fix
~~~

* ``Codec`` is now derived from ``abc.ABC``
By :user:`Mads R. B. Kristensen <madsbk>`, :issue:`472`.
* Fix handling of entry points on older Python versions where ``importlib_metadata`` compatibility is concerned
By :user:`Vyas Ramasubramani <vyasr>`, :issue:`478`.
* Make shuffle pyx functions ``noexcept``
By :user:`Martin Durant <martindurant>`, :issue:`477`.

.. _release_0.12.0:

0.12.0
------

Enhancements
~~~~~~~~~~~~

* Add ``fletcher32`` checksum codec
By :user:`Martin Durant <martindurant>`, :issue:`410`.
* Add ``jenkins_lookup3`` checksum codec
By :user:`Mark Kittisopkul <mkitti>`, :issue:`445`.
* Support Python 3.12.
By :user:`John Kirkham <jakirkham>`, :issue:`471`.

Fix
~~~
Expand All @@ -31,7 +61,7 @@ Fix
Maintenance
~~~~~~~~~~~

* Cleanup ``import``s in ``adhoc/blosc_memleak_check.py``
* Cleanup ``import``\ s in ``adhoc/blosc_memleak_check.py``
By :user:`John Kirkham <jakirkham>`, :issue:`408`.

.. _release_0.11.0:
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/_shuffle.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cimport cython

@cython.boundscheck(False)
@cython.wraparound(False)
cpdef void _doShuffle(const unsigned char[::1] src, unsigned char[::1] des, Py_ssize_t element_size) nogil:
cpdef void _doShuffle(const unsigned char[::1] src, unsigned char[::1] des, Py_ssize_t element_size) noexcept nogil:
cdef Py_ssize_t count, i, j, offset, byte_index
count = len(src) // element_size
for i in range(count):
Expand All @@ -20,7 +20,7 @@ cpdef void _doShuffle(const unsigned char[::1] src, unsigned char[::1] des, Py_s

@cython.boundscheck(False)
@cython.wraparound(False)
cpdef void _doUnshuffle(const unsigned char[::1] src, unsigned char[::1] des, Py_ssize_t element_size) nogil:
cpdef void _doUnshuffle(const unsigned char[::1] src, unsigned char[::1] des, Py_ssize_t element_size) noexcept nogil:
cdef Py_ssize_t count, i, j, offset, byte_index
count = len(src) // element_size
for i in range(element_size):
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"""


from abc import abstractmethod
from abc import ABC, abstractmethod


class Codec:
class Codec(ABC):
"""Codec abstract base class."""

# override in sub-class
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/jenkins.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ cpdef uint32_t jenkins_lookup3(const uint8_t[::1] _data, uint32_t initval=0):
hash a variable-length key into a 32-bit value
data : the key (unaligned variable-length array of bytes)
initval : can be any 4-byte value, defualts to 0
initval : can be any 4-byte value, defaults to 0
Returns a 32-bit value. Every bit of the key affects every bit of
the return value. Two keys differing by one or two bits will have
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def run_entrypoints():
eps = entry_points()
if hasattr(eps, 'select'):
# If entry_points() has a select method, use that. Python 3.10+
entries.update(eps.select(group="numcodecs.codecs"))
entries.update({e.name: e for e in eps.select(group="numcodecs.codecs")})
else:
# Otherwise, fallback to using get
entries.update(eps.get("numcodecs.codecs", []))
entries.update({e.name: e for e in eps.get("numcodecs.codecs", [])})


run_entrypoints()
Expand Down
3 changes: 2 additions & 1 deletion numcodecs/tests/test_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def set_path():
numcodecs.registry.codec_registry.pop("test")


def test_entrypoint_codec(set_path):
@pytest.mark.usefixtures("set_path")
def test_entrypoint_codec():
cls = numcodecs.registry.get_codec({"id": "test"})
assert cls.codec_id == "test"
32 changes: 32 additions & 0 deletions numcodecs/tests/test_entrypoints_backport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os.path
import pkgutil
import sys

import pytest

from multiprocessing import Process

import numcodecs.registry

if not pkgutil.find_loader("importlib_metadata"): # pragma: no cover
pytest.skip("This test module requires importlib_metadata to be installed")

here = os.path.abspath(os.path.dirname(__file__))


def get_entrypoints_with_importlib_metadata_loaded():
# importlib_metadata patches importlib.metadata, which can lead to breaking changes
# to the APIs of EntryPoint objects used when registering entrypoints. Attempt to
# isolate those changes to just this test.
import importlib_metadata # noqa: F401
sys.path.append(here)
numcodecs.registry.run_entrypoints()
cls = numcodecs.registry.get_codec({"id": "test"})
assert cls.codec_id == "test"


def test_entrypoint_codec_with_importlib_metadata():
p = Process(target=get_entrypoints_with_importlib_metadata_loaded)
p.start()
p.join()
assert p.exitcode == 0
20 changes: 11 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ build-backend = "setuptools.build_meta"
[project]
name = "numcodecs"
description = """
A Python package providing buffer compression and transformation codecs for use
in data storage and communication applications.
"""
A Python package providing buffer compression and transformation codecs \
for use in data storage and communication applications."""
readme = "README.rst"
dependencies = [
"numpy>=1.7",
Expand Down Expand Up @@ -58,6 +57,9 @@ test = [
"pytest",
"pytest-cov",
]
test_extras = [
"importlib_metadata",
]
msgpack = [
"msgpack",
]
Expand Down Expand Up @@ -115,9 +117,9 @@ norecursedirs = [
"numcodecs.egg-info",
]
[tool.cibuildwheel]
environment = { DISABLE_NUMCODECS_AVX2=1 }
[tool.cibuildwheel.macos]
environment = { MACOSX_DEPLOYMENT_TARGET=10.9, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" }
[[tool.cibuildwheel.overrides]]
select = "*-macosx_arm64"
environment = { DISABLE_NUMCODECS_SSE2=1 }
environment = { DISABLE_NUMCODECS_AVX2=1 }
[tool.cibuildwheel.macos]
environment = { MACOSX_DEPLOYMENT_TARGET=10.9, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" }
[[tool.cibuildwheel.overrides]]
select = "*-macosx_arm64"
environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 }

0 comments on commit 949ef2e

Please sign in to comment.