From 05c1bd904713314bf01e1aa7a125e55c79125ef9 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 2 Mar 2026 14:11:51 -0300 Subject: [PATCH 1/2] fix version comparison --- src/netCDF4/_netCDF4.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/netCDF4/_netCDF4.pyx b/src/netCDF4/_netCDF4.pyx index 3470d7a4c..a93075a43 100644 --- a/src/netCDF4/_netCDF4.pyx +++ b/src/netCDF4/_netCDF4.pyx @@ -1288,6 +1288,7 @@ __version__ = "1.7.4.1" # Initialize numpy import posixpath from cftime import date2num, num2date, date2index +from packaging.version import Version import numpy cimport numpy import weakref @@ -2410,7 +2411,7 @@ strings. # flag to indicate that Variables in this Dataset support orthogonal indexing. self.__orthogonal_indexing__ = True - if diskless and __netcdf4libversion__ < '4.2.1': + if diskless and Version(__netcdf4libversion__) < Version('4.2.1'): #diskless = False # don't raise error, instead silently ignore raise ValueError('diskless mode requires netcdf lib >= 4.2.1, you have %s' % __netcdf4libversion__) # convert filename into string (from os.path object for example), From 4a9a4a551ea8c30d57532e99c934c71f41226511 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 2 Mar 2026 14:36:28 -0300 Subject: [PATCH 2/2] packaging was test only --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fc2d049b0..c1ad6fd2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ classifiers = [ dependencies = [ "cftime", "certifi", + "packaging", "numpy>=2.3.0; platform_system == 'Windows' and platform_machine == 'ARM64'", "numpy>=1.21.2; platform_system != 'Windows' or platform_machine != 'ARM64'", ] @@ -45,7 +46,6 @@ dynamic = ["version"] [project.optional-dependencies] tests = [ "Cython", - "packaging", "pytest", "typing-extensions>=4.15.0", ]