diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c5e0fcbf..4768ee2d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,6 @@ jobs: - name: Install dependencies run: | conda install setuptools pip wheel build packaging numpy cython bzip2 hdf5 lzo 'typing_extensions<4.2' - # We can use either the c-blosc2 package in conda/conda-forge or the official wheel (blosc2 in PyPI). - # conda install c-blosc2 pip install -r requirements.txt # conda install sphinx sphinx_rtd_theme numpydoc ipython - name: Source distribution diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2cae8c8c6..40572aee0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -64,8 +64,9 @@ jobs: include: - os: macos-latest arch: x86_64 - - os: macos-latest - arch: arm64 + # Still having issues here: https://github.com/PyTables/PyTables/pull/979 + # - os: macos-latest + # arch: arm64 steps: - uses: actions/checkout@v3 @@ -183,11 +184,14 @@ jobs: os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] python-version: ['3.8', '3.9', '3.10', '3.11'] arch: ['x64'] -# include: -# This cannot be tested because NumPy does not distribute wheels for arm64 -# - arch: arm64 -# cibw_python: "cp*" -# os: macos-latest + include: + - arch: aarch64 + cibw_python: "cp*" + os: ubuntu-latest + # Still having issues with wheels for Mac arm64 + # - arch: arm64 + # cibw_python: "cp*" + # os: macos-latest steps: - uses: actions/download-artifact@v3 @@ -202,7 +206,7 @@ jobs: - name: Install tables on ${{ matrix.python-version }} run: | - python -m pip install cython>=0.29.21 numpy>=1.19.0 numexpr>=2.6.2 packaging py-cpuinfo>=9.0.0 blosc2 + python -m pip install cython>=0.29.21 numpy>=1.19.0 numexpr>=2.6.2 packaging py-cpuinfo>=9.0.0 blosc2~=2.0.0 python -m pip install --no-index --find-links wheelhouse/artifact/ tables - name: Run tests on ${{ matrix.python-version }} diff --git a/doc/source/usersguide/installation.rst b/doc/source/usersguide/installation.rst index 94e6f09aa..c3fd42b9f 100644 --- a/doc/source/usersguide/installation.rst +++ b/doc/source/usersguide/installation.rst @@ -57,8 +57,9 @@ First, make sure that you have * c-blosc_ >= 1.11.1 (sources are bundled with PyTables sources but the user can use an external version of sources using the :envvar:`BLOSC_DIR` environment variable or the `--blosc` flag of the :file:`setup.py`) -* blosc2_ >= 0.6.6 This is the Python wheel containing *both* the C-Blosc2 libs - and headers (>= 2.3.0), as well as the Python wrapper for Blosc2 (not used). +* python-blosc2_ ~= 2.0.0 This is the Python wheel containing *both* the C-Blosc2 libs + and headers (>= 2.6.0), as well as the Python wrapper for Blosc2 (not currently + used, but it might be in the future). installed (for testing purposes, we are using HDF5_ 1.10.7, NumPy_ 1.23.2 and Numexpr_ 2.8.1 currently). If you don't, fetch and install them before @@ -70,7 +71,7 @@ proceeding. .. _Numexpr: http://code.google.com/p/numexpr .. _Cython: http://www.cython.org .. _c-blosc: https://github.com/Blosc/c-blosc -.. _blosc2_: https://github.com/Blosc/python-blosc2 +.. _python-blosc2_: https://github.com/Blosc/python-blosc2 Compile and install these packages (but see :ref:`prerequisitesBinInst` for instructions on how to install pre-compiled binaries if you are not willing diff --git a/pyproject.toml b/pyproject.toml index e1071bf74..022614ad2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,6 @@ requires = [ "packaging", "py-cpuinfo", "Cython >=0.29.21", - "blosc2 >=0.6.6" + "blosc2 ~=2.0.0" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 4646b4c4e..8d2f5d245 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,6 @@ numpy>=1.19.0 numexpr>=2.6.2 # blosc2 wheel is actually only needed when compiling on conda envs. # Otherwise, lib comes bundled in PyTables wheels (but it doesn't hurt either). -blosc2>=0.6.6 +blosc2~=2.0.0 packaging py-cpuinfo diff --git a/setup.py b/setup.py index a32e56b42..966be0286 100755 --- a/setup.py +++ b/setup.py @@ -113,9 +113,7 @@ def get_blosc2_directories(): try: import blosc2 except ModuleNotFoundError: - raise EnvironmentError( - "Cannot find neither the c-blosc2 package nor the " - "python-blosc2 wheel") + raise EnvironmentError("Cannot import the blosc2 requirement") version = blosc2.__version__ basepath = Path(os.path.dirname(blosc2.__file__)) recinfo = basepath.parent / f'blosc2-{version}.dist-info' / 'RECORD' diff --git a/tables/__init__.py b/tables/__init__.py index 9fd8ae173..168ee4e10 100644 --- a/tables/__init__.py +++ b/tables/__init__.py @@ -31,7 +31,7 @@ # Necessary imports to get versions stored on the cython extension from .utilsextension import get_hdf5_version as _get_hdf5_version -__version__ = "3.7.1.dev0" +__version__ = "3.8.0" """The PyTables version number.""" hdf5_version = _get_hdf5_version() diff --git a/tables/tests/test_numpy.py b/tables/tests/test_numpy.py index 18bac2702..931811f02 100644 --- a/tables/tests/test_numpy.py +++ b/tables/tests/test_numpy.py @@ -548,24 +548,24 @@ def test04_setIndexNumPy(self): # Modify row 1 # From PyTables 2.0 on, assignments to records can be done # only as tuples (see http://projects.scipy.org/scipy/numpy/ticket/315) - # table[coords[0]] = ["aasa","x"]+[232]*12 + # table[coords[0]] = ["aasa","x"]+[123]*12 n = len(Record.columns) - 2 - table[coords[0]] = tuple(["aasa", "x"]+[232]*n) # XXX + table[coords[0]] = tuple(["aasa", "x"]+[123]*n) # XXX # record = list(table[coords[0]]) record = table.read(coords[0], coords[0] + 1) if common.verbose: print("Original row:\n" - "['aasa', 'x', True, -24, 232, 232, 232, 232, 232L, " - "232, 232.0, 232.0, (232 + 0j), (232+0j), 232.0, " - "(232+0j)]\n") + "['aasa', 'x', True, 123, 123, 123, 123, 123, 123L, " + "123, 123.0, 123.0, (123 + 0j), (123+0j), 123.0, " + "(123+0j)]\n") print("Read row:\n", record) self.assertEqual(record['var1'], b'aasa') self.assertEqual(record['var2'], b'x') self.assertEqual(record['var3'], True) - self.assertEqual(record['var4'], -24) - self.assertEqual(record['var7'], 232) + self.assertEqual(record['var4'], 123) + self.assertEqual(record['var7'], 123) # The declaration of the nested table: diff --git a/tables/tests/test_timetype.py b/tables/tests/test_timetype.py index 9eae20743..3d4d7a996 100644 --- a/tables/tests/test_timetype.py +++ b/tables/tests/test_timetype.py @@ -348,7 +348,7 @@ def test00_CompareTable(self): row = tbl.row for i in range(nrows): - row['i8col'] = i + row['i8col'] = np.array(i).astype('i1') row['t32col'] = i j = i * 2 row['t64col'] = (j + 0.012, j+1+0.012) diff --git a/tables/tests/test_types.py b/tables/tests/test_types.py index b9d7d0967..11c9af4ba 100644 --- a/tables/tests/test_types.py +++ b/tables/tests/test_types.py @@ -51,7 +51,7 @@ def test00_range(self): i = self.maxshort rec['var1'] = '%04d' % (i) rec['var2'] = i - rec['var3'] = i + rec['var3'] = np.array(i).astype('i2') rec['var4'] = float(i) rec['var5'] = float(i) rec['var6'] = float(i) @@ -83,7 +83,7 @@ def test01_type(self): i = self.maxshort rec['var1'] = '%04d' % (i) rec['var2'] = i - rec['var3'] = i % self.maxshort + rec['var3'] = np.array(i % self.maxshort).astype('i2') rec['var5'] = float(i) with self.assertRaises(TypeError): diff --git a/tables/tests/test_vlarray.py b/tables/tests/test_vlarray.py index 263ded9b7..e7dab1884 100644 --- a/tables/tests/test_vlarray.py +++ b/tables/tests/test_vlarray.py @@ -583,7 +583,7 @@ def test02_BoolAtom(self): atom=tb.BoolAtom(), title="Ragged array of Booleans") vlarray.append([1, 0, 3]) - vlarray.append([-1, 0]) + vlarray.append([1, 0]) if self.reopen: name = vlarray._v_pathname @@ -616,11 +616,11 @@ def test02b_BoolAtom(self): atom=tb.BoolAtom(), title="Ragged array of Booleans") vlarray.append([1, 0, 3]) - vlarray.append([-1, 0]) + vlarray.append([1, 0]) # Modify the rows vlarray[0] = (0, 1, 3) - vlarray[1] = (0, -1) + vlarray[1] = (0, 1) if self.reopen: name = vlarray._v_pathname @@ -663,7 +663,7 @@ def test03_IntAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([1, 2, 3]) - vlarray.append([-1, 0]) + vlarray.append([1, 0]) if self.reopen: name = vlarray._v_pathname @@ -682,7 +682,7 @@ def test03_IntAtom(self): self.assertTrue( common.allequal(row[0], np.array([1, 2, 3], dtype=atype))) self.assertTrue( - common.allequal(row[1], np.array([-1, 0], dtype=atype))) + common.allequal(row[1], np.array([1, 0], dtype=atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -710,7 +710,7 @@ def test03a_IntAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray.append(a0) - a1 = np.array([-1, 0], dtype=atype) + a1 = np.array([1, 0], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray.append(a1) @@ -732,7 +732,7 @@ def test03a_IntAtom(self): self.assertTrue(common.allequal( row[0], np.array([1, 2, 3], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([-1, 0], dtype=ttypes[atype]))) + row[1], np.array([1, 0], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -757,11 +757,11 @@ def test03b_IntAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([1, 2, 3]) - vlarray.append([-1, 0]) + vlarray.append([1, 0]) # Modify rows vlarray[0] = (3, 2, 1) - vlarray[1] = (0, -1) + vlarray[1] = (0, 1) if self.reopen: name = vlarray._v_pathname @@ -780,7 +780,7 @@ def test03b_IntAtom(self): self.assertTrue( common.allequal(row[0], np.array([3, 2, 1], dtype=atype))) self.assertTrue( - common.allequal(row[1], np.array([0, -1], dtype=atype))) + common.allequal(row[1], np.array([0, 1], dtype=atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -806,7 +806,7 @@ def test03c_IntAtom(self): '/', atype, atom=tb.Atom.from_sctype(ttypes[atype])) a0 = np.array([1, 2, 3], dtype=atype) vlarray.append(a0) - a1 = np.array([-1, 0], dtype=atype) + a1 = np.array([1, 0], dtype=atype) vlarray.append(a1) # Modify rows @@ -814,7 +814,7 @@ def test03c_IntAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray[0] = a0 - a1 = np.array([0, -1], dtype=atype) + a1 = np.array([0, 1], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray[1] = a1 @@ -836,7 +836,7 @@ def test03c_IntAtom(self): self.assertTrue(common.allequal( row[0], np.array([3, 2, 1], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([0, -1], dtype=ttypes[atype]))) + row[1], np.array([0, 1], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -864,7 +864,7 @@ def test03d_IntAtom(self): byteorder=byteorder) a0 = np.array([1, 2, 3], dtype=atype) vlarray.append(a0) - a1 = np.array([-1, 0], dtype=atype) + a1 = np.array([1, 0], dtype=atype) vlarray.append(a1) # Modify rows @@ -872,7 +872,7 @@ def test03d_IntAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray[0] = a0 - a1 = np.array([0, -1], dtype=atype) + a1 = np.array([0, 1], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray[1] = a1 @@ -899,7 +899,7 @@ def test03d_IntAtom(self): self.assertTrue(common.allequal( row[0], np.array([3, 2, 1], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([0, -1], dtype=ttypes[atype]))) + row[1], np.array([0, 1], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -923,7 +923,7 @@ def test04_FloatAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([1.3, 2.2, 3.3]) - vlarray.append([-1.3e34, 1.e-32]) + vlarray.append([5.96, .597]) if self.reopen: name = vlarray._v_pathname @@ -942,7 +942,7 @@ def test04_FloatAtom(self): self.assertTrue(common.allequal( row[0], np.array([1.3, 2.2, 3.3], atype))) self.assertTrue(common.allequal( - row[1], np.array([-1.3e34, 1.e-32], atype))) + row[1], np.array([5.96, .597], atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -971,7 +971,7 @@ def test04a_FloatAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray.append(a0) - a1 = np.array([-1.3e34, 1.e-32], dtype=atype) + a1 = np.array([5.96, .597], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray.append(a1) @@ -993,7 +993,7 @@ def test04a_FloatAtom(self): self.assertTrue(common.allequal( row[0], np.array([1.3, 2.2, 3.3], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([-1.3e34, 1.e-32], dtype=ttypes[atype]))) + row[1], np.array([5.96, .597], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1017,11 +1017,11 @@ def test04b_FloatAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([1.3, 2.2, 3.3]) - vlarray.append([-1.3e34, 1.e-32]) + vlarray.append([5.96, .597]) # Modifiy some rows vlarray[0] = (4.3, 2.2, 4.3) - vlarray[1] = (-1.1e34, 1.3e-32) + vlarray[1] = (1.123, 1.1e-3) if self.reopen: name = vlarray._v_pathname @@ -1040,7 +1040,7 @@ def test04b_FloatAtom(self): self.assertTrue(common.allequal( row[0], np.array([4.3, 2.2, 4.3], atype))) self.assertTrue( - common.allequal(row[1], np.array([-1.1e34, 1.3e-32], atype))) + common.allequal(row[1], np.array([1.123, 1.1e-3], atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1067,7 +1067,7 @@ def test04c_FloatAtom(self): '/', atype, atom=tb.Atom.from_sctype(ttypes[atype])) a0 = np.array([1.3, 2.2, 3.3], dtype=atype) vlarray.append(a0) - a1 = np.array([-1, 0], dtype=atype) + a1 = np.array([1, 0], dtype=atype) vlarray.append(a1) # Modify rows @@ -1075,7 +1075,7 @@ def test04c_FloatAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray[0] = a0 - a1 = np.array([-1.1e34, 1.3e-32], dtype=atype) + a1 = np.array([1.123, 1.1e-3], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray[1] = a1 @@ -1097,7 +1097,7 @@ def test04c_FloatAtom(self): self.assertTrue(common.allequal( row[0], np.array([4.3, 2.2, 4.3], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([-1.1e34, 1.3e-32], dtype=ttypes[atype]))) + row[1], np.array([1.123, 1.1e-3], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1126,7 +1126,7 @@ def test04d_FloatAtom(self): byteorder=byteorder) a0 = np.array([1.3, 2.2, 3.3], dtype=atype) vlarray.append(a0) - a1 = np.array([-1, 0], dtype=atype) + a1 = np.array([1, 0], dtype=atype) vlarray.append(a1) # Modify rows @@ -1134,7 +1134,7 @@ def test04d_FloatAtom(self): a0 = a0.byteswap() a0 = a0.newbyteorder() vlarray[0] = a0 - a1 = np.array([-1.1e34, 1.3e-32], dtype=atype) + a1 = np.array([1.123, 1.1e-3], dtype=atype) a1 = a1.byteswap() a1 = a1.newbyteorder() vlarray[1] = a1 @@ -1159,7 +1159,7 @@ def test04d_FloatAtom(self): self.assertTrue(common.allequal( row[0], np.array([4.3, 2.2, 4.3], dtype=ttypes[atype]))) self.assertTrue(common.allequal( - row[1], np.array([-1.1e34, 1.3e-32], dtype=ttypes[atype]))) + row[1], np.array([1.123, 1.1e-3], dtype=ttypes[atype]))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1184,7 +1184,7 @@ def test04_ComplexAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([(1.3 + 0j), (0+2.2j), (3.3+3.3j)]) - vlarray.append([(0-1.3e34j), (1.e-32 + 0j)]) + vlarray.append([(0-5.96j), (.597 + 0j)]) if self.reopen: name = vlarray._v_pathname @@ -1203,7 +1203,7 @@ def test04_ComplexAtom(self): self.assertTrue(common.allequal( row[0], np.array([(1.3 + 0j), (0+2.2j), (3.3+3.3j)], atype))) self.assertTrue(common.allequal( - row[1], np.array([(0-1.3e34j), (1.e-32 + 0j)], atype))) + row[1], np.array([(0-5.96j), (.597 + 0j)], atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1229,11 +1229,11 @@ def test04b_ComplexAtom(self): vlarray = self.h5file.create_vlarray( '/', atype, atom=tb.Atom.from_sctype(atype)) vlarray.append([(1.3 + 0j), (0+2.2j), (3.3+3.3j)]) - vlarray.append([(0-1.3e34j), (1.e-32 + 0j)]) + vlarray.append([(0-5.96j), (.597 + 0j)]) # Modify the rows vlarray[0] = ((1.4 + 0j), (0+4.2j), (3.3+4.3j)) - vlarray[1] = ((4-1.3e34j), (1.e-32 + 4j)) + vlarray[1] = ((4-5.96j), (.597 + 4j)) if self.reopen: name = vlarray._v_pathname @@ -1252,7 +1252,7 @@ def test04b_ComplexAtom(self): self.assertTrue(common.allequal( row[0], np.array([(1.4 + 0j), (0+4.2j), (3.3+4.3j)], atype))) self.assertTrue(common.allequal( - row[1], np.array([(4-1.3e34j), (1.e-32 + 4j)], atype))) + row[1], np.array([(4-5.96j), (.597 + 4j)], atype))) self.assertEqual(len(row[0]), 3) self.assertEqual(len(row[1]), 2) @@ -1741,7 +1741,7 @@ def test02_BoolAtom(self): tb.BoolAtom(shape=(3,)), "Ragged array of Booleans") vlarray.append([(1, 0, 3), (1, 1, 1), (0, 0, 0)]) - vlarray.append([(-1, 0, 0)]) + vlarray.append([(1, 0, 0)]) # Read all the rows: row = vlarray.read() @@ -1773,7 +1773,7 @@ def test02b_BoolAtom(self): a = np.array( [(0, 0, 0), (1, 0, 3), (1, 1, 1), (0, 0, 0)], dtype='bool') vlarray.append(a[1:]) # Create an offset - a = np.array([(1, 1, 1), (-1, 0, 0)], dtype='bool') + a = np.array([(1, 1, 1), (1, 0, 0)], dtype='bool') vlarray.append(a[1:]) # Create an offset # Read all the rows: @@ -1806,7 +1806,7 @@ def test02c_BoolAtom(self): a = np.array( [(0, 0, 0), (1, 0, 3), (1, 1, 1), (0, 0, 0)], dtype='bool') vlarray.append(a[1::2]) # Create an strided array - a = np.array([(1, 1, 1), (-1, 0, 0), (0, 0, 0)], dtype='bool') + a = np.array([(1, 1, 1), (1, 0, 0), (0, 0, 0)], dtype='bool') vlarray.append(a[::2]) # Create an strided array # Read all the rows: @@ -2360,7 +2360,7 @@ def test04_FloatAtom(self): vlarray.flavor = self.flavor vlarray.append([1.3, 2.2, 3.3]) vlarray.append(()) - vlarray.append([-1.3e34, 1.e-32]) + vlarray.append([5.96, .597]) # Read all the rows: row = vlarray.read() @@ -2377,11 +2377,11 @@ def test04_FloatAtom(self): if self.flavor == "python": arr1 = list(np.array([1.3, 2.2, 3.3], atype)) arr2 = list(np.array([], atype)) - arr3 = list(np.array([-1.3e34, 1.e-32], atype)) + arr3 = list(np.array([5.96, .597], atype)) elif self.flavor == "numpy": arr1 = np.array([1.3, 2.2, 3.3], dtype=atype) arr2 = np.array([], dtype=atype) - arr3 = np.array([-1.3e34, 1.e-32], dtype=atype) + arr3 = np.array([5.96, .597], dtype=atype) if self.flavor == "numpy": self.assertTrue(common.allequal(row[0], arr1, self.flavor))