From e2138d8a4281ce855438f2e94e8f84f582eb0f05 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 10 Nov 2025 09:11:38 -0800 Subject: [PATCH 1/2] stubs: fix sorting use branch of pybind11-stubgen --- .github/update_stub.sh | 6 +++--- .github/workflows/stubs.yml | 3 ++- docs/requirements.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/update_stub.sh b/.github/update_stub.sh index 5e6875ff..5660c95b 100755 --- a/.github/update_stub.sh +++ b/.github/update_stub.sh @@ -13,6 +13,6 @@ set -eu -o pipefail # we are in the source directory, .github/ this_dir=$(cd $(dirname $0) && pwd) -pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d -pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d -pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d +pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d +pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d +pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d diff --git a/.github/workflows/stubs.yml b/.github/workflows/stubs.yml index df0cb83a..3080e2b8 100644 --- a/.github/workflows/stubs.yml +++ b/.github/workflows/stubs.yml @@ -62,7 +62,8 @@ jobs: ccache -z python3 -m pip install -U pip setuptools[core] wheel - python3 -m pip install -U mpi4py pytest pybind11-stubgen pre-commit + python3 -m pip install -U mpi4py pytest pre-commit + python3 -m pip install -U "pybind11-stubgen @ git+https://github.com/ax3l/pybind11-stubgen.git@fix-class-sorting" cmake -S . -B build -DAMReX_SPACEDIM="1;2;3" -DAMReX_EB=ON -DpyAMReX_IPO=OFF cmake --build build -j 4 --target pip_install diff --git a/docs/requirements.txt b/docs/requirements.txt index b545f286..9f98e688 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -7,7 +7,7 @@ breathe docutils>=0.17.1 numpy # in public APIs -pybind11-stubgen # type hints in pyi files +pybind11-stubgen @ git+https://github.com/ax3l/pybind11-stubgen.git@fix-class-sorting # type hints in pyi files pygments recommonmark # Attention: we need to track the resolution of From 4dbf068121b10091364034ebcd7cf6abf2e318ed Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Nov 2025 01:53:59 -0800 Subject: [PATCH 2/2] Fix: GrowthStrategy Enum - prefix fixed - member access --- .github/update_stub.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/update_stub.sh b/.github/update_stub.sh index 5660c95b..3f72bc3c 100755 --- a/.github/update_stub.sh +++ b/.github/update_stub.sh @@ -16,3 +16,11 @@ this_dir=$(cd $(dirname $0) && pwd) pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d + +sed -i 's/amrex.space1d.GrowthStrategy/GrowthStrategy/g' src/amrex/space1d/amrex_1d_pybind/__init__.pyi +sed -i 's/amrex.space2d.GrowthStrategy/GrowthStrategy/g' src/amrex/space2d/amrex_2d_pybind/__init__.pyi +sed -i 's/amrex.space3d.GrowthStrategy/GrowthStrategy/g' src/amrex/space3d/amrex_3d_pybind/__init__.pyi + +sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space1d/amrex_1d_pybind/__init__.pyi +sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space2d/amrex_2d_pybind/__init__.pyi +sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space3d/amrex_3d_pybind/__init__.pyi