From a69ded0294abb3965b3a78dafca13e375e646ed8 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:05:25 +0100 Subject: [PATCH 1/6] ci: update python versions as python 3.13 is available, and python 3.7 no longer available in github actions --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46b80806..33190bc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.13' - name: Checkout uses: actions/checkout@v4 - name: Install requirements @@ -46,12 +46,12 @@ jobs: pybind11-branch: - "master" python: + - "3.13" - "3.12" - "3.11" - "3.10" - "3.9" - "3.8" - - "3.7" numpy-format: - "numpy-array-wrap-with-annotated" include: @@ -114,11 +114,12 @@ jobs: matrix: test-package: [ "gemmi" ] python: + - "3.13" + - "3.12" - "3.11" - "3.10" - "3.9" - "3.8" - - "3.7" steps: - uses: actions/checkout@v4 @@ -159,7 +160,7 @@ jobs: - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.13" - name: Build dist run: pipx run build --sdist --wheel From 2b00c391de9f725044992e7fadd2a4db4c08931a Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:07:43 +0100 Subject: [PATCH 2/6] test requirements: ln -s python-3.12 python-3.13 --- tests/stubs/python-3.13 | 1 + 1 file changed, 1 insertion(+) create mode 120000 tests/stubs/python-3.13 diff --git a/tests/stubs/python-3.13 b/tests/stubs/python-3.13 new file mode 120000 index 00000000..0a8325ae --- /dev/null +++ b/tests/stubs/python-3.13 @@ -0,0 +1 @@ +python-3.12 \ No newline at end of file From 1a551a9728ea1601da60e4b7da8b0ebfdb292916 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:24:48 +0100 Subject: [PATCH 3/6] tests: use cmeel-eigen to fix CI: ```cmake CMake Error at tmp/pybind11-master/build/eigen/blas/cmake_install.cmake:46 (file): file INSTALL cannot find "/home/runner/work/pybind11-stubgen/pybind11-stubgen/tmp/pybind11-master/build/eigen/blas/libeigen_blas_static.a": No such file or directory. Call Stack (most recent call first): tmp/pybind11-master/build/eigen/cmake_install.cmake:87 (include) ``` --- .github/workflows/ci.yml | 2 +- tests/install-demo-module.sh | 23 ----------------------- tests/stubs/python-3.12/requirements.txt | 1 + tests/stubs/python-3.7/requirements.txt | 1 + tests/stubs/python-3.8/requirements.txt | 1 + 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33190bc2..0d99af27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: - name: Install demo module shell: bash - run: ./tests/install-demo-module.sh --pybind11-branch "${{ matrix.pybind11-branch }}" --eigen-branch "master" + run: ./tests/install-demo-module.sh --pybind11-branch "${{ matrix.pybind11-branch }}" - name: Check stubs generation shell: bash diff --git a/tests/install-demo-module.sh b/tests/install-demo-module.sh index a9c60c1d..69bdd414 100755 --- a/tests/install-demo-module.sh +++ b/tests/install-demo-module.sh @@ -15,20 +15,17 @@ function parse_args() { fi echo "Usage: $0 --pybind11-branch PYBIND11_BRANCH" echo " --pybind11-branch name of pybind11 branch" - echo " --eigen-branch name of eigen branch" exit 1 } # parse params while [[ "$#" > 0 ]]; do case $1 in --pybind11-branch) PYBIND11_BRANCH="$2"; shift;shift;; - --eigen-branch) EIGEN_BRANCH="$2"; shift;shift;; *) usage "Unknown parameter passed: $1"; shift; shift;; esac; done # verify params if [ -z "$PYBIND11_BRANCH" ]; then usage "PYBIND11_BRANCH is not set"; fi; - if [ -z "$EIGEN_BRANCH" ]; then usage "EIGEN_BRANCH is not set"; fi; TESTS_ROOT="$(readlink -m "$(dirname "$0")")" PROJECT_ROOT="${TESTS_ROOT}/.." @@ -39,18 +36,6 @@ function parse_args() { } -clone_eigen() { - mkdir -p "${EXTERNAL_DIR}" - if [ ! -d "${EXTERNAL_DIR}/eigen" ]; then - git clone \ - --depth 1 \ - --branch "${EIGEN_BRANCH}" \ - --single-branch \ - https://gitlab.com/libeigen/eigen.git \ - "${EXTERNAL_DIR}/eigen" - fi -} - clone_pybind11() { mkdir -p "${EXTERNAL_DIR}" if [ ! -d "${EXTERNAL_DIR}/pybind11" ]; then @@ -63,12 +48,6 @@ clone_pybind11() { fi } -install_eigen() { - cmake -S "${EXTERNAL_DIR}/eigen" -B "${BUILD_ROOT}/eigen" - cmake --install "${BUILD_ROOT}/eigen" \ - --prefix "${INSTALL_PREFIX}" -} - install_pybind11() { cmake \ -S "${EXTERNAL_DIR}/pybind11" \ @@ -95,10 +74,8 @@ install_pydemo() { main () { parse_args "$@" - clone_eigen clone_pybind11 install_pybind11 - install_eigen install_demo install_pydemo } diff --git a/tests/stubs/python-3.12/requirements.txt b/tests/stubs/python-3.12/requirements.txt index 164b4719..7c84e9c8 100644 --- a/tests/stubs/python-3.12/requirements.txt +++ b/tests/stubs/python-3.12/requirements.txt @@ -1,4 +1,5 @@ black==22.8.0 +cmeel-eigen==3.4.0.2 isort==5.10.1 numpy~=1.20 scipy~=1.0 diff --git a/tests/stubs/python-3.7/requirements.txt b/tests/stubs/python-3.7/requirements.txt index 164b4719..7c84e9c8 100644 --- a/tests/stubs/python-3.7/requirements.txt +++ b/tests/stubs/python-3.7/requirements.txt @@ -1,4 +1,5 @@ black==22.8.0 +cmeel-eigen==3.4.0.2 isort==5.10.1 numpy~=1.20 scipy~=1.0 diff --git a/tests/stubs/python-3.8/requirements.txt b/tests/stubs/python-3.8/requirements.txt index 164b4719..7c84e9c8 100644 --- a/tests/stubs/python-3.8/requirements.txt +++ b/tests/stubs/python-3.8/requirements.txt @@ -1,4 +1,5 @@ black==22.8.0 +cmeel-eigen==3.4.0.2 isort==5.10.1 numpy~=1.20 scipy~=1.0 From d8e1fd3797aecd0a65d5b0f1cbdd1d2224609ca2 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:30:15 +0100 Subject: [PATCH 4/6] tests: let cmake find cmeel-eigen --- tests/install-demo-module.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/install-demo-module.sh b/tests/install-demo-module.sh index 69bdd414..62098462 100755 --- a/tests/install-demo-module.sh +++ b/tests/install-demo-module.sh @@ -49,6 +49,7 @@ clone_pybind11() { } install_pybind11() { + export CMAKE_PREFIX_PATH="$(cmeel cmake)" cmake \ -S "${EXTERNAL_DIR}/pybind11" \ -B "${BUILD_ROOT}/pybind11"\ @@ -66,7 +67,7 @@ install_demo() { install_pydemo() { ( - export CMAKE_PREFIX_PATH="$(readlink -m "${INSTALL_PREFIX}")"; + export CMAKE_PREFIX_PATH="$(readlink -m "${INSTALL_PREFIX}"):$(cmeel cmake)"; export CMAKE_ARGS="-DCMAKE_CXX_STANDARD=17"; pip install --force-reinstall "${TESTS_ROOT}/py-demo" ) From ca91504a8d9c485182fafdd6e4873e1c251757dd Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:34:35 +0100 Subject: [PATCH 5/6] filter: exclude _pybind11_conduit_v1_ --- pybind11_stubgen/parser/mixins/filter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pybind11_stubgen/parser/mixins/filter.py b/pybind11_stubgen/parser/mixins/filter.py index c011293d..593bc511 100644 --- a/pybind11_stubgen/parser/mixins/filter.py +++ b/pybind11_stubgen/parser/mixins/filter.py @@ -104,6 +104,8 @@ def handle_class_member( return None if name.startswith("__pybind11_module"): return None + if name.startswith("_pybind11_conduit_v1_"): + return None return super().handle_class_member(path, class_, member) From be62c2764a5cc8224979cbfd03bc96cc64ef7e9f Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 31 Jan 2025 18:45:37 +0100 Subject: [PATCH 6/6] python 3.13: filter new dunder attributes --- pybind11_stubgen/parser/mixins/filter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pybind11_stubgen/parser/mixins/filter.py b/pybind11_stubgen/parser/mixins/filter.py index 593bc511..aee10488 100644 --- a/pybind11_stubgen/parser/mixins/filter.py +++ b/pybind11_stubgen/parser/mixins/filter.py @@ -40,11 +40,13 @@ class FilterClassMembers(IParser): "__builtins__", "__cached__", "__file__", + "__firstlineno__", "__loader__", "__name__", "__package__", "__path__", "__spec__", + "__static_attributes__", ), ) }