From 076150fb6caf9fa361a8b63c2239d153f48b8d1c Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 00:14:24 +0000 Subject: [PATCH 01/38] Add github actions status badge to README --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 15ba444..b9dcfa7 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,8 @@ python-lz4 Status ====== -.. image:: https://travis-ci.org/python-lz4/python-lz4.svg?branch=master - :target: https://travis-ci.org/python-lz4/python-lz4 +.. image:: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml/badge.svg + :target: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml :alt: Build Status .. image:: https://ci.appveyor.com/api/projects/status/r2qvw9mlfo63lklo/branch/master?svg=true From 8a4aa23aca1255de5e29fc09994b0a8cd7c404a5 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 00:29:53 +0000 Subject: [PATCH 02/38] Remove AppVeyor badge from README --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index b9dcfa7..a75bc4d 100644 --- a/README.rst +++ b/README.rst @@ -9,10 +9,6 @@ Status :target: https://github.com/python-lz4/python-lz4/actions/workflows/build_dist.yml :alt: Build Status -.. image:: https://ci.appveyor.com/api/projects/status/r2qvw9mlfo63lklo/branch/master?svg=true - :target: https://ci.appveyor.com/project/jonathanunderwood/python-lz4 - :alt: Build Status Windows - .. image:: https://readthedocs.org/projects/python-lz4/badge/?version=stable :target: https://readthedocs.org/projects/python-lz4/ :alt: Documentation From d47235998c3f54d355646b61e7ff19a182f01ac5 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 20:40:20 +0000 Subject: [PATCH 03/38] Remove dependency on distutils (#236) --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2f2704f..b499e01 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ #!/usr/bin/env python import os from setuptools import setup, find_packages, Extension +from setuptools.command.build_ext import new_compiler import sys -from distutils import ccompiler + # Note: if updating LZ4_REQUIRED_VERSION you need to update docs/install.rst as # well. @@ -97,7 +98,7 @@ def pkgconfig_installed_check(lib, required_version, default): ] ) -compiler = ccompiler.get_default_compiler() +compiler = new_compiler().compiler_type if compiler == 'msvc': extension_kwargs['extra_compile_args'] = [ From acd7557dd837966961e02c3a958d04f700e3d8b8 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:39:49 +0000 Subject: [PATCH 04/38] Add env var to control building against system LZ4 --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b499e01..32f3434 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,13 @@ def pkgconfig_installed_check(lib, required_version, default): 'lz4/stream/_stream.c' ] -if liblz4_found is True: +use_system_liblz4_env = os.environ.get("PYLZ4_USE_SYSTEM_LZ4", "True") +if use_system_liblz4_env.upper() in ("1", "TRUE"): + use_system_liblz4 = True +else: + use_system_liblz4 = False + +if liblz4_found is True and use_system_liblz4 is True: extension_kwargs['libraries'] = ['lz4'] else: extension_kwargs['include_dirs'] = ['lz4libs'] From 9a1d7c2ef09b01c00db8da31fc36c0ca73e59a14 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:40:57 +0000 Subject: [PATCH 05/38] Force using bundled LZ4 when building wheels --- .github/workflows/build_dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 2c93cdd..c02e25e 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -53,6 +53,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.11.4 env: + PYLZ4_USE_SYSTEM_LZ4: "False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_MACOS: "x86_64 arm64" # universal2" CIBW_ARCHS_WINDOWS: "AMD64 x86" From 783967171cbfa6c29807cf21b9d64fbb9e86cbab Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:42:27 +0000 Subject: [PATCH 06/38] Clean up handling of PYLZ4_EXPERIMENTAL --- setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 32f3434..f793adf 100644 --- a/setup.py +++ b/setup.py @@ -36,12 +36,11 @@ def pkgconfig_installed_check(lib, required_version, default): liblz4_found = pkgconfig_installed_check('liblz4', LZ4_REQUIRED_VERSION, default=False) # Establish if we want to build experimental functionality or not. -experimental = os.environ.get("PYLZ4_EXPERIMENTAL", False) -if experimental is not False: - if experimental.upper() in ("1", "TRUE"): - experimental = True - else: - experimental = False +experimental_env = os.environ.get("PYLZ4_EXPERIMENTAL", "False") +if experimental_env.upper() in ("1", "TRUE"): + experimental = True +else: + experimental = False # Set up the extension modules. If a system wide lz4 library is found, and is # recent enough, we'll use that. Otherwise we'll build with the bundled one. If From d1a071add32e9140324f2729c783211471ecdfd9 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 21:59:46 +0000 Subject: [PATCH 07/38] Ensure PYLZ4_USE_SYSTEM_LZ4 env var passed to cibuildwheel --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index c02e25e..6fd9b2f 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -53,7 +53,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.11.4 env: - PYLZ4_USE_SYSTEM_LZ4: "False" + CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_MACOS: "x86_64 arm64" # universal2" CIBW_ARCHS_WINDOWS: "AMD64 x86" From b1b3afd4dc37816c1a93a471e89761f5256d45db Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Fri, 30 Dec 2022 22:16:46 +0000 Subject: [PATCH 08/38] Don't link against system lz4 if PYLZ4_USE_SYSTEM_LZ4 is not True --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f793adf..387f5c8 100644 --- a/setup.py +++ b/setup.py @@ -113,7 +113,7 @@ def pkgconfig_installed_check(lib, required_version, default): '/wd4820', ] elif compiler in ('unix', 'mingw32'): - if liblz4_found: + if liblz4_found is True and use_system_liblz4 is True: extension_kwargs = pkgconfig_parse('liblz4') else: extension_kwargs['extra_compile_args'] = [ From 231b29c2776128c1a8c8ab5d5cec765c00615966 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Sat, 31 Dec 2022 00:26:27 +0000 Subject: [PATCH 09/38] Add .readthedocs.yml --- .readthedocs.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..1ad8c58 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,25 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-20.04 + tools: + python: "3.11" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# If using Sphinx, optionally build your docs in additional formats such as PDF +formats: + - pdf + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: docs/requirements.txt From 837d0d68d1b97a91a432aecf0e983f8fe8d60ba3 Mon Sep 17 00:00:00 2001 From: David Evans Date: Thu, 21 Dec 2023 08:30:22 +0000 Subject: [PATCH 10/38] Use `importlib.metadata` over `pkg_resources` This is "The Modern Way" and is requoired for Python 3.12. https://docs.python.org/3.12/library/importlib.metadata.html As `importlib.metadata` was added in Python 3.8, and as we still support Python 3.7, we add a fallback import for older versions. --- docs/conf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 51b6576..aefff88 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,8 +55,13 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -from pkg_resources import get_distribution -release = get_distribution('lz4').version +try: + import importlib.metadata +except ImportError: + from pkg_resources import get_distribution + release = get_distribution('lz4').version +else: + release = importlib.metadata.version('lz4') version = release # The language for content autogenerated by Sphinx. Refer to documentation From d41a6760eeed3800edf02ad862c976b5daedfd70 Mon Sep 17 00:00:00 2001 From: David Evans Date: Thu, 21 Dec 2023 08:09:25 +0000 Subject: [PATCH 11/38] Add Python 3.12 to the build matrix This required updating to the latest version of `pypa/cibuildwheel`. --- .github/workflows/build_dist.yml | 4 ++-- setup.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 6fd9b2f..19999af 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*, cp311-*] + cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*, cp311-*, cp312-*] steps: - name: Check out repository uses: actions/checkout@v3 @@ -51,7 +51,7 @@ jobs: with: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.11.4 + uses: pypa/cibuildwheel@v2.16.2 env: CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" diff --git a/setup.py b/setup.py index 387f5c8..2fbd2ca 100644 --- a/setup.py +++ b/setup.py @@ -205,5 +205,6 @@ def pkgconfig_installed_check(lib, required_version, default): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], ) From b8844b1443b449302dc973e49e895c0fe0d84374 Mon Sep 17 00:00:00 2001 From: David Evans Date: Thu, 21 Dec 2023 13:53:16 +0000 Subject: [PATCH 12/38] Add explicit dependency on `setuptools` --- .github/workflows/build_dist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 19999af..682b69d 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -22,6 +22,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.x + - name: Install setuptools + run: pip install setuptools - name: Build sdist run: python setup.py sdist - name: Save sdist From 7182e7d0bd7d70db65cc4f32cf0462c7fb71f5cb Mon Sep 17 00:00:00 2001 From: David Evans Date: Thu, 21 Dec 2023 14:11:30 +0000 Subject: [PATCH 13/38] Drop support for Python 3.7 This reached end-of-life in June 2023: https://devguide.python.org/versions/#unsupported-versions And attempting to build the wheel fails with an error: ``` docs: install_package_deps /project> python -I -m pip install sphinx-bootstrap-theme 'sphinx>=1.6.0' docs: install_package /project> python -I -m pip install --force-reinstall --no-deps /project/.tox/.tmp/package/3/lz4-0.1.dev1180+g91fe6ef-0.editable-cp37-cp37m-linux_x86_64.whl docs: commands[0] /project> make -C docs doctest html make: Entering directory `/project/docs' sphinx-build -b doctest -d _build/doctrees . _build/doctest Running Sphinx v5.3.0 Extension error: Could not import extension sphinx.builders.linkcheck (exception: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168) ``` --- .github/workflows/build_dist.yml | 2 +- docs/install.rst | 2 +- setup.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 682b69d..fe70b79 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -37,7 +37,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*, cp311-*, cp312-*] + cibw_build: [cp38-*, cp39-*, cp310-*, cp311-*, cp312-*] steps: - name: Check out repository uses: actions/checkout@v3 diff --git a/docs/install.rst b/docs/install.rst index 3d531f7..664ffd3 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -22,7 +22,7 @@ The LZ4 bindings require linking to the LZ4 library, and so if there is not a pre-compiled wheel available for your platform you will need to have a suitable C compiler available, as well as the Python development header files. On Debian/Ubuntu based systems the header files for Python are found in the -distribution package ``pythonX.Y-dev`` e.g. ``python3.7-dev``. On Fedora/Red Hat +distribution package ``pythonX.Y-dev`` e.g. ``python3.8-dev``. On Fedora/Red Hat based systems, the Python header files are found in the distribution package ``python-devel``. diff --git a/setup.py b/setup.py index 2fbd2ca..f3a226d 100644 --- a/setup.py +++ b/setup.py @@ -171,7 +171,7 @@ def pkgconfig_installed_check(lib, required_version, default): use_scm_version={ 'write_to': "lz4/version.py", }, - python_requires=">=3.7", + python_requires=">=3.8", setup_requires=[ 'setuptools_scm', 'pkgconfig', @@ -200,7 +200,6 @@ def pkgconfig_installed_check(lib, required_version, default): 'Intended Audience :: Developers', 'Programming Language :: C', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', From a71746a0f210dd54e9b6ef94f558e896e218616a Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Sun, 7 Jan 2024 13:09:48 +1000 Subject: [PATCH 14/38] fix(doc): Install command missing a parameter The `--no-binary` option needs a parameter, as indicated in the pip documentation here https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-no-binary --- docs/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install.rst b/docs/install.rst index 664ffd3..f6eeafe 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -40,7 +40,7 @@ this command will result in the extension modules being compiled from source:: On systems for which pre-built wheels are available, the following command will force a local compilation of the extension modules from source:: - $ pip install --no-binary --no-cache-dir lz4 + $ pip install --no-binary :all: --no-cache-dir lz4 The package can also be installed manually from a checkout of the source code git repository:: From 4929607b62e9275368677b73f4372d0101f400b7 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 7 Mar 2024 09:34:04 +0100 Subject: [PATCH 15/38] docs/lz4.block.rst: fix typo --- docs/lz4.block.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lz4.block.rst b/docs/lz4.block.rst index 0b2ef10..5c7f0c7 100644 --- a/docs/lz4.block.rst +++ b/docs/lz4.block.rst @@ -84,7 +84,7 @@ can be used in this case. True In this example we are catching the `lz4.block.LZ4BlockError` -exception. This exception is raisedd if the LZ4 library call fails, +exception. This exception is raised if the LZ4 library call fails, which can be caused by either the buffer used to store the uncompressed data (as set by `usize`) being too small, or the input compressed data being invalid - it is not possible to distinguish the From d2248984f30156726423ab1b31790fc16e031c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Wed, 18 Sep 2024 17:10:31 +0000 Subject: [PATCH 16/38] Update CI - Updates all GH Actions to their latest versions - Removes Python 3.8 (EOL) - Adds Python 3.13 - Stops fail-fast to avoid wasting builds for a single failure --- .github/workflows/build_dist.yml | 70 +++++++++++++++++++------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index fe70b79..b38968d 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -9,55 +9,68 @@ on: types: [created] pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: sdist: name: Build source distribution runs-on: ubuntu-latest steps: - - name: Check out repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 # To ensure tags are retrieved to enabe setuptools_scm to work - - name: Install Python 3.x - uses: actions/setup-python@v4 - with: - python-version: 3.x - - name: Install setuptools - run: pip install setuptools - - name: Build sdist - run: python setup.py sdist - - name: Save sdist - uses: actions/upload-artifact@v3 - with: - path: dist/*.tar.gz + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # To ensure tags are retrieved to enabe setuptools_scm to work + - name: Install Python 3.x + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Install setuptools + run: pip install setuptools + - name: Build sdist + run: python setup.py sdist + - name: Save sdist + uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz wheels: name: Build wheels on ${{ matrix.os }} CIBW_BUILD=${{ matrix.cibw_build }} runs-on: ${{ matrix.os }} strategy: + # since multiple builds run at the same time, cancelling them all when one + # fails is wasteful and forces handling build problems one by one instead + # of showing a "full picture" + fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - cibw_build: [cp38-*, cp39-*, cp310-*, cp311-*, cp312-*] + os: + - ubuntu-latest + - macos-13 # x86 + - macos-latest # arm + - windows-latest + cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*] steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - fetch-depth: 0 # To ensure tags are retrieved to enabe setuptools_scm to work + fetch-depth: 0 # To ensure tags are retrieved to enabe setuptools_scm to work - name: Install Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x - - name: Set up QEMU # Needed to build aarch64 wheels + - name: Set up QEMU # Needed to build aarch64 wheels if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.21 env: CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" - CIBW_ARCHS_MACOS: "x86_64 arm64" # universal2" + CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches CIBW_ARCHS_WINDOWS: "AMD64 x86" CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" @@ -65,8 +78,9 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-*linux_{aarch64,ppc64le,s390x}" CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" - name: Save wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ strategy.job-index }} path: wheelhouse/*.whl upload_pypi: @@ -75,9 +89,9 @@ jobs: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: artifact + pattern: cibw-* path: dist - uses: pypa/gh-action-pypi-publish@release/v1 with: From feb19af092628ed0804814dd161084700a33bcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Thu, 17 Oct 2024 08:58:50 +0000 Subject: [PATCH 17/38] Update setup.py Python versions --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f3a226d..9bc91f0 100644 --- a/setup.py +++ b/setup.py @@ -171,7 +171,7 @@ def pkgconfig_installed_check(lib, required_version, default): use_scm_version={ 'write_to': "lz4/version.py", }, - python_requires=">=3.8", + python_requires=">=3.9", setup_requires=[ 'setuptools_scm', 'pkgconfig', @@ -200,10 +200,10 @@ def pkgconfig_installed_check(lib, required_version, default): 'Intended Audience :: Developers', 'Programming Language :: C', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ], ) From 4d9bced9173c6deb9c19e46d07b16861df8fc539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Thu, 14 Nov 2024 11:25:02 +0000 Subject: [PATCH 18/38] revert artifact renaming --- .github/workflows/build_dist.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index b38968d..ad4763b 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -33,7 +33,6 @@ jobs: - name: Save sdist uses: actions/upload-artifact@v4 with: - name: cibw-sdist path: dist/*.tar.gz wheels: @@ -80,7 +79,6 @@ jobs: - name: Save wheels uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ strategy.job-index }} path: wheelhouse/*.whl upload_pypi: @@ -91,9 +89,9 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: cibw-* + pattern: artifact path: dist - uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} - skip_existing: true + skip-existing: true From a46e255cb7b64ece87ec63b3bdd2a1d87fe3cacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Thu, 14 Nov 2024 17:14:08 +0000 Subject: [PATCH 19/38] Add file extensions to uploaded archives --- .github/workflows/build_dist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index ad4763b..1e815c1 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -33,6 +33,7 @@ jobs: - name: Save sdist uses: actions/upload-artifact@v4 with: + name: cibw-sdist.tar.gz path: dist/*.tar.gz wheels: @@ -79,6 +80,7 @@ jobs: - name: Save wheels uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ strategy.job-index }}.whl path: wheelhouse/*.whl upload_pypi: @@ -89,7 +91,7 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: artifact + pattern: cibw-* path: dist - uses: pypa/gh-action-pypi-publish@release/v1 with: From be4b2a92feb2a2db91bd627db2ed49cdc3ad6521 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Sun, 26 Jan 2025 18:28:09 +0000 Subject: [PATCH 20/38] Fix publishing to pypi --- .github/workflows/build_dist.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 1e815c1..3189d4a 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -80,8 +80,8 @@ jobs: - name: Save wheels uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ strategy.job-index }}.whl - path: wheelhouse/*.whl + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl upload_pypi: name: Upload to PyPI @@ -93,6 +93,7 @@ jobs: with: pattern: cibw-* path: dist + merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} From b5e5217b1a783da004efef0b0d2ea0ce64241b84 Mon Sep 17 00:00:00 2001 From: "Jonathan G. Underwood" Date: Sun, 26 Jan 2025 19:42:04 +0000 Subject: [PATCH 21/38] Disable aarch64 builds due to compiler failure --- .github/workflows/build_dist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 3189d4a..879db7d 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -69,7 +69,8 @@ jobs: uses: pypa/cibuildwheel@v2.21 env: CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" - CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" + # CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" + CIBW_ARCHS_LINUX: "x86_64 i686" CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches CIBW_ARCHS_WINDOWS: "AMD64 x86" CIBW_BUILD: ${{ matrix.cibw_build }} From b20fdf35e659d697bcc82a81ac0aec6bf95bdbc3 Mon Sep 17 00:00:00 2001 From: Rudolf Kolbe Date: Wed, 2 Apr 2025 00:03:43 +0200 Subject: [PATCH 22/38] build_dist workflow - (re)add arm support for Linux and Windows (#300) This enables Arm support for Linux and Windows. --- .github/workflows/build_dist.yml | 46 +++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 879db7d..ac70871 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -26,10 +26,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.x - - name: Install setuptools - run: pip install setuptools - name: Build sdist - run: python setup.py sdist + run: pipx run build --sdist - name: Save sdist uses: actions/upload-artifact@v4 with: @@ -72,11 +70,47 @@ jobs: # CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_LINUX: "x86_64 i686" CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches - CIBW_ARCHS_WINDOWS: "AMD64 x86" + CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64" + CIBW_BUILD: ${{ matrix.cibw_build }} + CIBW_SKIP: "cp*-musllinux*" + CIBW_TEST_COMMAND: "tox -c {project}" + CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-*linux_{ppc64le,s390x} *-win_arm64" + CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" + - name: Save wheels + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + wheels_linux_arm: + name: Build wheels on ${{ matrix.os }} CIBW_BUILD=${{ matrix.cibw_build }} + runs-on: ${{ matrix.os }} + strategy: + # since multiple builds run at the same time, cancelling them all when one + # fails is wasteful and forces handling build problems one by one instead + # of showing a "full picture" + fail-fast: false + matrix: + os: + - ubuntu-24.04-arm + cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*] + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # To ensure tags are retrieved to enabe setuptools_scm to work + - name: Install Python 3.x + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: pypa/cibuildwheel@v2.21 + env: + CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" + CIBW_ARCHS_LINUX: "aarch64 armv7l" CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" CIBW_TEST_COMMAND: "tox -c {project}" - CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-*linux_{aarch64,ppc64le,s390x}" CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" - name: Save wheels uses: actions/upload-artifact@v4 @@ -86,7 +120,7 @@ jobs: upload_pypi: name: Upload to PyPI - needs: [sdist, wheels] + needs: [sdist, wheels, wheels_linux_arm] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: From 7633d8d48f4b8ff6da495e0c426ee292d00b97e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Mon, 17 Mar 2025 16:09:57 -0500 Subject: [PATCH 23/38] Enable CPython free-threaded wheel builds --- .github/workflows/build_dist.yml | 11 ++++++++- lz4/_version.c | 4 +++ lz4/block/_block.c | 4 +++ lz4/frame/_frame.c | 4 +++ lz4/stream/_stream.c | 4 +++ tests/block/conftest.py | 18 ++++++++++++++ tests/block/test_block_0.py | 14 ++++++++++- tests/block/test_block_3.py | 1 + tests/frame/test_frame_2.py | 7 ++++++ tests/frame/test_frame_5.py | 8 +++--- tests/frame/test_frame_6.py | 42 +++++++++++++++++++------------- tests/frame/test_frame_8.py | 8 +++--- tests/frame/test_frame_9.py | 25 +++++++++++-------- tests/stream/test_stream_0.py | 1 + tests/stream/test_stream_3.py | 1 + 15 files changed, 117 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index ac70871..b1e325c 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -48,7 +48,7 @@ jobs: - macos-13 # x86 - macos-latest # arm - windows-latest - cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*] + cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*, cp313t-*] steps: - name: Check out repository uses: actions/checkout@v4 @@ -63,6 +63,14 @@ jobs: uses: docker/setup-qemu-action@v3 with: platforms: all + + - name: Setup free-threading variables + if: ${{ endsWith(matrix.cibw_build, 't-*') }} + shell: bash -l {0} + run: | + echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" + echo "TOX_OVERRIDE=testenv.deps+=pytest-run-parallel" >> "$GITHUB_ENV" + echo "PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" - name: Build wheels uses: pypa/cibuildwheel@v2.21 env: @@ -110,6 +118,7 @@ jobs: CIBW_ARCHS_LINUX: "aarch64 armv7l" CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" + CIBW_ENABLE: cpython-freethreading CIBW_TEST_COMMAND: "tox -c {project}" CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" - name: Save wheels diff --git a/lz4/_version.c b/lz4/_version.c index c611f0b..7795241 100644 --- a/lz4/_version.c +++ b/lz4/_version.c @@ -113,5 +113,9 @@ PyInit__version(void) if (module == NULL) return NULL; + #ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + #endif + return module; } diff --git a/lz4/block/_block.c b/lz4/block/_block.c index 3e904a0..daa9fd5 100644 --- a/lz4/block/_block.c +++ b/lz4/block/_block.c @@ -518,5 +518,9 @@ PyInit__block(void) Py_INCREF(LZ4BlockError); PyModule_AddObject(module, "LZ4BlockError", LZ4BlockError); + #ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + #endif + return module; } diff --git a/lz4/frame/_frame.c b/lz4/frame/_frame.c index 3460665..d081cce 100644 --- a/lz4/frame/_frame.c +++ b/lz4/frame/_frame.c @@ -1677,5 +1677,9 @@ PyInit__frame(void) PyModule_AddIntConstant (module, "BLOCKSIZE_MAX1MB", LZ4F_max1MB); PyModule_AddIntConstant (module, "BLOCKSIZE_MAX4MB", LZ4F_max4MB); + #ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + #endif + return module; } diff --git a/lz4/stream/_stream.c b/lz4/stream/_stream.c index 522fded..6351d96 100644 --- a/lz4/stream/_stream.c +++ b/lz4/stream/_stream.c @@ -1649,5 +1649,9 @@ PyInit__stream(void) Py_INCREF (LZ4StreamError); PyModule_AddObject (module, "LZ4StreamError", LZ4StreamError); + #ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + #endif + return module; } diff --git a/tests/block/conftest.py b/tests/block/conftest.py index 0b3578e..b25c239 100644 --- a/tests/block/conftest.py +++ b/tests/block/conftest.py @@ -3,6 +3,24 @@ import sys +class EmptyMemoryView(): + def __init__(self): + self.data = b'' + self.view = None + + def __buffer__(self, flags: int, /) -> memoryview: + if self.view is None: + self.view = memoryview(self.data) + return self.view + + def __release_buffer__(self, buffer: memoryview, /): + breakpoint() + buffer.release() + + def __len__(self): + return 0 + + test_data = [ (b''), (os.urandom(8 * 1024)), diff --git a/tests/block/test_block_0.py b/tests/block/test_block_0.py index 8fc0f48..31513b4 100644 --- a/tests/block/test_block_0.py +++ b/tests/block/test_block_0.py @@ -1,6 +1,9 @@ import lz4.block from multiprocessing.pool import ThreadPool import sys +import copy +import inspect +import pytest from functools import partial if sys.version_info <= (3, 2): import struct @@ -79,10 +82,19 @@ def test_1(data, mode, store_size, c_return_bytearray, d_return_bytearray, dicti # Test multi threaded usage with all valid variations of input +@pytest.mark.thread_unsafe def test_2(data, mode, store_size, dictionary): (c_kwargs, d_kwargs) = setup_kwargs(mode, store_size) - data_in = [data for i in range(32)] + def copy_buf(data): + data_x = data + if isinstance(data, memoryview): + data_x = memoryview(copy.deepcopy(data.obj)) + elif isinstance(data, bytearray): + data_x = bytearray(copy.deepcopy(data.__buffer__(inspect.BufferFlags.FULL_RO).obj)) + return data_x + + data_in = [copy_buf(data) for i in range(32)] pool = ThreadPool(2) rt = partial(roundtrip, c_kwargs=c_kwargs, diff --git a/tests/block/test_block_3.py b/tests/block/test_block_3.py index 3fcb175..88461b7 100644 --- a/tests/block/test_block_3.py +++ b/tests/block/test_block_3.py @@ -18,6 +18,7 @@ def data(request): return request.param +@pytest.mark.thread_unsafe def test_block_decompress_mem_usage(data): tracemalloc = pytest.importorskip('tracemalloc') diff --git a/tests/frame/test_frame_2.py b/tests/frame/test_frame_2.py index 80b44b8..14a3f6b 100644 --- a/tests/frame/test_frame_2.py +++ b/tests/frame/test_frame_2.py @@ -1,6 +1,8 @@ import lz4.frame as lz4frame import pytest import os +import copy +import inspect import sys from . helpers import ( get_chunked, @@ -41,6 +43,11 @@ def test_roundtrip_chunked(data, block_size, block_linked, data, c_chunks, d_chunks = data + if isinstance(data, memoryview): + data = memoryview(copy.deepcopy(data.obj)) + elif isinstance(data, bytearray): + data = bytearray(copy.deepcopy(data.__buffer__(inspect.BufferFlags.FULL_RO).obj)) + c_context = lz4frame.create_compression_context() kwargs = {} diff --git a/tests/frame/test_frame_5.py b/tests/frame/test_frame_5.py index 05daf28..4083646 100644 --- a/tests/frame/test_frame_5.py +++ b/tests/frame/test_frame_5.py @@ -8,6 +8,8 @@ (b'a' * 1024 * 1024), ] +pytestmark = pytest.mark.thread_unsafe + @pytest.fixture( params=test_data, @@ -66,17 +68,17 @@ def test_frame_decompress_chunk_mem_usage(data): prev_snapshot = snapshot -def test_frame_open_decompress_mem_usage(data): +def test_frame_open_decompress_mem_usage(tmp_path, data): tracemalloc = pytest.importorskip('tracemalloc') tracemalloc.start() - with lz4.frame.open('test.lz4', 'w') as f: + with lz4.frame.open(tmp_path / 'test.lz4', 'w') as f: f.write(data) prev_snapshot = None for i in range(1000): - with lz4.frame.open('test.lz4', 'r') as f: + with lz4.frame.open(tmp_path / 'test.lz4', 'r') as f: decompressed = f.read() # noqa: F841 if i % 100 == 0: diff --git a/tests/frame/test_frame_6.py b/tests/frame/test_frame_6.py index c20a4f3..4f4185e 100644 --- a/tests/frame/test_frame_6.py +++ b/tests/frame/test_frame_6.py @@ -1,5 +1,6 @@ import os import pytest +import threading import lz4.frame as lz4frame test_data = [ @@ -33,40 +34,45 @@ def compression_level(request): return request.param -def test_lz4frame_open_write(data): - with lz4frame.open('testfile', mode='wb') as fp: +def test_lz4frame_open_write(tmp_path, data): + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='wb') as fp: fp.write(data) -def test_lz4frame_open_write_read_defaults(data): - with lz4frame.open('testfile', mode='wb') as fp: +def test_lz4frame_open_write_read_defaults(tmp_path, data): + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='wb') as fp: fp.write(data) - with lz4frame.open('testfile', mode='r') as fp: + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='r') as fp: data_out = fp.read() assert data_out == data -def test_lz4frame_open_write_read_text(): +def test_lz4frame_open_write_read_text(tmp_path): data = u'This is a test string' - with lz4frame.open('testfile', mode='wt') as fp: + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='wt') as fp: fp.write(data) - with lz4frame.open('testfile', mode='rt') as fp: + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='rt') as fp: data_out = fp.read() assert data_out == data -def test_lz4frame_open_write_read_text_iter(): +def test_lz4frame_open_write_read_text_iter(tmp_path): data = u'This is a test string' - with lz4frame.open('testfile', mode='wt') as fp: + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='wt') as fp: fp.write(data) data_out = '' - with lz4frame.open('testfile', mode='rt') as fp: + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='rt') as fp: for line in fp: data_out += line assert data_out == data def test_lz4frame_open_write_read( + tmp_path, data, compression_level, block_linked, @@ -91,29 +97,31 @@ def test_lz4frame_open_write_read( kwargs['return_bytearray'] = return_bytearray kwargs['mode'] = 'wb' - with lz4frame.open('testfile', **kwargs) as fp: + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', **kwargs) as fp: fp.write(data) - with lz4frame.open('testfile', mode='r') as fp: + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='r') as fp: data_out = fp.read() assert data_out == data -def test_lz4frame_flush(): +def test_lz4frame_flush(tmp_path): data_1 = b"This is a..." data_2 = b" test string!" + thread_id = threading.get_native_id() - with lz4frame.open("testfile", mode="w") as fp_write: + with lz4frame.open(tmp_path / f"testfile_{thread_id}", mode="w") as fp_write: fp_write.write(data_1) fp_write.flush() fp_write.write(data_2) - with lz4frame.open("testfile", mode="r") as fp_read: + with lz4frame.open(tmp_path / f"testfile_{thread_id}", mode="r") as fp_read: assert fp_read.read() == data_1 fp_write.flush() - with lz4frame.open("testfile", mode="r") as fp_read: + with lz4frame.open(tmp_path / f"testfile_{thread_id}", mode="r") as fp_read: assert fp_read.read() == data_1 + data_2 diff --git a/tests/frame/test_frame_8.py b/tests/frame/test_frame_8.py index 159534a..cfaeaac 100644 --- a/tests/frame/test_frame_8.py +++ b/tests/frame/test_frame_8.py @@ -1,12 +1,14 @@ +import threading import lz4.frame as lz4frame -def test_lz4frame_open_write_read_text_iter(): +def test_lz4frame_open_write_read_text_iter(tmp_path): data = u'This is a test string' - with lz4frame.open('testfile', mode='wt') as fp: + thread_id = threading.get_native_id() + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='wt') as fp: fp.write(data) data_out = '' - with lz4frame.open('testfile', mode='rt') as fp: + with lz4frame.open(tmp_path / f'testfile_{thread_id}', mode='rt') as fp: for line in fp: data_out += line assert data_out == data diff --git a/tests/frame/test_frame_9.py b/tests/frame/test_frame_9.py index 5143393..c5335ae 100644 --- a/tests/frame/test_frame_9.py +++ b/tests/frame/test_frame_9.py @@ -3,11 +3,12 @@ import io import pickle import sys +import threading import lz4.frame import pytest -def test_issue_172_1(): +def test_issue_172_1(tmp_path): """Test reproducer for issue 172 Issue 172 is a reported failure occurring on Windows 10 only. This bug was @@ -16,34 +17,38 @@ def test_issue_172_1(): """ input_data = 8 * os.urandom(1024) - with lz4.frame.open('testfile_small', 'wb') as fp: + thread_id = threading.get_native_id() + + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'wb') as fp: bytes_written = fp.write(input_data) # noqa: F841 - with lz4.frame.open('testfile_small', 'rb') as fp: + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'rb') as fp: data = fp.read(10) assert len(data) == 10 -def test_issue_172_2(): +def test_issue_172_2(tmp_path): input_data = 9 * os.urandom(1024) - with lz4.frame.open('testfile_small', 'w') as fp: + thread_id = threading.get_native_id() + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'w') as fp: bytes_written = fp.write(input_data) # noqa: F841 - with lz4.frame.open('testfile_small', 'r') as fp: + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'r') as fp: data = fp.read(10) assert len(data) == 10 -def test_issue_172_3(): +def test_issue_172_3(tmp_path): input_data = 9 * os.urandom(1024) - with lz4.frame.open('testfile_small', 'wb') as fp: + thread_id = threading.get_native_id() + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'wb') as fp: bytes_written = fp.write(input_data) # noqa: F841 - with lz4.frame.open('testfile_small', 'rb') as fp: + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'rb') as fp: data = fp.read(10) assert len(data) == 10 - with lz4.frame.open('testfile_small', 'rb') as fp: + with lz4.frame.open(tmp_path / f'testfile_small_{thread_id}', 'rb') as fp: data = fp.read(16 * 1024 - 1) assert len(data) == 9 * 1024 assert data == input_data diff --git a/tests/stream/test_stream_0.py b/tests/stream/test_stream_0.py index 03b19f3..cac07bd 100644 --- a/tests/stream/test_stream_0.py +++ b/tests/stream/test_stream_0.py @@ -96,6 +96,7 @@ def setup_kwargs(strategy, mode, buffer_size, store_comp_size, # Test single threaded usage with all valid variations of input +@pytest.mark.thread_unsafe def test_1(data, strategy, mode, buffer_size, store_comp_size, c_return_bytearray, d_return_bytearray, dictionary): if buffer_size >= (1 << (8 * store_comp_size['store_comp_size'])): diff --git a/tests/stream/test_stream_3.py b/tests/stream/test_stream_3.py index 2b52d6b..fed93d2 100644 --- a/tests/stream/test_stream_3.py +++ b/tests/stream/test_stream_3.py @@ -71,6 +71,7 @@ def data(request): return request.param +@pytest.mark.thread_unsafe def test_block_decompress_mem_usage(data, buffer_size): kwargs = { 'strategy': "double_buffer", From 0f5c05e7ccfc35f5f1d2d61cebb9f40480116444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 11:42:55 -0500 Subject: [PATCH 24/38] Update cibuildwheel version --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index b1e325c..38f40dd 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -72,7 +72,7 @@ jobs: echo "TOX_OVERRIDE=testenv.deps+=pytest-run-parallel" >> "$GITHUB_ENV" echo "PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" - name: Build wheels - uses: pypa/cibuildwheel@v2.21 + uses: pypa/cibuildwheel@v2.23.2 env: CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" # CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" From c0b3bb5c236cec8e1563411228d5133893c1a7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 12:32:44 -0500 Subject: [PATCH 25/38] Variable misspell fix --- lz4/_version.c | 2 +- lz4/block/_block.c | 2 +- lz4/frame/_frame.c | 2 +- lz4/stream/_stream.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lz4/_version.c b/lz4/_version.c index 7795241..af606ab 100644 --- a/lz4/_version.c +++ b/lz4/_version.c @@ -114,7 +114,7 @@ PyInit__version(void) return NULL; #ifdef Py_GIL_DISABLED - PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); #endif return module; diff --git a/lz4/block/_block.c b/lz4/block/_block.c index daa9fd5..993cc44 100644 --- a/lz4/block/_block.c +++ b/lz4/block/_block.c @@ -519,7 +519,7 @@ PyInit__block(void) PyModule_AddObject(module, "LZ4BlockError", LZ4BlockError); #ifdef Py_GIL_DISABLED - PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); #endif return module; diff --git a/lz4/frame/_frame.c b/lz4/frame/_frame.c index d081cce..e62c72c 100644 --- a/lz4/frame/_frame.c +++ b/lz4/frame/_frame.c @@ -1678,7 +1678,7 @@ PyInit__frame(void) PyModule_AddIntConstant (module, "BLOCKSIZE_MAX4MB", LZ4F_max4MB); #ifdef Py_GIL_DISABLED - PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); #endif return module; diff --git a/lz4/stream/_stream.c b/lz4/stream/_stream.c index 6351d96..f0dfad5 100644 --- a/lz4/stream/_stream.c +++ b/lz4/stream/_stream.c @@ -1650,7 +1650,7 @@ PyInit__stream(void) PyModule_AddObject (module, "LZ4StreamError", LZ4StreamError); #ifdef Py_GIL_DISABLED - PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED); + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); #endif return module; From 99321aa0166e6398276988a4d8c800568239177b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 14:38:33 -0500 Subject: [PATCH 26/38] Update environment variables --- .github/workflows/build_dist.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 38f40dd..77862f1 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -69,12 +69,15 @@ jobs: shell: bash -l {0} run: | echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" - echo "TOX_OVERRIDE=testenv.deps+=pytest-run-parallel" >> "$GITHUB_ENV" - echo "PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4 TOX_OVERRIDE=testenv.deps+=pytest-run-parallel;testenv.pass_env=PYTEST_ADDOPTS" + - name: Setup environment + if: ${{ !endsWith(matrix.cibw_build, 't-*') }} + shell: bash -l {0} + run: | + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4="False" >> "$GITHUB_ENV" - name: Build wheels uses: pypa/cibuildwheel@v2.23.2 env: - CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" # CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" CIBW_ARCHS_LINUX: "x86_64 i686" CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches From 2258e28190e3f037617ae48fe329035b60c28ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 14:44:07 -0500 Subject: [PATCH 27/38] Ensure CIBW_ENVIRONMENT is set --- .github/workflows/build_dist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 77862f1..0c659e3 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -69,12 +69,12 @@ jobs: shell: bash -l {0} run: | echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" - echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4 TOX_OVERRIDE=testenv.deps+=pytest-run-parallel;testenv.pass_env=PYTEST_ADDOPTS" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4 TOX_OVERRIDE=testenv.deps+=pytest-run-parallel;testenv.pass_env=PYTEST_ADDOPTS" >> "$GITHUB_ENV" - name: Setup environment if: ${{ !endsWith(matrix.cibw_build, 't-*') }} shell: bash -l {0} run: | - echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4="False" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV" - name: Build wheels uses: pypa/cibuildwheel@v2.23.2 env: From a20d167678f4fec73d41e811f809ec2f1799bab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 15:28:12 -0500 Subject: [PATCH 28/38] Pass tox overrides through CLI --- .github/workflows/build_dist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 0c659e3..62d84da 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -69,12 +69,14 @@ jobs: shell: bash -l {0} run: | echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" - echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4 TOX_OVERRIDE=testenv.deps+=pytest-run-parallel;testenv.pass_env=PYTEST_ADDOPTS" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" + echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV" - name: Setup environment if: ${{ !endsWith(matrix.cibw_build, 't-*') }} shell: bash -l {0} run: | echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV" + echo "CIBW_TEST_COMMAND=tox -c {project}" >> "$GITHUB_ENV" - name: Build wheels uses: pypa/cibuildwheel@v2.23.2 env: From cc5c9b18002863ebb4fcff7ff58db05cdd3e0db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 15:39:14 -0500 Subject: [PATCH 29/38] Ensure test command is applied --- .github/workflows/build_dist.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 62d84da..e6541dd 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -84,9 +84,9 @@ jobs: CIBW_ARCHS_LINUX: "x86_64 i686" CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64" + CIBW_ENABLE: cpython-freethreading CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" - CIBW_TEST_COMMAND: "tox -c {project}" CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-*linux_{ppc64le,s390x} *-win_arm64" CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" - name: Save wheels @@ -106,7 +106,7 @@ jobs: matrix: os: - ubuntu-24.04-arm - cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*] + cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*, cp313t-*] steps: - name: Check out repository uses: actions/checkout@v4 @@ -116,15 +116,26 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.x + - name: Setup free-threading variables + if: ${{ endsWith(matrix.cibw_build, 't-*') }} + shell: bash -l {0} + run: | + echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" + echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV" + - name: Setup environment + if: ${{ !endsWith(matrix.cibw_build, 't-*') }} + shell: bash -l {0} + run: | + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV" + echo "CIBW_TEST_COMMAND=tox -c {project}" >> "$GITHUB_ENV" - name: Build wheels uses: pypa/cibuildwheel@v2.21 env: - CIBW_ENVIRONMENT: PYLZ4_USE_SYSTEM_LZ4="False" CIBW_ARCHS_LINUX: "aarch64 armv7l" CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" CIBW_ENABLE: cpython-freethreading - CIBW_TEST_COMMAND: "tox -c {project}" CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox" - name: Save wheels uses: actions/upload-artifact@v4 From 40bcbd8c88c27416b9dc430e65e7f07741c7dfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Tue, 1 Apr 2025 15:57:10 -0500 Subject: [PATCH 30/38] Check why using temp paths increase memory usage --- tests/frame/test_frame_5.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/frame/test_frame_5.py b/tests/frame/test_frame_5.py index 4083646..dcbe4ae 100644 --- a/tests/frame/test_frame_5.py +++ b/tests/frame/test_frame_5.py @@ -68,17 +68,17 @@ def test_frame_decompress_chunk_mem_usage(data): prev_snapshot = snapshot -def test_frame_open_decompress_mem_usage(tmp_path, data): +def test_frame_open_decompress_mem_usage(data): tracemalloc = pytest.importorskip('tracemalloc') tracemalloc.start() - with lz4.frame.open(tmp_path / 'test.lz4', 'w') as f: + with lz4.frame.open('test.lz4', 'w') as f: f.write(data) prev_snapshot = None for i in range(1000): - with lz4.frame.open(tmp_path / 'test.lz4', 'r') as f: + with lz4.frame.open('test.lz4', 'r') as f: decompressed = f.read() # noqa: F841 if i % 100 == 0: From ad3ec0d5810615afc9dff3d2b18f6d29d2066223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 2 Apr 2025 17:13:03 -0500 Subject: [PATCH 31/38] Copy bytearrays directly --- tests/block/conftest.py | 18 ------------------ tests/block/test_block_0.py | 3 ++- tests/frame/test_frame_2.py | 4 +++- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/tests/block/conftest.py b/tests/block/conftest.py index b25c239..0b3578e 100644 --- a/tests/block/conftest.py +++ b/tests/block/conftest.py @@ -3,24 +3,6 @@ import sys -class EmptyMemoryView(): - def __init__(self): - self.data = b'' - self.view = None - - def __buffer__(self, flags: int, /) -> memoryview: - if self.view is None: - self.view = memoryview(self.data) - return self.view - - def __release_buffer__(self, buffer: memoryview, /): - breakpoint() - buffer.release() - - def __len__(self): - return 0 - - test_data = [ (b''), (os.urandom(8 * 1024)), diff --git a/tests/block/test_block_0.py b/tests/block/test_block_0.py index 31513b4..8a22e57 100644 --- a/tests/block/test_block_0.py +++ b/tests/block/test_block_0.py @@ -91,7 +91,8 @@ def copy_buf(data): if isinstance(data, memoryview): data_x = memoryview(copy.deepcopy(data.obj)) elif isinstance(data, bytearray): - data_x = bytearray(copy.deepcopy(data.__buffer__(inspect.BufferFlags.FULL_RO).obj)) + data_x = bytearray() + data_x[:] = data return data_x data_in = [copy_buf(data) for i in range(32)] diff --git a/tests/frame/test_frame_2.py b/tests/frame/test_frame_2.py index 14a3f6b..f7e6fa3 100644 --- a/tests/frame/test_frame_2.py +++ b/tests/frame/test_frame_2.py @@ -46,7 +46,9 @@ def test_roundtrip_chunked(data, block_size, block_linked, if isinstance(data, memoryview): data = memoryview(copy.deepcopy(data.obj)) elif isinstance(data, bytearray): - data = bytearray(copy.deepcopy(data.__buffer__(inspect.BufferFlags.FULL_RO).obj)) + data_2 = bytearray() + data_2[:] = data + data = data_2 c_context = lz4frame.create_compression_context() From 7a88fb9351ddfd65936dab78b79e41e910add51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 2 Apr 2025 17:22:17 -0500 Subject: [PATCH 32/38] Remove unused import --- tests/block/test_block_0.py | 1 - tests/frame/test_frame_2.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/block/test_block_0.py b/tests/block/test_block_0.py index 8a22e57..f2c3cd1 100644 --- a/tests/block/test_block_0.py +++ b/tests/block/test_block_0.py @@ -2,7 +2,6 @@ from multiprocessing.pool import ThreadPool import sys import copy -import inspect import pytest from functools import partial if sys.version_info <= (3, 2): diff --git a/tests/frame/test_frame_2.py b/tests/frame/test_frame_2.py index f7e6fa3..230867e 100644 --- a/tests/frame/test_frame_2.py +++ b/tests/frame/test_frame_2.py @@ -2,7 +2,6 @@ import pytest import os import copy -import inspect import sys from . helpers import ( get_chunked, From 737bac1a663c4d15347e98359b7a11c7ddc96f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 2 Apr 2025 17:41:35 -0500 Subject: [PATCH 33/38] Copy memoryview on test_1 --- tests/block/test_block_0.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/block/test_block_0.py b/tests/block/test_block_0.py index f2c3cd1..561b185 100644 --- a/tests/block/test_block_0.py +++ b/tests/block/test_block_0.py @@ -70,6 +70,13 @@ def setup_kwargs(mode, store_size, c_return_bytearray=None, d_return_bytearray=N # Test single threaded usage with all valid variations of input def test_1(data, mode, store_size, c_return_bytearray, d_return_bytearray, dictionary): + if isinstance(data, memoryview): + data = memoryview(copy.deepcopy(data.obj)) + elif isinstance(data, bytearray): + data_x = bytearray() + data_x[:] = data + data = data_x + (c_kwargs, d_kwargs) = setup_kwargs( mode, store_size, c_return_bytearray, d_return_bytearray) From b7c0b665eb70706a1c6e334e54a1b9fa18c96cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Thu, 3 Apr 2025 12:26:53 -0500 Subject: [PATCH 34/38] Upgrade pypa/cibuildwheel action in arm64 job --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index e6541dd..4af62b6 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -130,7 +130,7 @@ jobs: echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV" echo "CIBW_TEST_COMMAND=tox -c {project}" >> "$GITHUB_ENV" - name: Build wheels - uses: pypa/cibuildwheel@v2.21 + uses: pypa/cibuildwheel@v2.23.2 env: CIBW_ARCHS_LINUX: "aarch64 armv7l" CIBW_BUILD: ${{ matrix.cibw_build }} From 61957cb0dacf51b4cf0f351b740119bb576428b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Thu, 3 Apr 2025 14:45:57 -0500 Subject: [PATCH 35/38] CI: set parallelism to 2 in aarch64 --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 4af62b6..e327680 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -121,7 +121,7 @@ jobs: shell: bash -l {0} run: | echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" - echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=2" >> "$GITHUB_ENV" echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV" - name: Setup environment if: ${{ !endsWith(matrix.cibw_build, 't-*') }} From 689440cdabe92a8a407cf96e43847eec1b956ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Thu, 3 Apr 2025 15:11:26 -0500 Subject: [PATCH 36/38] CI: disable pytest-run-parallel altogeogether in aarch64 --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index e327680..6765e99 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -121,7 +121,7 @@ jobs: shell: bash -l {0} run: | echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" - echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=2" >> "$GITHUB_ENV" + echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=1" >> "$GITHUB_ENV" echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV" - name: Setup environment if: ${{ !endsWith(matrix.cibw_build, 't-*') }} From e54341fac7984222faec6e789ddc97486e6e88d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Thu, 3 Apr 2025 15:24:42 -0500 Subject: [PATCH 37/38] CI: disable armv7l --- .github/workflows/build_dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 6765e99..9b9964b 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -132,7 +132,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.23.2 env: - CIBW_ARCHS_LINUX: "aarch64 armv7l" + CIBW_ARCHS_LINUX: "aarch64" CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_SKIP: "cp*-musllinux*" CIBW_ENABLE: cpython-freethreading From 022d53815abf97e6eb49d0be3a27c74541c782ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 9 Apr 2025 16:43:32 -0500 Subject: [PATCH 38/38] Address review comments --- .github/workflows/build_dist.yml | 2 ++ tests/block/test_block_0.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_dist.yml b/.github/workflows/build_dist.yml index 9b9964b..b907acc 100644 --- a/.github/workflows/build_dist.yml +++ b/.github/workflows/build_dist.yml @@ -120,6 +120,8 @@ jobs: if: ${{ endsWith(matrix.cibw_build, 't-*') }} shell: bash -l {0} run: | + # Variables are set in order to be passed down to both cibuildwheel and the + # Docker image spawned by that action echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV" echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=1" >> "$GITHUB_ENV" echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV" diff --git a/tests/block/test_block_0.py b/tests/block/test_block_0.py index 561b185..a7731c3 100644 --- a/tests/block/test_block_0.py +++ b/tests/block/test_block_0.py @@ -93,12 +93,13 @@ def test_2(data, mode, store_size, dictionary): (c_kwargs, d_kwargs) = setup_kwargs(mode, store_size) def copy_buf(data): - data_x = data if isinstance(data, memoryview): data_x = memoryview(copy.deepcopy(data.obj)) elif isinstance(data, bytearray): data_x = bytearray() data_x[:] = data + else: + data_x = data return data_x data_in = [copy_buf(data) for i in range(32)]