Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b651555
test: remove unused historical snapshot references
virtuald Sep 25, 2026
565522d
docs: specify phase-one pytest harness migration
virtuald Sep 24, 2026
082ba52
docs: plan phase-one pytest harness implementation
virtuald Sep 24, 2026
a07bd90
test: add read-only snapshot comparison helpers
virtuald Sep 24, 2026
c734ada
test: report snapshot directory scan failures
virtuald Sep 24, 2026
f127b07
test: add explicit scoped snapshot updates
virtuald Sep 24, 2026
c13b326
test: propagate snapshot directory cleanup failures
virtuald Sep 24, 2026
ca3e55a
test: validate generator processes and preserve normalization
virtuald Sep 24, 2026
9ca89db
test: retain isolated snapshot failure diagnostics
virtuald Sep 24, 2026
2b96409
test: protect snapshot diagnostics and preserve failure context
virtuald Sep 24, 2026
66e86f4
test: add pytest demo generation and error checks
virtuald Sep 24, 2026
3a3035f
test: switch tox and CI to non-mutating pytest checks
virtuald Sep 24, 2026
72f58f7
test: preserve repository-root Ruff import classification
virtuald Sep 24, 2026
419468d
test: preserve process diagnostics when log writes fail
virtuald Sep 24, 2026
b23588f
test: install tox project with uv
virtuald Sep 24, 2026
68287f9
test: align error expectations with registration order
virtuald Sep 24, 2026
6fd7bae
docs: define compiler-free phase-two test design
virtuald Sep 25, 2026
d25ee60
docs: plan compiler-free production test implementation
virtuald Sep 25, 2026
c7ac28c
test: cover parser contracts with independent Python fixtures
virtuald Sep 25, 2026
15a1a63
test: cover annotation structure and invalid expressions
virtuald Sep 25, 2026
cc788f7
test: cover stable class dependencies and cycle fallback
virtuald Sep 25, 2026
4c3c924
test: cover exact printer output and rendering options
virtuald Sep 25, 2026
6870c28
test: cover writer layouts contents and error propagation
virtuald Sep 25, 2026
832f328
test: exercise pure Python generation pipeline without native bindings
virtuald Sep 25, 2026
f5b47e9
test: run compiler-free contracts across supported Python versions
virtuald Sep 25, 2026
91bfa7f
docs: define shared native test orchestration design
virtuald Sep 25, 2026
a8e3b39
docs: plan shared native test orchestration implementation
virtuald Sep 25, 2026
26dddac
test: parameterize native modes and share installed-origin guards
virtuald Sep 25, 2026
c1d0ba9
test: add isolated fixture wheel builder with retained diagnostics
virtuald Sep 25, 2026
ee11e4e
test: build pinned native fixtures once per tox profile
virtuald Sep 25, 2026
2344b79
test: derive native CI jobs from tox and consume the built wheel
virtuald Sep 25, 2026
49be65f
docs: document grouped native tests and verified dependency policy
virtuald Sep 25, 2026
4c84bad
test: cover fixture wheel cardinality and clarify reference labels
virtuald Sep 25, 2026
c64af03
docs: define shared TOML snapshot catalog design
virtuald Sep 25, 2026
51ac280
docs: plan shared snapshot catalog implementation
virtuald Sep 25, 2026
d6df518
test: add strict TOML snapshot catalog reader
virtuald Sep 25, 2026
4bdf3f3
test: add case-scoped TOML snapshot updates
virtuald Sep 25, 2026
fa1c133
test: share snapshot payloads through explicit TOML cases
virtuald Sep 25, 2026
6f27dfc
docs: document shared snapshots and copy-on-write updates
virtuald Sep 26, 2026
ced7244
test: support empty snapshot catalog fixtures
virtuald Sep 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
198 changes: 66 additions & 132 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
name: Build wheel
runs-on: ubuntu-latest
needs: [check]
outputs:
native-matrix: ${{ steps.native-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
Expand All @@ -40,6 +42,16 @@ jobs:

- uses: astral-sh/setup-uv@v7

- name: Derive native test matrix from tox
id: native-matrix
shell: bash
run: |
set -euo pipefail
uv run --no-project --isolated --with tox --with tox-uv \
tox list -d --no-desc > "$RUNNER_TEMP/native-envs.txt"
matrix=$(python tests/native_matrix.py "$RUNNER_TEMP/native-envs.txt")
printf 'matrix=%s\n' "$matrix" >> "$GITHUB_OUTPUT"

- name: Build sdist + wheel
run: |
uv lock --check
Expand All @@ -51,158 +63,80 @@ jobs:
name: dist
path: dist

tests:
name: "Test 🐍 ${{ matrix.config.python }} • pybind-${{ matrix.config.pybind11-branch }} • ${{ matrix.config.numpy-format }}"
unit-tests:
name: "Compiler-free tests • Python ${{ matrix.python }}"
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
config:
[
{
pybind11-branch: "v3.0",
python: "3.13",
numpy-format: "numpy-array-use-type-var",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v3.0",
python: "3.13",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v3.0",
python: "3.12",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v3.0",
python: "3.11",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v3.0",
python: "3.10",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.13",
python: "3.13",
numpy-format: "numpy-array-use-type-var",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.13",
python: "3.13",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.13",
python: "3.12",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.13",
python: "3.11",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.13",
python: "3.10",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "4.2.x",
},
{
pybind11-branch: "v2.12",
python: "3.13",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "3.28.3",
},
{
pybind11-branch: "v2.11",
python: "3.13",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "3.28.3",
},
{
pybind11-branch: "v2.9",
python: "3.13",
numpy-format: "numpy-array-wrap-with-annotated",
cmake-version: "3.28.3",
},
]
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v5

- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: dist
path: dist

- name: Setup Python ${{ matrix.config.python }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.python }}

python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@v7

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v2
- uses: actions/download-artifact@v6
with:
cmake-version: ${{ matrix.config.cmake-version }}

- name: Create UV venv
run: |
uv venv .venv

- name: Setup annotations on Linux
if: runner.os == 'Linux'
run: uv pip install pytest-github-actions-annotate-failures

- name: Install requirements
run: uv sync --group dev --no-install-project

- name: Install
shell: bash
working-directory: dist
run: uv pip install --disable-pip-version-check *.whl

- name: Install demo module
name: dist
path: dist
- name: Install wheel and test dependencies
shell: bash
run: |
source .venv/bin/activate
./tests/install-demo-module.sh --pybind11-branch "${{ matrix.config.pybind11-branch }}"
uv venv .venv
uv pip install --python .venv/bin/python 'pytest>=8,<9' \
'tomli>=2,<3; python_version < "3.11"' 'tomlkit>=0.13,<1' dist/*.whl
- name: Test installed wheel without native fixtures
env:
STUBGEN_TEST_INSTALLED: "1"
run: .venv/bin/python -I -m pytest tests/unit tests/test_snapshot_helpers.py

- name: Check stubs generation
tests:
name: "Native tests • ${{ matrix.env }}"
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build.outputs.native-matrix) }}
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with:
name: dist
path: dist
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: astral-sh/setup-uv@v7
- name: Test supplied wheel through shared tox profile
shell: bash
env:
TOX_PROFILE: ${{ matrix.env }}
run: |
source .venv/bin/activate
./tests/check-demo-stubs-generation.sh --stubs-sub-dir "stubs/python-${{ matrix.config.python }}/pybind11-${{ matrix.config.pybind11-branch }}/${{ matrix.config.numpy-format }}" --${{ matrix.config.numpy-format }}

- name: Archive patch
set -euo pipefail
shopt -s nullglob
wheels=(dist/*.whl)
test "${#wheels[@]}" -eq 1
uv run --no-project --isolated --with tox --with tox-uv \
tox -e "$TOX_PROFILE" --installpkg "${wheels[0]}"
- name: Archive native build and test diagnostics
uses: actions/upload-artifact@v6
if: failure()
with:
name: "python-${{ matrix.config.python }}-pybind-${{ matrix.config.pybind11-branch }}-${{ matrix.config.numpy-format }}.patch"
path: "./tests/stubs/python-${{ matrix.config.python }}/pybind11-${{ matrix.config.pybind11-branch }}/${{ matrix.config.numpy-format }}.patch"
name: "${{ matrix.env }}-diagnostics"
include-hidden-files: true
path: |
.tox/${{ matrix.env }}/log/
.tox/${{ matrix.env }}/tmp/native/**/evidence.json
.tox/${{ matrix.env }}/tmp/native/**/*.log
.tox/${{ matrix.env }}/tmp/native/**/CMakeCache.txt
.tox/${{ matrix.env }}/tmp/native/**/CMakeConfigureLog.yaml
.tox/${{ matrix.env }}/tmp/pytest-artifacts/
.tox/${{ matrix.env }}/tmp/native.xml
retention-days: 30
if-no-files-found: ignore

- name: Check error generation
shell: bash
run: |
source .venv/bin/activate
./tests/check-demo-errors-generation.sh "pybind11-${{ matrix.config.pybind11-branch }}"

test-cli-options:
name: "Runs on 🐍 ${{ matrix.python }} • ${{ matrix.test-package }}"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -261,7 +195,7 @@ jobs:

publish:
name: Publish distribution
needs: [check, build, tests, test-cli-options]
needs: [check, build, unit-tests, tests, test-cli-options]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
Expand Down
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,13 @@ pybind11-stubgen [-h]
Contributing
------------

During development, you may need to update the reference stubs in tests/stubs. This can be done locally using a convenience tox configuration. Ensure that all Python interpreters required by the test suite are available in your environment. For example, you can install them via uv:
```shell
uv python install 3.10 3.11 3.12 3.13
```
To enable the repository hooks locally:
```shell
See [the testing guide](tests/README.md) for prerequisites, running checks,
updating reference snapshots, and adding regression fixtures. Normal test runs
do not update or stage reference files.

To enable repository hooks locally:

```sh
uv sync
uv run pre-commit install
```
To regenerate the reference stubs run:
```shell
uv venv
source .venv/bin/activate
uv tool install tox --with tox-uv
uv run tox
```
Loading
Loading