Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cbd46a4
Add plugins to changelog
NotSqrt Nov 18, 2025
b3fe549
add NETCDF_PLUGIN_DIR for windows, macos (these are really just guesses)
Nov 19, 2025
07e7801
try to list contents of brew and conda netcdf packages
Nov 19, 2025
592aae9
another attempt to list contents of conda libnetcdf package on windows
Nov 19, 2025
6683b1f
try again
Nov 19, 2025
21b2c99
try again
Nov 19, 2025
27f42f2
update
Nov 19, 2025
142dfc7
fix glob for plugins on windows
Nov 20, 2025
07566dd
list files in NETCDF_PLUGIN_DIR
Nov 20, 2025
c710d53
try libnetcdf 4.9.3 on windows
Nov 20, 2025
96b2241
use conda for macos wheels
Nov 20, 2025
b856135
fix typo
Nov 20, 2025
eb8824b
fix typo
Nov 20, 2025
9f3445a
try again
Nov 20, 2025
8ba7569
fix paths on macos
Nov 20, 2025
0649847
skip blosc test on windows
Nov 20, 2025
c5e2cea
add repair wheel command with DYLD_LIBRARY_FALLBACK for macos
Nov 20, 2025
3f1e011
set plugin paths
Nov 20, 2025
6ed9a38
fix windows plugin paths
Nov 20, 2025
01cc82c
fix typo
Nov 20, 2025
2586483
another attempt to fix windows plugin path
Nov 20, 2025
8f83e40
set HDF5_PLUGIN_PATH for tests
Nov 21, 2025
5a5a6d2
re-enable blosc test to see failure
Nov 21, 2025
1f1ba33
only need to set plugin path when running tests
Nov 21, 2025
142a6d3
update
Nov 21, 2025
53bed9b
inspect contents of wheels
Nov 21, 2025
f1872de
test adding plugin dir to PATH on windows (so delvewheel will find pl…
Nov 21, 2025
ef4332e
fix typo
Nov 21, 2025
6ca4cb3
try manually adding blosc.dll
Nov 21, 2025
c451db8
try again
Nov 21, 2025
327b711
update
Nov 21, 2025
c6aff59
try again
Nov 21, 2025
a98c9ca
also include lz4 and zstd dlls manually
Nov 21, 2025
907dfa4
mark as xfail
Nov 23, 2025
cb3a007
update
Nov 23, 2025
5764431
remove unzip
Nov 24, 2025
2eed382
bump version number.
Nov 24, 2025
b9dcd8c
change name
Dec 1, 2025
24ec35f
fix name
Dec 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ jobs:
arch: x86_64
- os: ubuntu-22.04
arch: aarch64
- os: macos-14
arch: arm64
- os: macos-13
arch: x86_64

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -99,13 +95,19 @@ jobs:
path: ${{ github.workspace }}/wheelhouse/*.whl


build_wheels_windows:
build_wheels_winmac:
name: Build wheels for ${{matrix.arch}} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
arch: [AMD64]
include:
- os: windows-latest
arch: AMD64
- os: macos-14
arch: arm64
- os: macos-15-intel
arch: x86_64
Comment thread
jswhit marked this conversation as resolved.

steps:
- uses: actions/checkout@v5
Expand All @@ -123,9 +125,9 @@ jobs:
environment-name: build
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} libnetcdf=4.9.2 --channel conda-forge
python=${{ matrix.python-version }} libnetcdf=4.9.3 --channel conda-forge

- name: Build wheels for Windows (${{ matrix.arch }})
- name: Build wheels for Windows/Mac
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_ARCHS: ${{ matrix.arch }}
Expand All @@ -137,7 +139,7 @@ jobs:


show-artifacts:
needs: [build_bdist, build_sdist, build_wheels_windows]
needs: [build_bdist, build_sdist, build_wheels_winmac]
name: "Show artifacts"
runs-on: ubuntu-22.04
steps:
Expand All @@ -153,7 +155,7 @@ jobs:


publish-artifacts-pypi:
needs: [build_bdist, build_sdist, build_wheels_windows]
needs: [build_bdist, build_sdist, build_wheels_winmac]
name: "Publish to PyPI"
runs-on: ubuntu-22.04
# upload to PyPI for every tag starting with 'v'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/miniconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ jobs:

- name: Tests
run: |
#export NO_PLUGINS=YES
export HDF5_PLUGIN_PATH="${CONDA_PREFIX}/hdf5/lib/plugin/"
if [ "$RUNNER_OS" == "Windows" ]; then
export HDF5_PLUGIN_PATH="${CONDA_PREFIX}\\Library\\hdf5\\lib\\plugin"
Comment thread
jswhit marked this conversation as resolved.
else
export HDF5_PLUGIN_PATH="${CONDA_PREFIX}/hdf5/lib/plugin/"
fi
pytest -s -rxs -v test

run-mpi:
Expand Down
2 changes: 2 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
================================
* Make sure automatic conversion of character arrays <--> string arrays works for Unicode strings (issue #1440).
(previously only worked correctly for encoding="ascii").
* Add netcdf plugins (blosc, zstd, bzip2) in wheels. Blosc plugin doesn't work in Windows wheels.
Macos wheels now use conda provided libs. (PR #1450)

version 1.7.3 (tag v1.7.3rel)
=============================
Expand Down
34 changes: 21 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Repository = "https://github.com/Unidata/netcdf4-python"
where = ["src"]

[tool.setuptools.package-data]
"netCDF4.plugins" = ["lib__nc*"]
"netCDF4.plugins" = ["*__nc*"]

[tool.setuptools_scm]

Expand Down Expand Up @@ -122,29 +122,37 @@ test-command = [
]
manylinux-x86_64-image = "ghcr.io/ocefpaf/manylinux_2_28_x86_64-netcdf"
manylinux-aarch64-image = "ghcr.io/ocefpaf/manylinux_2_28_aarch64-netcdf"
environment = {NETCDF4_LIMITED_API="1", NETCDF_PLUGIN_DIR="/usr/local/hdf5/lib/plugin/"}
environment = {NETCDF4_LIMITED_API="1"}

[tool.cibuildwheel.macos]
before-build = "brew install hdf5 netcdf"
# https://cibuildwheel.pypa.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
repair-wheel-command = """\
DYLD_FALLBACK_LIBRARY_PATH=/Users/runner/micromamba/envs/build/lib \
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} \
"""

[tool.cibuildwheel.windows]
before-build = "python -m pip install delvewheel"
repair-wheel-command = [
"delvewheel show --include blosc.dll;zstd.dll;lz4.dll {wheel}",
"delvewheel repair --include blosc.dll;zstd.dll;lz4.dll -w {dest_dir} {wheel}",
]

[[tool.cibuildwheel.overrides]]
select = "*linux*"
environment = {NETCDF_PLUGIN_DIR="/usr/local/hdf5/lib/plugin/"}

[[tool.cibuildwheel.overrides]]
select = "*-macosx_x86_64"
inherit.environment = "append"
environment = {MACOSX_DEPLOYMENT_TARGET="13.0"}
environment = {MACOSX_DEPLOYMENT_TARGET="13.0",HDF5_DIR="/Users/runner/micromamba/envs/build",netCDF4_DIR="/Users/runner/micromamba/envs/build",PATH="${PATH}:/Users/runner/micromamba/envs/build/bin",NETCDF_PLUGIN_DIR="/Users/runner/micromamba/envs/build/hdf5/lib/plugin"}

[[tool.cibuildwheel.overrides]]
select = "*-macosx_arm64"
inherit.environment = "append"
environment = {MACOSX_DEPLOYMENT_TARGET="14.0"}

[tool.cibuildwheel.windows]
before-build = "python -m pip install delvewheel"
repair-wheel-command = [
"delvewheel show {wheel}",
"delvewheel repair -w {dest_dir} {wheel}",
]
environment = {MACOSX_DEPLOYMENT_TARGET="14.0",HDF5_DIR="/Users/runner/micromambe/envs/build",netCDF4_DIR="/Users/runner/micromambe/envs/build",PATH="${PATH}:/Users/runner/micromamba/envs/build/bin",NETCDF_PLUGIN_DIR="/Users/runner/micromamba/envs/build/hdf5/lib/plugin"}

[[tool.cibuildwheel.overrides]]
select = "*-win_*"
inherit.environment = "append"
environment = {HDF5_DIR='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library', netCDF4_DIR='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library', PATH='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\bin;${PATH}' }
environment = {HDF5_DIR='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library',netCDF4_DIR='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library',PATH='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\bin;${PATH}',NETCDF_PLUGIN_DIR='C:\\\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\hdf5\\lib\\plugin'}
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,11 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
copied_plugins=False
if os.environ.get("NETCDF_PLUGIN_DIR"):
plugin_dir = os.environ.get("NETCDF_PLUGIN_DIR")
plugins = glob.glob(os.path.join(plugin_dir, "lib__nc*"))
plugins = glob.glob(os.path.join(plugin_dir, "*__nc*"))
if not plugins:
print('no plugin files in NETCDF_PLUGIN_DIR, not installing...')
print('no plugin files in %s, not installing...' % plugin_dir)
if not os.path.exists(plugin_dir):
print('directory %s does not exist!' % plugin_dir)
data_files = []
else:
data_files = plugins
Expand Down
4 changes: 2 additions & 2 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Version 1.7.3
"""Version 1.7.4
-------------

# Introduction
Expand Down Expand Up @@ -1279,7 +1279,7 @@ import sys
import functools
from typing import Union

__version__ = "1.7.3"
__version__ = "1.7.4"

# Initialize numpy
import posixpath
Expand Down
4 changes: 3 additions & 1 deletion test/test_compression_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from numpy.random.mtrand import uniform
from netCDF4 import Dataset
from numpy.testing import assert_almost_equal
import os, tempfile, unittest, sys
import os, tempfile, unittest, sys, pytest
from filter_availability import no_plugins, has_blosc_filter
if TYPE_CHECKING:
from netCDF4 import CompressionLevel
Expand Down Expand Up @@ -40,6 +40,8 @@ def write_netcdf(filename, dtype='f8', blosc_shuffle: Literal[0, 1, 2] = 1, comp


@unittest.skipIf(no_plugins or not has_blosc_filter, "blosc filter not available")
# allow failures for this test for now (it fails in Windows wheel workflow)
@pytest.mark.xfail
class CompressionTestCase(unittest.TestCase):
def setUp(self):
self.filename = filename
Expand Down