Skip to content

Commit 23ed555

Browse files
authored
Improve auto-generated documentation and type stubs (#1413)
* Improve auto-generated documentation and type stubs - Use `bytes` and `str | Path` where appropriate. - Extend the type stub generation to generate the full enum definitions and define `Operation` and `Introspect`. - Extend the type stub with more operations (all apart from nifti-based ones). * Re-format `voperation.py` to satisfy flake8 * Fix two small typing issues that mypy found * Improve the type stubs massively so that all examples now pass mypy and pyright - Create a separate stub for `enums.py` to support importing these separately. - Properly type the NumPy functions, which mypy and pyright ignore is NumPy is not available. - Add the missing trigonometric, exponential, and complex operations. - Force keyword arguments to be keyword arguments. - Type `interpolate` as `Interpolate`, not the overly broad `GObject`. - Introduce type aliases to reduce duplication. - Make very minor adjustments elsewhere to avoid mypy errors. * Add the missing libraries to `ci.yml` * Switch to PyPy 3.11 for CI * Switch to PyPy 3.10, which works on Ubuntu 22.04
1 parent e855f6c commit 23ed555

9 files changed

Lines changed: 1433 additions & 874 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
# Only test supported Python versions:
1313
# https://endoflife.date/python
14-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.9"]
14+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.10"]
1515

1616
steps:
1717
- name: Checkout code
@@ -36,11 +36,9 @@ jobs:
3636
run: |
3737
# Pin mypy to <1.19 due to librt dependency in 1.19+
3838
# which is not available on PyPy 3.9
39-
pip install "mypy<1.19"
39+
pip install "mypy<1.19" "numpy" "pillow" "requests" "types-requests"
4040
mypy pyvips/__init__.pyi --no-error-summary
41-
mypy examples/affine.py examples/convolve.py examples/try5.py examples/watermark.py \
42-
examples/annotate-animation.py examples/join-animation.py examples/progress.py \
43-
--no-error-summary
41+
mypy examples/*.py --no-error-summary
4442
4543
- name: Install tox and any other packages
4644
run: pip install tox

doc/vimage.rst

Lines changed: 258 additions & 252 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)