Skip to content

Commit 6254e18

Browse files
committed
Improve API dumping script
* Ensure it runs from the intended directory. * Clean old API files. * Invoke implementation-agnostic post-processing script after dumping.
1 parent 462aa42 commit 6254e18

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

bin/api.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
#!/bin/sh
2+
3+
cd "$(dirname "$0")/.."
4+
5+
# Check for required cross-implementation script.
6+
postprocessScript="../appose/bin/postprocess-api.py"
7+
if [ ! -f "$postprocessScript" ]; then
8+
echo "Error: $postprocessScript not found" >&2
9+
echo "Please ensure appose repository is cloned as a sibling directory." >&2
10+
exit 1
11+
fi
12+
13+
# Clean old API files.
14+
rm -rf api
15+
16+
# Generate pyi API stubs.
217
uv run stubgen --include-private -p appose -o api/
318
uv run stubgen --include-private -o api tests/*.py tests/*/*.py
419

@@ -13,5 +28,9 @@ do
1328
"$pyi" > "${pyi%.pyi}.api"
1429
rm "$pyi"
1530
done
31+
1632
# Remove empty files.
1733
find api -size 0 -exec rm "{}" \;
34+
35+
# Post-process API: normalize | None to ?, expand optional parameters.
36+
python3 "$postprocessScript" api

0 commit comments

Comments
 (0)