From ca2b2dc6dd0dc96a09345da016394a6f52384b24 Mon Sep 17 00:00:00 2001 From: mxmlnkn Date: Sun, 15 Sep 2024 21:08:24 +0200 Subject: [PATCH] [CI] Test with Python 3.13 and 3.14 --- .github/workflows/tests.yml | 11 ++++++--- core/pyproject.toml | 30 +++++++++++++++++++++---- core/tests/test_BlockParallelReaders.py | 13 ++++++++++- pyproject.toml | 30 +++++++++++++++++++++---- tests/runtests.sh | 12 +++++++--- 5 files changed, 81 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bbf4da82..02350a36 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -69,12 +69,13 @@ jobs: strategy: matrix: - os: [macos-13, ubuntu-latest] + os: ['macos-13', 'ubuntu-latest'] # macos-13 / macos-latest does not work anymore because the dependencies don't have any wheels, # probably because it is M1 based. # ToDo: Add windows-latest but it requires a lot of setup of the dependencies! # Maybe only test ratarmount-core without most dependencies after I have split that off. # Oldest and newest versions should be enough. Python versions are supported 5 years from release date. + # https://endoflife.date/python # 3.5 was released 2015-09-13 and end-of-life was 2020-09-13 # 3.6 was released 2016-12-23 and end-of-life was 2021-12-23 # 3.7 was released 2018-06-27 and end-of-life was 2023-06-27 @@ -84,7 +85,11 @@ jobs: # 3.11 was released 2022-10-24 and end-of-life will be 2027-10 # 3.12 was released 2023-10-02 and end-of-life will be 2028-10 # 3.13 is to be released 2024-10 - python-version: ['3.8', '3.12'] + # 3.14 is to be released 2025-10 + python-version: ['3.8', '3.12', '3.13.0-rc.2'] + include: + - os: ubuntu-latest + python-version: '3.14.0-alpha.0' defaults: run: @@ -139,7 +144,7 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install --upgrade wheel python3 -m pip install --upgrade setuptools - python3 -m pip install --upgrade-strategy eager --upgrade cython twine build zstandard fusepy cffi + python3 -m pip install --upgrade-strategy eager --upgrade twine build fusepy cffi - name: Test Startup With Only One Compression Dependency run: | diff --git a/core/pyproject.toml b/core/pyproject.toml index d74e30fa..f8576918 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -59,8 +59,19 @@ full = [ "PySquashfsImage == 0.9.0", "lz4 ~= 4.0.0", "python-lzo ~= 1.0", - "zstandard ~= 0.22.0", - "isal ~= 1.0", + # https://peps.python.org/pep-0508/ + # Need at least 0.23.0 for Python 3.13 support. + # https://github.com/indygreg/python-zstandard/issues/223 + # The old zstandard-python versions for Python < 3.8 are untested because they are EOL. + "zstandard ~= 0.20.0; python_version == '3.6'", + "zstandard ~= 0.21.0; python_version == '3.7'", + # With Python 3.14, I get ImportError: cannot import name 'ByteString' from 'typing' via + # zstandard/__init__.py:21. + # https://github.com/indygreg/python-zstandard/issues/238 + "zstandard ~= 0.23.0; python_version >= '3.8' and python_version < '3.14'", + # With Python 3.14, when building the wheel, I get: + # /usr/bin/ld: cannot find /tmp/tmpcuw21d78/bin/isa-l.a: No such file or directory + 'isal ~= 1.0; python_version < "3.14.0"', 'pyfatfs ~= 1.0; python_version < "3.12.0"', ] bzip2 = ["rapidgzip >= 0.13.1"] @@ -71,8 +82,19 @@ squashfs = [ "PySquashfsImage == 0.9.0", "lz4 ~= 4.0.0", "python-lzo ~= 1.0", - "zstandard ~= 0.22.0", - "isal ~= 1.0", + # https://peps.python.org/pep-0508/ + # Need at least 0.23.0 for Python 3.13 support. + # https://github.com/indygreg/python-zstandard/issues/223 + # The old zstandard-python versions for Python < 3.8 are untested because they are EOL. + "zstandard ~= 0.20.0; python_version == '3.6'", + "zstandard ~= 0.21.0; python_version == '3.7'", + # With Python 3.14, I get ImportError: cannot import name 'ByteString' from 'typing' via + # zstandard/__init__.py:21. + # https://github.com/indygreg/python-zstandard/issues/238 + "zstandard ~= 0.23.0; python_version >= '3.8' and python_version < '3.14'", + # With Python 3.14, when building the wheel, I get: + # /usr/bin/ld: cannot find /tmp/tmpcuw21d78/bin/isa-l.a: No such file or directory + 'isal ~= 1.0; python_version < "3.14.0"', ] xz = ["python-xz ~= 0.4.0"] zip = [] diff --git a/core/tests/test_BlockParallelReaders.py b/core/tests/test_BlockParallelReaders.py index c93efe91..cf3ae3a0 100644 --- a/core/tests/test_BlockParallelReaders.py +++ b/core/tests/test_BlockParallelReaders.py @@ -16,7 +16,12 @@ import indexed_zstd import pytest import xz -import zstandard + +try: + # May not be installed with Python 3.14 because of incompatibilities. + import zstandard +except ImportError: + zstandard = None # type: ignore sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) @@ -207,6 +212,9 @@ def _createArchive(archivePath: str, streams: int, blocksPerStream: int, blockSi @staticmethod def _testSequentialReading(archivePath: str, bufferSize: int, parallelization: int): + if zstandard is None: + return + with indexed_zstd.IndexedZstdFile(archivePath) as serialFile, ( SeekableZstd(archivePath) if parallelization == 1 else ParallelZstdReader(archivePath, parallelization) ) as parallelFile: @@ -225,6 +233,9 @@ def _testSequentialReading(archivePath: str, bufferSize: int, parallelization: i @staticmethod def _testRandomReads(archivePath: str, samples: int, parallelization: int): + if zstandard is None: + return + with indexed_zstd.IndexedZstdFile(archivePath) as serialFile, ( SeekableZstd(archivePath) if parallelization == 1 else ParallelZstdReader(archivePath, parallelization) ) as parallelFile: diff --git a/pyproject.toml b/pyproject.toml index e6fc67ac..17d43712 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,8 +57,19 @@ full = [ "PySquashfsImage == 0.9.0", "lz4 ~= 4.0.0", "python-lzo ~= 1.0", - "zstandard ~= 0.22.0", - "isal ~= 1.0", + # https://peps.python.org/pep-0508/ + # Need at least 0.23.0 for Python 3.13 support. + # https://github.com/indygreg/python-zstandard/issues/223 + # The old zstandard-python versions for Python < 3.8 are untested because they are EOL. + "zstandard ~= 0.20.0; python_version == '3.6'", + "zstandard ~= 0.21.0; python_version == '3.7'", + # With Python 3.14, I get ImportError: cannot import name 'ByteString' from 'typing' via + # zstandard/__init__.py:21. + # https://github.com/indygreg/python-zstandard/issues/238 + "zstandard ~= 0.23.0; python_version >= '3.8' and python_version < '3.14'", + # With Python 3.14, when building the wheel, I get: + # /usr/bin/ld: cannot find /tmp/tmpcuw21d78/bin/isa-l.a: No such file or directory + 'isal ~= 1.0; python_version < "3.14.0"', ] bzip2 = [] gzip = [] @@ -72,8 +83,19 @@ squashfs = [ "PySquashfsImage == 0.9.0", "lz4 ~= 4.0.0", "python-lzo ~= 1.0", - "zstandard ~= 0.22.0", - "isal ~= 1.0", + # https://peps.python.org/pep-0508/ + # Need at least 0.23.0 for Python 3.13 support. + # https://github.com/indygreg/python-zstandard/issues/223 + # The old zstandard-python versions for Python < 3.8 are untested because they are EOL. + "zstandard ~= 0.20.0; python_version == '3.6'", + "zstandard ~= 0.21.0; python_version == '3.7'", + # With Python 3.14, I get ImportError: cannot import name 'ByteString' from 'typing' via + # zstandard/__init__.py:21. + # https://github.com/indygreg/python-zstandard/issues/238 + "zstandard ~= 0.23.0; python_version >= '3.8' and python_version < '3.14'", + # With Python 3.14, when building the wheel, I get: + # /usr/bin/ld: cannot find /tmp/tmpcuw21d78/bin/isa-l.a: No such file or directory + 'isal ~= 1.0; python_version < "3.14.0"', ] [project.scripts] diff --git a/tests/runtests.sh b/tests/runtests.sh index f36c808d..c5b63f3f 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -1936,7 +1936,7 @@ tests+=( fi # zipfile returns unseekable file object with Python 3.6. Therefore, I disabled it completely there. -python3MinorVersion=$( python3 --version | sed -n -E 's|.* 3[.]([0-9]+)[.][0-9]+|\1|p' ) +python3MinorVersion=$( python3 -c 'import sys; print(sys.version_info.minor)' ) if [[ -n "$python3MinorVersion" && "$python3MinorVersion" -gt 6 ]]; then if ! uname | 'grep' -q -i darwin; then tests+=( @@ -1985,6 +1985,14 @@ tests+=( c157a79031e1c40f85931829bc5fc552 tests/2k-recursive-tars.tar.bz2 mimi/foo ) +# https://github.com/indygreg/python-zstandard/issues/238 +if [[ -n "$python3MinorVersion" && "$python3MinorVersion" -ge 14 ]]; then +pytestedTests+=( + 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.zstd.squashfs foo/fighter/ufo + 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.zstd.squashfs foo/jet/ufo +) +fi + pytestedTests+=( 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.gzip.squashfs foo/fighter/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.lz4.squashfs foo/fighter/ufo @@ -1992,7 +2000,6 @@ pytestedTests+=( 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.lzo.squashfs foo/fighter/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.no-compression.squashfs foo/fighter/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.xz.squashfs foo/fighter/ufo - 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.zstd.squashfs foo/fighter/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.gzip.squashfs foo/jet/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.lz4.squashfs foo/jet/ufo @@ -2000,7 +2007,6 @@ pytestedTests+=( 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.lzo.squashfs foo/jet/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.no-compression.squashfs foo/jet/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.xz.squashfs foo/jet/ufo - 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.zstd.squashfs foo/jet/ufo 2709a3348eb2c52302a7606ecf5860bc tests/file-in-non-existing-folder.rar foo2/ufo 2709a3348eb2c52302a7606ecf5860bc tests/folder-symlink.rar foo/fighter/ufo