Skip to content

Commit e4e16ad

Browse files
authored
stubs: fix sorting (#509)
use branch of pybind11-stubgen: #504 (comment) [preview](https://pyamrex--509.org.readthedocs.build/en/509/usage/api.html)
1 parent 14c9dcf commit e4e16ad

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/update_stub.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ set -eu -o pipefail
1313
# we are in the source directory, .github/
1414
this_dir=$(cd $(dirname $0) && pwd)
1515

16-
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d
17-
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d
18-
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d
16+
pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d
17+
pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d
18+
pybind11-stubgen --sort-by=definition --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d
19+
20+
sed -i 's/amrex.space1d.GrowthStrategy/GrowthStrategy/g' src/amrex/space1d/amrex_1d_pybind/__init__.pyi
21+
sed -i 's/amrex.space2d.GrowthStrategy/GrowthStrategy/g' src/amrex/space2d/amrex_2d_pybind/__init__.pyi
22+
sed -i 's/amrex.space3d.GrowthStrategy/GrowthStrategy/g' src/amrex/space3d/amrex_3d_pybind/__init__.pyi
23+
24+
sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space1d/amrex_1d_pybind/__init__.pyi
25+
sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space2d/amrex_2d_pybind/__init__.pyi
26+
sed -i 's/= GrowthStrategy.Poisson/= "GrowthStrategy.Poisson"/g' src/amrex/space3d/amrex_3d_pybind/__init__.pyi

.github/workflows/stubs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
ccache -z
6363
6464
python3 -m pip install -U pip setuptools[core] wheel
65-
python3 -m pip install -U mpi4py pytest pybind11-stubgen pre-commit
65+
python3 -m pip install -U mpi4py pytest pre-commit
66+
python3 -m pip install -U "pybind11-stubgen @ git+https://github.com/ax3l/pybind11-stubgen.git@fix-class-sorting"
6667
cmake -S . -B build -DAMReX_SPACEDIM="1;2;3" -DAMReX_EB=ON -DpyAMReX_IPO=OFF
6768
cmake --build build -j 4 --target pip_install
6869

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
breathe
88
docutils>=0.17.1
99
numpy # in public APIs
10-
pybind11-stubgen # type hints in pyi files
10+
pybind11-stubgen @ git+https://github.com/ax3l/pybind11-stubgen.git@fix-class-sorting # type hints in pyi files
1111
pygments
1212
recommonmark
1313
# Attention: we need to track the resolution of

0 commit comments

Comments
 (0)