From 3053690e6a0f65e83403b1bb3fbd86897ffce0ed Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 13:55:52 -0400 Subject: [PATCH 01/35] BUG: Fix bug with req for manylinux image --- pyproject.toml | 22 ++++++++++++++++++++-- setup.py | 25 +++++++++++++++++++++---- src/libeep/python/CMakeLists.txt | 32 ++++++++++++++++---------------- src/libeep/python/pyeep.c | 4 ++-- tests/test_io.py | 2 +- tests/utils/test_docs.py | 3 ++- 6 files changed, 62 insertions(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e2ef5cc..85d9664 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,12 +83,30 @@ source = 'https://github.com/mscheltienne/antio' tracker = 'https://github.com/mscheltienne/antio/issues' [tool.cibuildwheel] +build = "cp312-*" +skip = "*musllinux*" +archs = "native" build-frontend = "build[uv]" -test-command = "pytest tests --cov=src/antio --cov-report=xml --cov-config=pyproject.toml" +test-command = "pytest {project}/tests --cov=antio --cov-report=xml --cov-config={project}/pyproject.toml" test-extras = ["mne", "test"] [tool.cibuildwheel.linux] -before-all = "sudo yum update -y & sudo yum install https://repo.ius.io/ius-release-el$(rpm -E '%{rhel}').rpm & sudo yum update -y & yum install -y python3-devel" +repair-wheel-command = [ + "auditwheel repair -w {dest_dir} {wheel}", + "pipx run abi3audit --strict --report {wheel}", +] +[tool.cibuildwheel.macos] +repair-wheel-command = [ + "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}", + "pipx run abi3audit --strict --report {wheel}", +] + +[tool.cibuildwheel.windows] +before-build = "pip install delvewheel" +repair-wheel-command = [ + "delvewheel repair -w {dest_dir} {wheel}", + "pipx run abi3audit --strict --report {wheel}", +] [tool.codespell] check-filenames = true diff --git a/setup.py b/setup.py index f877917..4aead8f 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,22 @@ import platform import subprocess +import sys from pathlib import Path from shutil import move from tempfile import TemporaryDirectory -from setuptools import setup +from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext from setuptools.dist import Distribution +from wheel.bdist_wheel import bdist_wheel # set the platform-specific files, libeep first, pyeep second. if platform.system() == "Linux": - lib_files = ["libEep.so", "pyeep.so"] + lib_files = ["libEep.so", "pyeep.abi3.so"] elif platform.system() == "Windows": lib_files = ["Eep.dll", "pyeep.pyd"] elif platform.system() == "Darwin": - lib_files = ["libEep.dylib", "pyeep.so"] + lib_files = ["libEep.dylib", "pyeep.abi3.so"] else: lib_files = [] @@ -37,6 +39,7 @@ def run(self): "-B", build_dir, "-DCMAKE_BUILD_TYPE=Release", + f"-DPython3_EXECUTABLE={sys.executable}", ], check=True, ) @@ -56,11 +59,25 @@ def run(self): super().run() +# Adapted from +# https://github.com/joerick/python-abi3-package-sample/blob/main/setup.py +class bdist_wheel_abi3(bdist_wheel): + def get_tag(self): + python, abi, plat = super().get_tag() + + if python.startswith("cp"): + # on CPython, our wheels are abi3 and compatible back to 3.2, + # but let's set it to our min version anyway + return "cp38", "abi3", plat + + return python, abi, plat + + setup( cmdclass={ "build_ext": build_ext, + "bdist_wheel": bdist_wheel_abi3, }, distclass=BinaryDistribution, # to handle binary files include_package_data=False, - package_data={"antio.libeep": lib_files}, ) diff --git a/src/libeep/python/CMakeLists.txt b/src/libeep/python/CMakeLists.txt index 0c5485f..954bccb 100644 --- a/src/libeep/python/CMakeLists.txt +++ b/src/libeep/python/CMakeLists.txt @@ -1,18 +1,18 @@ -find_package(Python3 COMPONENTS Development) -if(Python3_FOUND) - message("python 3 include.... ${Python3_INCLUDE_DIRS}") - message("python 3 libs....... ${Python3_LIBRARIES}") - add_library(pyeep3 MODULE ./pyeep.c) - set_target_properties(pyeep3 PROPERTIES OUTPUT_NAME pyeep) - target_include_directories(pyeep3 PRIVATE ${Python3_INCLUDE_DIRS}) - target_link_libraries(pyeep3 PRIVATE EepStatic) - target_link_libraries(pyeep3 PRIVATE ${Python3_LIBRARIES}) - install(TARGETS pyeep3 DESTINATION share/libeep/python3/libeep) +message("Python3_EXECUTABLE..... ${Python3_EXECUTABLE}") +# manylinux don't contain Development, use Development.Module or Development.SABIModule: +# https://github.com/pybind/pybind11/pull/2689/files +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.SABIModule) +message("python 3 include...... ${Python3_INCLUDE_DIRS}") +message("python 3 abi3 lib..... ${Python3_SABI_LIBRARY}") +set(Python_SOABI "abi3") +Python3_add_library(pyeep3 MODULE ./pyeep.c USE_SABI 3.8 WITH_SOABI) +set_target_properties(pyeep3 PROPERTIES OUTPUT_NAME pyeep) +target_link_libraries(pyeep3 PRIVATE EepStatic) +install(TARGETS pyeep3 DESTINATION share/libeep/python3/libeep) - if(UNIX) - set_target_properties(pyeep3 PROPERTIES PREFIX "") - endif() - if(WIN32) - set_target_properties(pyeep3 PROPERTIES SUFFIX .pyd) - endif() +if(UNIX) + set_target_properties(pyeep3 PROPERTIES PREFIX "") +endif() +if(WIN32) + set_target_properties(pyeep3 PROPERTIES SUFFIX .pyd) endif() diff --git a/src/libeep/python/pyeep.c b/src/libeep/python/pyeep.c index 3743178..da4ca9f 100644 --- a/src/libeep/python/pyeep.c +++ b/src/libeep/python/pyeep.c @@ -38,7 +38,7 @@ PyObject * pyeep_write_cnt(PyObject* self, PyObject* args) { char * filename; int rate; - chaninfo_t channel_info_handle; + chaninfo_t channel_info_handle; int rf64; if(!PyArg_ParseTuple(args, "siii", & filename, & rate, & channel_info_handle, & rf64)) { @@ -166,7 +166,7 @@ pyeep_get_samples(PyObject* self, PyObject* args) { Py_DECREF(python_list); return NULL; } - PyList_SET_ITEM(python_list, i, num); // reference to num stolen + PyList_SetItem(python_list, i, num); // reference to num stolen } libeep_free_samples(libeep_sample_data); return python_list; diff --git a/tests/test_io.py b/tests/test_io.py index 1cc5517..adb851b 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -10,7 +10,7 @@ @pytest.fixture() def datafiles() -> Path: """Return the path to a .cnt file.""" - return Path(__file__) / "data" / "test_test_2023-06-07_18-54-58.cnt" + return Path(__file__).parent / "data" / "test_test_2023-06-07_18-54-58.cnt" def test_io(datafiles): diff --git a/tests/utils/test_docs.py b/tests/utils/test_docs.py index 9a93a4d..93fcf1e 100644 --- a/tests/utils/test_docs.py +++ b/tests/utils/test_docs.py @@ -3,6 +3,7 @@ import pytest +import antio from antio.utils._docs import copy_doc, docdict, fill_doc from antio.utils.logs import verbose @@ -203,7 +204,7 @@ def method4(verbose=None): def test_docdict_order(): """Test that docdict is alphabetical.""" # read the file as text, and get entries via regex - docs_path = Path(__file__).parents[1] / "_docs.py" + docs_path = Path(antio.__file__).parent / "utils" / "_docs.py" assert docs_path.is_file() with open(docs_path, encoding="UTF-8") as fid: docs = fid.read() From 7836868580439db0b2a2d6850dea16d94171c042 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:19:17 -0400 Subject: [PATCH 02/35] FIX: Lots of tweaks --- .github/workflows/build.yaml | 85 +++++++++++++++++++++++++++++--- .github/workflows/publish.yaml | 32 ------------ .github/workflows/unittests.yaml | 66 ------------------------- pyproject.toml | 3 +- 4 files changed, 80 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/publish.yaml delete mode 100644 .github/workflows/unittests.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 73c3e8d..dc9a84a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,23 +9,96 @@ on: # yamllint disable-line rule:truthy workflow_dispatch: schedule: - cron: '0 8 * * 1' + release: + types: [published] jobs: cibuildwheel: timeout-minutes: 10 - name: Build wheels on ${{ matrix.os }} + name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon os: [ubuntu-latest, windows-latest, macos-13, macos-14] + arch: [native] + include: + - os: ubuntu-latest + arch: aarch64 steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Build wheels - uses: pypa/cibuildwheel@v2.20.0 + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + with: + platforms: all + if: runner.os == 'Linux' && matrix.arch == 'aarch64' + - uses: pypa/cibuildwheel@v2.20.0 + env: + CIBW_ARCHS: ${{ matrix.arch }} - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }} + name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index}} path: ./wheelhouse/*.whl + + test: + name: Test on ${{ matrix.os }} ${{ matrix.python }} + needs: cibuildwheel + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + python: ["3.8", "3.12"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - uses: actions/download-artifact@v4 + with: + pattern: cibw-wheels-${{ matrix.os }}-native-* + merge-multiple: true + path: dist + - run: pip install dist/*.whl[tests] + - run: pytest tests/ --cov=antio --cov-report=xml + + check: + name: Create sdist and check + needs: cibuildwheel + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + pattern: cibw-wheels-* + merge-multiple: true + path: dist + - run: pwd && ls -alt . && ls -alt dist/ + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: pip install --upgrade twine + - run: python -m build --sdist + # - run: python tools/stubgen.py + - run: twine check --strict dist/* + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-sdist + path: ./dist/*.tar.gz + + # https://github.com/marketplace/actions/pypi-publish#usage + publish: + name: Publish + needs: check + runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/antio + timeout-minutes: 10 + if: github.event_name == 'release' + steps: + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 92b99c5..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: publish -on: - release: - types: [published] - -jobs: - pypi: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install uv and package - run: | - python -m pip install --quiet uv - uv pip install --quiet --system -e .[build,stubs] - - name: Display system information - run: antio sys-info --developer - - name: Generate stub files - run: python tools/stubgen.py - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python -m build - twine check dist/* - twine upload dist/* diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml deleted file mode 100644 index d267d5f..0000000 --- a/.github/workflows/unittests.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: unittests -concurrency: - group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} - cancel-in-progress: true -on: # yamllint disable-line rule:truthy - pull_request: - push: - branches: [main] - workflow_dispatch: - schedule: - - cron: '0 8 * * 1' - -jobs: - build: - timeout-minutes: 10 - name: Build ${{ matrix.os }} - py${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # macos-13 is an intel runner, macos-14 is apple silicon - os: [ubuntu-latest, windows-latest, macos-13, macos-14] - python-version: [3.9, "3.10", "3.11", "3.12"] - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --quiet uv - uv pip install --quiet --system --upgrade setuptools build - - name: Build wheels - run: python -m build - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: wheel-${{ matrix.os }}-py${{ matrix.python-version }} - path: dist/*.whl - - sdist: - timeout-minutes: 10 - name: sdist - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - name: Install dependencies - run: | - python -m pip install --quiet uv - uv pip install --quiet --system --upgrade setuptools build - - name: Build wheels - run: python -m build --sdist - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: sdist - path: dist/*.tar.gz diff --git a/pyproject.toml b/pyproject.toml index 85d9664..7762ac5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ all = [ ] build = [ 'build', - 'cibuildwheel[uv]', + 'cibuildwheel', 'setuptools>= 64.0.0', 'twine', ] @@ -86,7 +86,6 @@ tracker = 'https://github.com/mscheltienne/antio/issues' build = "cp312-*" skip = "*musllinux*" archs = "native" -build-frontend = "build[uv]" test-command = "pytest {project}/tests --cov=antio --cov-report=xml --cov-config={project}/pyproject.toml" test-extras = ["mne", "test"] From e3e3719270e6d1efbefdfe70f3a2c19b49cfdd2b Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:23:26 -0400 Subject: [PATCH 03/35] FIX: Check --- .github/workflows/build.yaml | 2 +- tests/utils/test_config.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dc9a84a..ea4b610 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,4 +101,4 @@ jobs: if: github.event_name == 'release' steps: - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/tests/utils/test_config.py b/tests/utils/test_config.py index 900e093..92fa8ad 100644 --- a/tests/utils/test_config.py +++ b/tests/utils/test_config.py @@ -20,13 +20,13 @@ def test_sys_info(): assert "numpy" in value assert "psutil" in value - assert "style" not in value - assert "test" not in value + assert "ruff" not in value + assert "pytest" not in value out = StringIO() sys_info(fid=out, developer=True) value = out.getvalue() out.close() - assert "style" in value - assert "test" in value + assert "ruff" in value + assert "pytest" in value From bd6f2c567e1c7dc57e768dabb547fc89fbd9910b Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:38:03 -0400 Subject: [PATCH 04/35] FIX: Try again --- .github/workflows/build.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ea4b610..26dbe98 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -59,10 +59,11 @@ jobs: pattern: cibw-wheels-${{ matrix.os }}-native-* merge-multiple: true path: dist + - run: ls -alt . && ls -alt dist/ - run: pip install dist/*.whl[tests] - run: pytest tests/ --cov=antio --cov-report=xml - check: + sdist_check: name: Create sdist and check needs: cibuildwheel timeout-minutes: 10 @@ -74,7 +75,7 @@ jobs: pattern: cibw-wheels-* merge-multiple: true path: dist - - run: pwd && ls -alt . && ls -alt dist/ + - run: ls -alt . && ls -alt dist/ - uses: actions/setup-python@v5 with: python-version: '3.12' @@ -90,7 +91,7 @@ jobs: # https://github.com/marketplace/actions/pypi-publish#usage publish: name: Publish - needs: check + needs: sdist_check runs-on: ubuntu-latest permissions: id-token: write @@ -100,5 +101,10 @@ jobs: timeout-minutes: 10 if: github.event_name == 'release' steps: + - uses: actions/download-artifact@v4 + with: + pattern: cibw-wheels-* + merge-multiple: true + path: dist - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 From 9bc4b54f26d06dec27ee8a7f25a8eea5b442c1af Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:43:12 -0400 Subject: [PATCH 05/35] FIX: Faster --- .github/workflows/build.yaml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 26dbe98..1fbd76a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,14 +15,28 @@ on: # yamllint disable-line rule:truthy jobs: cibuildwheel: timeout-minutes: 10 - name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} + name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon os: [ubuntu-latest, windows-latest, macos-13, macos-14] - arch: [native] + steps: + - uses: actions/checkout@v4 + - uses: pypa/cibuildwheel@v2.20.0 + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-native + path: ./wheelhouse/*.whl + + cibuildwheel_emulated: # Separate out because it's slower and not tested separately + timeout-minutes: 10 + name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: include: - os: ubuntu-latest arch: aarch64 @@ -31,7 +45,6 @@ jobs: - uses: docker/setup-qemu-action@v3 with: platforms: all - if: runner.os == 'Linux' && matrix.arch == 'aarch64' - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS: ${{ matrix.arch }} @@ -56,16 +69,16 @@ jobs: python-version: ${{ matrix.python }} - uses: actions/download-artifact@v4 with: - pattern: cibw-wheels-${{ matrix.os }}-native-* - merge-multiple: true + name: cibw-wheels-${{ matrix.os }}-native path: dist - run: ls -alt . && ls -alt dist/ - run: pip install dist/*.whl[tests] - run: pytest tests/ --cov=antio --cov-report=xml + - uses: codecov/codecov-action@v4 sdist_check: name: Create sdist and check - needs: cibuildwheel + needs: [cibuildwheel, cibuildwheel_emulated] timeout-minutes: 10 runs-on: ubuntu-latest steps: From 45c71f6b659d26d653937aaa9724d47a272e4127 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:44:21 -0400 Subject: [PATCH 06/35] FIX: Req --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1fbd76a..f4440c6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -92,7 +92,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.12' - - run: pip install --upgrade twine + - run: pip install --upgrade twine build - run: python -m build --sdist # - run: python tools/stubgen.py - run: twine check --strict dist/* From 8fa58b51f2ac4c043958949732b4b58ab02eaa43 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:48:47 -0400 Subject: [PATCH 07/35] FIX: Okay star --- .github/workflows/build.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f4440c6..7b9bcf3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -72,7 +72,12 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: dist - run: ls -alt . && ls -alt dist/ - - run: pip install dist/*.whl[tests] + - run: | + set -eo pipefail + FNAME=$(ls dist/*.whl) + echo "FNAME=$FNAME" + pip install ${FNAME}[tests] + shell: bash - run: pytest tests/ --cov=antio --cov-report=xml - uses: codecov/codecov-action@v4 From 8a2d3e3dcdb6bee89d8b34c8dbac59a0fa045c0e Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:57:02 -0400 Subject: [PATCH 08/35] FIX: What --- .github/workflows/build.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7b9bcf3..d61ef41 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,14 +54,14 @@ jobs: path: ./wheelhouse/*.whl test: - name: Test on ${{ matrix.os }} ${{ matrix.python }} + name: Test wheels on ${{ matrix.os }} ${{ matrix.python }} needs: cibuildwheel runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-13, macos-latest] - python: ["3.8", "3.12"] + python: ["3.9", "3.12"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -69,15 +69,10 @@ jobs: python-version: ${{ matrix.python }} - uses: actions/download-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-native + pattern: cibw-wheels-* path: dist - run: ls -alt . && ls -alt dist/ - - run: | - set -eo pipefail - FNAME=$(ls dist/*.whl) - echo "FNAME=$FNAME" - pip install ${FNAME}[tests] - shell: bash + - run: pip install --only-binary antio antio[tests] --find-links dist - run: pytest tests/ --cov=antio --cov-report=xml - uses: codecov/codecov-action@v4 From 0c54f986cc12a613764e7a4e542f8ffb98c62e7f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 16:59:07 -0400 Subject: [PATCH 09/35] FIX: Ver --- src/libeep/python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libeep/python/CMakeLists.txt b/src/libeep/python/CMakeLists.txt index 954bccb..fef193e 100644 --- a/src/libeep/python/CMakeLists.txt +++ b/src/libeep/python/CMakeLists.txt @@ -5,7 +5,7 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter Development.SABIModule) message("python 3 include...... ${Python3_INCLUDE_DIRS}") message("python 3 abi3 lib..... ${Python3_SABI_LIBRARY}") set(Python_SOABI "abi3") -Python3_add_library(pyeep3 MODULE ./pyeep.c USE_SABI 3.8 WITH_SOABI) +Python3_add_library(pyeep3 MODULE ./pyeep.c USE_SABI 3.9 WITH_SOABI) set_target_properties(pyeep3 PROPERTIES OUTPUT_NAME pyeep) target_link_libraries(pyeep3 PRIVATE EepStatic) install(TARGETS pyeep3 DESTINATION share/libeep/python3/libeep) From c909f922265434319c79a2a36c8c098a126ed9a5 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 17:05:11 -0400 Subject: [PATCH 10/35] FIX: Ver --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d61ef41..87faac9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -70,6 +70,7 @@ jobs: - uses: actions/download-artifact@v4 with: pattern: cibw-wheels-* + merge-multiple: true path: dist - run: ls -alt . && ls -alt dist/ - run: pip install --only-binary antio antio[tests] --find-links dist From 9e53e56af430f1b85fed109d7f1959fc5e9b16d0 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 12 Aug 2024 17:20:45 -0400 Subject: [PATCH 11/35] FIX: More --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 87faac9..2dac280 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -73,7 +73,8 @@ jobs: merge-multiple: true path: dist - run: ls -alt . && ls -alt dist/ - - run: pip install --only-binary antio antio[tests] --find-links dist + shell: bash + - run: pip install --only-binary antio antio[test] --find-links dist - run: pytest tests/ --cov=antio --cov-report=xml - uses: codecov/codecov-action@v4 From d43aa17fdc58d49202d74e791b1c9d68277bed47 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 10:15:44 +0200 Subject: [PATCH 12/35] minor fixes --- .github/workflows/build.yaml | 6 +++--- setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2dac280..e299d1f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] steps: - uses: actions/checkout@v4 - uses: pypa/cibuildwheel@v2.20.0 @@ -30,7 +30,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_emulated: # Separate out because it's slower and not tested separately + cibuildwheel_emulated: # separate out because it's slower and not tested separately timeout-minutes: 10 name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} @@ -91,12 +91,12 @@ jobs: merge-multiple: true path: dist - run: ls -alt . && ls -alt dist/ + shell: bash - uses: actions/setup-python@v5 with: python-version: '3.12' - run: pip install --upgrade twine build - run: python -m build --sdist - # - run: python tools/stubgen.py - run: twine check --strict dist/* - uses: actions/upload-artifact@v4 with: diff --git a/setup.py b/setup.py index 4aead8f..0be8f4a 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from shutil import move from tempfile import TemporaryDirectory -from setuptools import setup, Extension +from setuptools import setup from setuptools.command.build_ext import build_ext as _build_ext from setuptools.dist import Distribution from wheel.bdist_wheel import bdist_wheel From 97cfdf94efd7a16505b20f735f34c7b6d16e1923 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 10:25:32 +0200 Subject: [PATCH 13/35] fix version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0be8f4a..ac24670 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ def get_tag(self): if python.startswith("cp"): # on CPython, our wheels are abi3 and compatible back to 3.2, # but let's set it to our min version anyway - return "cp38", "abi3", plat + return "cp39", "abi3", plat return python, abi, plat From 86255250e147e14f42c717a51f6c68484350314c Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:19:55 +0200 Subject: [PATCH 14/35] better names --- .github/workflows/{build.yaml => ci.yaml} | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) rename .github/workflows/{build.yaml => ci.yaml} (87%) diff --git a/.github/workflows/build.yaml b/.github/workflows/ci.yaml similarity index 87% rename from .github/workflows/build.yaml rename to .github/workflows/ci.yaml index e299d1f..25c231b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: build +name: ci concurrency: group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} cancel-in-progress: true @@ -30,7 +30,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_emulated: # separate out because it's slower and not tested separately + cibuildwheel_aarch64: # separate out because it's slower and not tested separately timeout-minutes: 10 name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} @@ -73,14 +73,13 @@ jobs: merge-multiple: true path: dist - run: ls -alt . && ls -alt dist/ - shell: bash - run: pip install --only-binary antio antio[test] --find-links dist - run: pytest tests/ --cov=antio --cov-report=xml - uses: codecov/codecov-action@v4 - sdist_check: - name: Create sdist and check - needs: [cibuildwheel, cibuildwheel_emulated] + sdist: + name: Create and check sdist + needs: [cibuildwheel, cibuildwheel_aarch64] timeout-minutes: 10 runs-on: ubuntu-latest steps: @@ -91,7 +90,6 @@ jobs: merge-multiple: true path: dist - run: ls -alt . && ls -alt dist/ - shell: bash - uses: actions/setup-python@v5 with: python-version: '3.12' @@ -103,10 +101,9 @@ jobs: name: cibw-wheels-sdist path: ./dist/*.tar.gz - # https://github.com/marketplace/actions/pypi-publish#usage publish: - name: Publish - needs: sdist_check + name: Publish PyPI + needs: sdist runs-on: ubuntu-latest permissions: id-token: write @@ -121,5 +118,4 @@ jobs: pattern: cibw-wheels-* merge-multiple: true path: dist - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - uses: pypa/gh-action-pypi-publish@release/v1 From 2601072a4cab9e68c692ed25f55226f1ba4e85d9 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:20:47 +0200 Subject: [PATCH 15/35] better names --- .github/workflows/ci.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25c231b..ddf738c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ on: # yamllint disable-line rule:truthy jobs: cibuildwheel: timeout-minutes: 10 - name: Build wheels on ${{ matrix.os }} + name: build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -32,7 +32,7 @@ jobs: cibuildwheel_aarch64: # separate out because it's slower and not tested separately timeout-minutes: 10 - name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} + name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -54,7 +54,7 @@ jobs: path: ./wheelhouse/*.whl test: - name: Test wheels on ${{ matrix.os }} ${{ matrix.python }} + name: test wheels on ${{ matrix.os }} ${{ matrix.python }} needs: cibuildwheel runs-on: ${{ matrix.os }} strategy: @@ -78,7 +78,7 @@ jobs: - uses: codecov/codecov-action@v4 sdist: - name: Create and check sdist + name: create and check sdist needs: [cibuildwheel, cibuildwheel_aarch64] timeout-minutes: 10 runs-on: ubuntu-latest @@ -102,7 +102,7 @@ jobs: path: ./dist/*.tar.gz publish: - name: Publish PyPI + name: publish PyPI needs: sdist runs-on: ubuntu-latest permissions: From 98327898582dc108faf0c0bbee9c6c45673d4c98 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:29:37 +0200 Subject: [PATCH 16/35] better order --- .github/workflows/ci.yaml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ddf738c..659b1bf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,13 +15,16 @@ on: # yamllint disable-line rule:truthy jobs: cibuildwheel: timeout-minutes: 10 - name: build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is apple silicon os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + name: build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - uses: actions/checkout@v4 - uses: pypa/cibuildwheel@v2.20.0 @@ -32,14 +35,14 @@ jobs: cibuildwheel_aarch64: # separate out because it's slower and not tested separately timeout-minutes: 10 - name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest arch: aarch64 + name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 @@ -54,14 +57,18 @@ jobs: path: ./wheelhouse/*.whl test: - name: test wheels on ${{ matrix.os }} ${{ matrix.python }} needs: cibuildwheel - runs-on: ${{ matrix.os }} + timeout-minutes: 10 strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-13, macos-latest] python: ["3.9", "3.12"] + name: test wheels on ${{ matrix.os }} ${{ matrix.python }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -78,9 +85,9 @@ jobs: - uses: codecov/codecov-action@v4 sdist: - name: create and check sdist needs: [cibuildwheel, cibuildwheel_aarch64] timeout-minutes: 10 + name: create and check sdist runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -102,8 +109,8 @@ jobs: path: ./dist/*.tar.gz publish: - name: publish PyPI needs: sdist + name: publish PyPI runs-on: ubuntu-latest permissions: id-token: write From efd61543681f855dc9fd12e9d1f888293591ba9c Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:36:31 +0200 Subject: [PATCH 17/35] split sdist and check, require test for publish --- .github/workflows/ci.yaml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 659b1bf..6d11bec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -85,9 +85,25 @@ jobs: - uses: codecov/codecov-action@v4 sdist: - needs: [cibuildwheel, cibuildwheel_aarch64] timeout-minutes: 10 - name: create and check sdist + name: create sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: pip install --upgrade build + - run: python -m build --sdist + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-sdist + path: ./dist/*.tar.gz + + check: + needs: [cibuildwheel, cibuildwheel_aarch64, sdist] + timeout-minutes: 10 + name: check dist/* runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -100,16 +116,11 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.12' - - run: pip install --upgrade twine build - - run: python -m build --sdist + - run: pip install --upgrade twine - run: twine check --strict dist/* - - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-sdist - path: ./dist/*.tar.gz publish: - needs: sdist + needs: [check, test] name: publish PyPI runs-on: ubuntu-latest permissions: From 56323d9557d3dcfa7b94db3b55e67b35d036bdfb Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:49:29 +0200 Subject: [PATCH 18/35] try to naively add win arm64 --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6d11bec..c018159 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,6 +41,8 @@ jobs: include: - os: ubuntu-latest arch: aarch64 + - os: windows-latest + arch: aarch64 name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} steps: From 4d345293e457978a67ffb71e5d79cae39b669f75 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:50:16 +0200 Subject: [PATCH 19/35] fix typo --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c018159..2ffd1a7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ jobs: - os: ubuntu-latest arch: aarch64 - os: windows-latest - arch: aarch64 + arch: arm64 name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} steps: From 1cf9f4d8746d176b4a795b73b91d583527de6af7 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:50:51 +0200 Subject: [PATCH 20/35] fix name --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ffd1a7..6d4f4fd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_aarch64: # separate out because it's slower and not tested separately + cibuildwheel_emulated: # separate out because it's slower and not tested separately timeout-minutes: 10 strategy: fail-fast: false @@ -103,7 +103,7 @@ jobs: path: ./dist/*.tar.gz check: - needs: [cibuildwheel, cibuildwheel_aarch64, sdist] + needs: [cibuildwheel, cibuildwheel_emulated, sdist] timeout-minutes: 10 name: check dist/* runs-on: ubuntu-latest From 04a19d00028c2bc90d4e86e98ae47498f75d9f2f Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 11:52:02 +0200 Subject: [PATCH 21/35] Revert "try to naively add win arm64" This reverts commit 56323d9557d3dcfa7b94db3b55e67b35d036bdfb. Revert "fix name" This reverts commit 1cf9f4d8746d176b4a795b73b91d583527de6af7. Revert "fix typo" This reverts commit 4d345293e457978a67ffb71e5d79cae39b669f75. --- .github/workflows/ci.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6d4f4fd..6d11bec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_emulated: # separate out because it's slower and not tested separately + cibuildwheel_aarch64: # separate out because it's slower and not tested separately timeout-minutes: 10 strategy: fail-fast: false @@ -41,8 +41,6 @@ jobs: include: - os: ubuntu-latest arch: aarch64 - - os: windows-latest - arch: arm64 name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} steps: @@ -103,7 +101,7 @@ jobs: path: ./dist/*.tar.gz check: - needs: [cibuildwheel, cibuildwheel_emulated, sdist] + needs: [cibuildwheel, cibuildwheel_aarch64, sdist] timeout-minutes: 10 name: check dist/* runs-on: ubuntu-latest From f244456eafa7d4b4b20ee7d852faf26469c07dd5 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 12:07:30 +0200 Subject: [PATCH 22/35] revert name --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6d11bec..64379ca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_aarch64: # separate out because it's slower and not tested separately + cibuildwheel_emulated: # separate out because it's slower and not tested separately timeout-minutes: 10 strategy: fail-fast: false @@ -53,7 +53,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index}} + name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl test: @@ -101,7 +101,7 @@ jobs: path: ./dist/*.tar.gz check: - needs: [cibuildwheel, cibuildwheel_aarch64, sdist] + needs: [cibuildwheel, cibuildwheel_emulated, sdist] timeout-minutes: 10 name: check dist/* runs-on: ubuntu-latest From c2f7928c2d0c60e3ccc8318713a28a91f1ff35d9 Mon Sep 17 00:00:00 2001 From: mscheltienne Date: Tue, 13 Aug 2024 13:01:33 +0200 Subject: [PATCH 23/35] try to run test as part of cibuildwheel only for aarch64 --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7762ac5..7927568 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,8 +86,6 @@ tracker = 'https://github.com/mscheltienne/antio/issues' build = "cp312-*" skip = "*musllinux*" archs = "native" -test-command = "pytest {project}/tests --cov=antio --cov-report=xml --cov-config={project}/pyproject.toml" -test-extras = ["mne", "test"] [tool.cibuildwheel.linux] repair-wheel-command = [ @@ -107,6 +105,11 @@ repair-wheel-command = [ "pipx run abi3audit --strict --report {wheel}", ] +[[tool.cibuildwheel.overrides]] +select = "*aarch64*" +test-command = "pytest {project}/tests" +test-extras = ["mne", "test"] + [tool.codespell] check-filenames = true check-hidden = true From 68296f4383dff269ed9d08a708e2b03184d0dc3f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:13:22 -0400 Subject: [PATCH 24/35] Update pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7927568..f4302ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,6 @@ repair-wheel-command = [ ] [[tool.cibuildwheel.overrides]] -select = "*aarch64*" test-command = "pytest {project}/tests" test-extras = ["mne", "test"] From d6138216b2760e22761a88bdc7a18cffa0773dad Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:16:38 -0400 Subject: [PATCH 25/35] FIX: ARM64 --- .github/workflows/ci.yaml | 4 ++++ pyproject.toml | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 64379ca..48344ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,6 +41,8 @@ jobs: include: - os: ubuntu-latest arch: aarch64 + - os: windows-latest + arch: ARM64 name: build wheels on ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} steps: @@ -51,6 +53,8 @@ jobs: - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS: ${{ matrix.arch }} + # https://cibuildwheel.pypa.io/en/stable/faq/#windows-arm64 + CIBW_TEST_SKIP: "*-win_arm64" - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }} diff --git a/pyproject.toml b/pyproject.toml index f4302ac..af3719d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,8 @@ tracker = 'https://github.com/mscheltienne/antio/issues' build = "cp312-*" skip = "*musllinux*" archs = "native" +test-command = "pytest {project}/tests" +test-extras = ["mne", "test"] [tool.cibuildwheel.linux] repair-wheel-command = [ @@ -105,10 +107,6 @@ repair-wheel-command = [ "pipx run abi3audit --strict --report {wheel}", ] -[[tool.cibuildwheel.overrides]] -test-command = "pytest {project}/tests" -test-extras = ["mne", "test"] - [tool.codespell] check-filenames = true check-hidden = true From aa5e7ea9f28fd9a22e9207635117252a72623626 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:17:55 -0400 Subject: [PATCH 26/35] FIX: Conditional --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 48344ad..8358e20 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,6 +50,7 @@ jobs: - uses: docker/setup-qemu-action@v3 with: platforms: all + if: runner.os == 'Linux' - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS: ${{ matrix.arch }} From 523e51e3e3c268ad55d0485739dd5eda6f13a6d7 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:18:10 -0400 Subject: [PATCH 27/35] FIX: Cross --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8358e20..1d9bd3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: name: cibw-wheels-${{ matrix.os }}-native path: ./wheelhouse/*.whl - cibuildwheel_emulated: # separate out because it's slower and not tested separately + cibuildwheel_emulated_cross: # separate out because it's slower and not tested separately timeout-minutes: 10 strategy: fail-fast: false @@ -106,7 +106,7 @@ jobs: path: ./dist/*.tar.gz check: - needs: [cibuildwheel, cibuildwheel_emulated, sdist] + needs: [cibuildwheel, cibuildwheel_emulated_cross, sdist] timeout-minutes: 10 name: check dist/* runs-on: ubuntu-latest From 0bcb3cd909ac809643572a3bf1d146d99b305b61 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:45:17 -0400 Subject: [PATCH 28/35] FIX: Platform --- .github/workflows/ci.yaml | 8 +++++++- setup.py | 12 +++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1d9bd3a..7e38cfb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,10 +47,16 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 + - name: Setup emulation on Linux + uses: docker/setup-qemu-action@v3 with: platforms: all if: runner.os == 'Linux' + - name: Setup cross-compilation on Windows + run: | + echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.arch }}" >> $GITHUB_ENV + shell: bash + if: runner.os == 'Windows' - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS: ${{ matrix.arch }} diff --git a/setup.py b/setup.py index ac24670..815e182 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import os import platform import subprocess import sys @@ -31,8 +32,7 @@ def run(self): """Build libeep with cmake as part of the extension build process.""" src_dir = Path(__file__).parent / "src" / "libeep" with TemporaryDirectory() as build_dir: # str - subprocess.run( - [ + args = [ "cmake", "-S", str(src_dir), @@ -40,9 +40,11 @@ def run(self): build_dir, "-DCMAKE_BUILD_TYPE=Release", f"-DPython3_EXECUTABLE={sys.executable}", - ], - check=True, - ) + ] + for key in ("CMAKE_GENERATOR_PLATFORM",): + if key in os.environ: + args.append(f"-D{key}={os.environ[key]}") + subprocess.run(args, check=True) subprocess.run( ["cmake", "--build", build_dir, "--config", "Release"], check=True ) From 298624914b527f3ca4db6947fdbc49c3755a1981 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 09:54:00 -0400 Subject: [PATCH 29/35] FIX: Ver --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 815e182..e0d67fc 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,8 @@ def run(self): "-DCMAKE_BUILD_TYPE=Release", f"-DPython3_EXECUTABLE={sys.executable}", ] + if platform.system() == "Windows": + args.append("-DCMAKE_GENERATOR=Visual Studio 17 2022") for key in ("CMAKE_GENERATOR_PLATFORM",): if key in os.environ: args.append(f"-D{key}={os.environ[key]}") From fa62e14b9f37c2d4720d3e7a550fb49b17a65571 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 10:07:37 -0400 Subject: [PATCH 30/35] FIX: Point --- .github/workflows/ci.yaml | 1 + setup.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e38cfb..304232d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,6 +55,7 @@ jobs: - name: Setup cross-compilation on Windows run: | echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.arch }}" >> $GITHUB_ENV + echo "Python3_EXECUTABLE=$(python -c "import sys; print(sys.executable + '${{ matrix.arch }}'.lower())")" >> $GITHUB_ENV shell: bash if: runner.os == 'Windows' - uses: pypa/cibuildwheel@v2.20.0 diff --git a/setup.py b/setup.py index e0d67fc..7707d33 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ def run(self): """Build libeep with cmake as part of the extension build process.""" src_dir = Path(__file__).parent / "src" / "libeep" with TemporaryDirectory() as build_dir: # str + Python3_EXECUTABLE = os.environ.get("Python3_EXECUTABLE", sys.executable) args = [ "cmake", "-S", @@ -39,7 +40,7 @@ def run(self): "-B", build_dir, "-DCMAKE_BUILD_TYPE=Release", - f"-DPython3_EXECUTABLE={sys.executable}", + f"-DPython3_EXECUTABLE={Python3_EXECUTABLE}", ] if platform.system() == "Windows": args.append("-DCMAKE_GENERATOR=Visual Studio 17 2022") From 5f6cebe9d74ed97dc9f1a0fd9854aaa19cdd1c05 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 10:33:12 -0400 Subject: [PATCH 31/35] FIX: Partially revert --- .github/workflows/ci.yaml | 1 - setup.py | 8 +++++--- src/libeep/python/CMakeLists.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 304232d..7e38cfb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,7 +55,6 @@ jobs: - name: Setup cross-compilation on Windows run: | echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.arch }}" >> $GITHUB_ENV - echo "Python3_EXECUTABLE=$(python -c "import sys; print(sys.executable + '${{ matrix.arch }}'.lower())")" >> $GITHUB_ENV shell: bash if: runner.os == 'Windows' - uses: pypa/cibuildwheel@v2.20.0 diff --git a/setup.py b/setup.py index 7707d33..20d7775 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,6 @@ def run(self): """Build libeep with cmake as part of the extension build process.""" src_dir = Path(__file__).parent / "src" / "libeep" with TemporaryDirectory() as build_dir: # str - Python3_EXECUTABLE = os.environ.get("Python3_EXECUTABLE", sys.executable) args = [ "cmake", "-S", @@ -40,11 +39,14 @@ def run(self): "-B", build_dir, "-DCMAKE_BUILD_TYPE=Release", - f"-DPython3_EXECUTABLE={Python3_EXECUTABLE}", + f"-DPython3_EXECUTABLE={sys.executable}", ] if platform.system() == "Windows": args.append("-DCMAKE_GENERATOR=Visual Studio 17 2022") - for key in ("CMAKE_GENERATOR_PLATFORM",): + for key in ( + "CMAKE_GENERATOR_PLATFORM", + "Python3_SABI_LIBRARY", + ): if key in os.environ: args.append(f"-D{key}={os.environ[key]}") subprocess.run(args, check=True) diff --git a/src/libeep/python/CMakeLists.txt b/src/libeep/python/CMakeLists.txt index fef193e..7feb3e3 100644 --- a/src/libeep/python/CMakeLists.txt +++ b/src/libeep/python/CMakeLists.txt @@ -3,7 +3,7 @@ message("Python3_EXECUTABLE..... ${Python3_EXECUTABLE}") # https://github.com/pybind/pybind11/pull/2689/files find_package(Python3 REQUIRED COMPONENTS Interpreter Development.SABIModule) message("python 3 include...... ${Python3_INCLUDE_DIRS}") -message("python 3 abi3 lib..... ${Python3_SABI_LIBRARY}") +message("python 3 abi3 lib..... ${Python3_SABI_LIBRARIES}") set(Python_SOABI "abi3") Python3_add_library(pyeep3 MODULE ./pyeep.c USE_SABI 3.9 WITH_SOABI) set_target_properties(pyeep3 PROPERTIES OUTPUT_NAME pyeep) From 57d2396fe76fcccbdc7ec8f48ab681c520e06f32 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 10:38:11 -0400 Subject: [PATCH 32/35] FIX: Hint --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e38cfb..f045ae0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -53,8 +53,10 @@ jobs: platforms: all if: runner.os == 'Linux' - name: Setup cross-compilation on Windows + # TODO: Don't hardcode the lib path! run: | echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.arch }}" >> $GITHUB_ENV + echo "Python3_SABI_LIBRARY=C:/Users/runneradmin/AppData/Local/pypa/cibuildwheel/Cache/nuget-cpython/pythonarm64.3.12.4/tools/libs/python3.lib" >> $GITHUB_ENV shell: bash if: runner.os == 'Windows' - uses: pypa/cibuildwheel@v2.20.0 From 3945d542c49b6c3779d04606343a20cc524582ee Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 11:38:49 -0400 Subject: [PATCH 33/35] FIX: Maybe? --- .github/workflows/ci.yaml | 8 +------ .../cibw_before_build_windows_cross.sh | 9 +++++++ setup.py | 24 +++++++++++++++---- 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/cibw_before_build_windows_cross.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f045ae0..4243815 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,18 +52,12 @@ jobs: with: platforms: all if: runner.os == 'Linux' - - name: Setup cross-compilation on Windows - # TODO: Don't hardcode the lib path! - run: | - echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.arch }}" >> $GITHUB_ENV - echo "Python3_SABI_LIBRARY=C:/Users/runneradmin/AppData/Local/pypa/cibuildwheel/Cache/nuget-cpython/pythonarm64.3.12.4/tools/libs/python3.lib" >> $GITHUB_ENV - shell: bash - if: runner.os == 'Windows' - uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS: ${{ matrix.arch }} # https://cibuildwheel.pypa.io/en/stable/faq/#windows-arm64 CIBW_TEST_SKIP: "*-win_arm64" + CIBW_BEFORE_BUILD_WINDOWS: bash ./.github/workflows/cibw_before_build_windows_cross.sh - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }} diff --git a/.github/workflows/cibw_before_build_windows_cross.sh b/.github/workflows/cibw_before_build_windows_cross.sh new file mode 100644 index 0000000..8ef4e98 --- /dev/null +++ b/.github/workflows/cibw_before_build_windows_cross.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -eo pipefail + +pip install delvewheel +echo "CMAKE_GENERATOR=Visual Studio 17 2022" | tee -a $GITHUB_ENV +echo "CMAKE_GENERATOR_PLATFORM=$CIBW_ARCHS" | tee -a $GITHUB_ENV +PY_VER=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))") +Python3_SABI_LIBRARY="C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python${CIBW_ARCHS,,}.${PY_VER}\\tools\\libs\\python3.lib" +echo "Python3_SABI_LIBRARY=$Python3_SABI_LIBRARY" | tee -a $GITHUB_ENV diff --git a/setup.py b/setup.py index 20d7775..ecb9ad9 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import os import platform +import pprint import subprocess import sys from pathlib import Path @@ -31,6 +32,22 @@ class build_ext(_build_ext): def run(self): """Build libeep with cmake as part of the extension build process.""" src_dir = Path(__file__).parent / "src" / "libeep" + # This is an unfortunate hack to get new env vars within a GH Actions step + # (no way to use before-build to inject env vars back to the env) + check_env = os.environ + try: + check_env = dict( + line.split("=", maxsplit=1) + for line in Path( + os.environ["GITHUB_ENV"] + ).read_text("utf-8").splitlines() + if "=" in line + ) + except Exception: + pass + else: + print("Using GITHUB_ENV instead of os.environ:") + pprint.pprint(check_env) with TemporaryDirectory() as build_dir: # str args = [ "cmake", @@ -41,14 +58,13 @@ def run(self): "-DCMAKE_BUILD_TYPE=Release", f"-DPython3_EXECUTABLE={sys.executable}", ] - if platform.system() == "Windows": - args.append("-DCMAKE_GENERATOR=Visual Studio 17 2022") for key in ( + "CMAKE_GENERATOR", "CMAKE_GENERATOR_PLATFORM", "Python3_SABI_LIBRARY", ): - if key in os.environ: - args.append(f"-D{key}={os.environ[key]}") + if key in check_env: + args.append(f"-D{key}={check_env[key]}") subprocess.run(args, check=True) subprocess.run( ["cmake", "--build", build_dir, "--config", "Release"], check=True From 7de699a084fdccf48c1a37858516d05293adb2e2 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 11:42:47 -0400 Subject: [PATCH 34/35] FIX: See the output --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4243815..99b49fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,6 +58,7 @@ jobs: # https://cibuildwheel.pypa.io/en/stable/faq/#windows-arm64 CIBW_TEST_SKIP: "*-win_arm64" CIBW_BEFORE_BUILD_WINDOWS: bash ./.github/workflows/cibw_before_build_windows_cross.sh + CIBW_BUILD_VERBOSITY: 3 - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }} From 9a3665f8d126b63d443518ff28cb579ef89a584c Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 13 Aug 2024 11:46:35 -0400 Subject: [PATCH 35/35] FIX: Use it --- setup.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index ecb9ad9..75698c8 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,8 @@ def run(self): # This is an unfortunate hack to get new env vars within a GH Actions step # (no way to use before-build to inject env vars back to the env) check_env = os.environ - try: + if "GITHUB_ENV" in check_env: + print("Using GITHUB_ENV instead of os.environ:") check_env = dict( line.split("=", maxsplit=1) for line in Path( @@ -43,10 +44,6 @@ def run(self): ).read_text("utf-8").splitlines() if "=" in line ) - except Exception: - pass - else: - print("Using GITHUB_ENV instead of os.environ:") pprint.pprint(check_env) with TemporaryDirectory() as build_dir: # str args = [