Skip to content

Commit da7538e

Browse files
committed
merge
2 parents a4ef678 + 0bb51de commit da7538e

File tree

7 files changed

+45
-27
lines changed

7 files changed

+45
-27
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.10", "3.11", "3.12", "3.13.0"]
15+
python-version: ["3.11", "3.12", "3.13"]
1616
# macos-12 is an intel runner, macos-14 is a arm64 runner
17-
platform: [ubuntu-latest, windows-latest, macos-12, macos-14]
17+
platform: [ubuntu-latest, windows-latest, macos-13, macos-14]
1818

1919
steps:
2020
- name: Checkout source
@@ -23,7 +23,7 @@ jobs:
2323
submodules: recursive
2424

2525
- name: Set up Conda
26-
uses: conda-incubator/setup-miniconda@v3.0.4
26+
uses: conda-incubator/setup-miniconda@v3.1.0
2727
with:
2828
channels: conda-forge
2929
miniforge-version: latest
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Install clang
4747
shell: "bash -l {0}"
48-
if: matrix.platform == 'macos-12'
48+
if: matrix.platform == 'macos-13'
4949
run: |
5050
conda activate env
5151
conda install -y 'clang>=12.0.1,<17'
@@ -64,11 +64,11 @@ jobs:
6464
python -m pip install -v -e .[test,test_extras,msgpack,crc32c]
6565
6666
- name: Install pcodec
67-
if: matrix.python-version != '3.13.0'
67+
if: matrix.python-version != '3.13'
6868
shell: "bash -l {0}"
6969
run: |
7070
conda activate env
71-
python -m pip install -v pcodec
71+
python -m pip install -v ".[pcodec]"
7272
7373
7474
- name: Install zarr-python
@@ -80,7 +80,7 @@ jobs:
8080
8181
# This is used to test with zfpy, which does not yet support numpy 2.0
8282
- name: Install older numpy and zfpy
83-
if: matrix.python-version == '3.10'
83+
if: matrix.python-version == '3.11'
8484
shell: "bash -l {0}"
8585
run: |
8686
conda activate env

.github/workflows/wheel.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
# macos-12 is an intel runner, macos-14 is a arm64 runner
17-
os: [ubuntu-latest, windows-latest, macos-12, macos-14]
16+
# macos-13 is an intel runner, macos-14 is a arm64 runner
17+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
1818
env:
1919
CIBW_TEST_COMMAND: python -c "import numcodecs"
20-
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
20+
CIBW_BUILD: "cp311-* cp312-* cp313-*"
2121
CIBW_SKIP: "pp* *-musllinux_* *win32 *_i686 *_s390x"
2222
# note: CIBW_ENVIRONMENT is now set in pyproject.toml
2323

@@ -44,7 +44,7 @@ jobs:
4444
- uses: actions/setup-python@v5
4545
name: Install Python
4646
with:
47-
python-version: "3.10"
47+
python-version: "3.11"
4848

4949
- name: Build sdist
5050
run: pipx run build --sdist

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: debug-statements
1616

1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.7.0
18+
rev: v0.7.2
1919
hooks:
2020
- id: ruff
2121
args: ["--fix", "--show-fixes"]

docs/release.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@ Fix
1515
~~~
1616
* Fix in-place mutation of input array in `BitRound`.
1717
By :user:`Sam Levang <slevang>`, :issue:`608`
18+
* Fix an issue where importing numcodecs would lock the state of `multiprocessing`
19+
and prevent user code to call `multiprocessing.set_start_method("spawn")`
20+
subsequently.
21+
By :user:`Clément Robert <neutrinoceros>` :issue:`522`
1822

1923
Enhancements
2024
~~~~~~~~~~~~
2125
* Add Crc32c checksum codec
2226
By :user:`Norman Rzepka <normanrz>`, :issue:`613`.
2327

28+
Maintenance
29+
~~~~~~~~~~~
30+
* The minimum supported Python version is now Python 3.11.
31+
By :user:`David Stansby <dstansby>`, :issue:`622`
32+
* The minimum supported numpy version is now 1.24.
33+
By :user:`David Stansby <dstansby>`, :issue:`622`
34+
2435
.. _release_0.13.1:
2536

2637
0.13.1

numcodecs/blosc.pyx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,21 @@ AUTOSHUFFLE = -1
7575
AUTOBLOCKS = 0
7676

7777
# synchronization
78-
try:
79-
mutex = multiprocessing.Lock()
80-
except OSError:
81-
mutex = None
82-
except ImportError:
83-
mutex = None
78+
_MUTEX = None
79+
_MUTEX_IS_INIT = False
80+
81+
def get_mutex():
82+
global _MUTEX_IS_INIT, _MUTEX
83+
if not _MUTEX_IS_INIT:
84+
try:
85+
mutex = multiprocessing.Lock()
86+
except OSError:
87+
mutex = None
88+
except ImportError:
89+
mutex = None
90+
_MUTEX = mutex
91+
_MUTEX_IS_INIT = True
92+
return _MUTEX
8493

8594
# store ID of process that first loads the module, so we can detect a fork later
8695
_importer_pid = os.getpid()
@@ -284,7 +293,7 @@ def compress(source, char* cname, int clevel, int shuffle=SHUFFLE,
284293
# N.B., we are using blosc's global context, and so we need to use a lock
285294
# to ensure no-one else can modify the global context while we're setting it
286295
# up and using it.
287-
with mutex:
296+
with get_mutex():
288297

289298
# set compressor
290299
compressor_set = blosc_set_compressor(cname)
@@ -480,7 +489,7 @@ def _get_use_threads():
480489
proc = multiprocessing.current_process()
481490

482491
# check if locks are available, and if not no threads
483-
if not mutex:
492+
if not get_mutex():
484493
return False
485494

486495
# check for fork

numcodecs/zarr3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import math
55
from dataclasses import dataclass, replace
66
from functools import cached_property
7-
from typing import Any
7+
from typing import Any, Self
88
from warnings import warn
99

1010
import numpy as np
11-
from typing_extensions import Self
1211

1312
import numcodecs
1413

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [
44
"setuptools-scm[toml]>=6.2",
55
"Cython",
66
"py-cpuinfo",
7-
"numpy",
7+
"numpy>2",
88
]
99
build-backend = "setuptools.build_meta"
1010

@@ -15,10 +15,9 @@ A Python package providing buffer compression and transformation codecs \
1515
for use in data storage and communication applications."""
1616
readme = "README.rst"
1717
dependencies = [
18-
"numpy>=1.7",
19-
"typing_extensions",
18+
"numpy>=1.23",
2019
]
21-
requires-python = ">=3.10"
20+
requires-python = ">=3.11"
2221
dynamic = [
2322
"version",
2423
]
@@ -69,7 +68,7 @@ zfpy = [
6968
"numpy<2.0.0",
7069
]
7170
pcodec = [
72-
"pcodec>=0.2.0",
71+
"pcodec>=0.2,<0.3",
7372
]
7473
crc32c = [
7574
"crc32c>=2.7",

0 commit comments

Comments
 (0)