read out class.__dict__ to avoid concurrent modification #593
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Install requirements | |
| run: | | |
| uv lock --check | |
| uv sync | |
| - name: Run Ruff as isort | |
| run: uv run ruff check --select I,RUF022 --fix --diff ./pybind11_stubgen | |
| if: ${{ failure() || success() }} | |
| - name: Run Ruff format | |
| run: uv run ruff format --diff ./pybind11_stubgen | |
| if: ${{ failure() || success() }} | |
| - name: Run Ruff | |
| run: | | |
| uv run ruff check --ignore F401,F821 . | |
| if: ${{ failure() || success() }} | |
| build: | |
| name: Build wheel | |
| runs-on: ubuntu-latest | |
| needs: [check] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Build sdist + wheel | |
| run: | | |
| uv lock --check | |
| uv build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: dist | |
| path: dist | |
| tests: | |
| name: "Test 🐍 ${{ matrix.config.python }} • pybind-${{ matrix.config.pybind11-branch }} • ${{ matrix.config.numpy-format }}" | |
| 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", | |
| }, | |
| ] | |
| 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 | |
| with: | |
| python-version: ${{ matrix.config.python }} | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Update CMake | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| 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 | |
| shell: bash | |
| run: | | |
| source .venv/bin/activate | |
| ./tests/install-demo-module.sh --pybind11-branch "${{ matrix.config.pybind11-branch }}" | |
| - name: Check stubs generation | |
| shell: bash | |
| 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 | |
| 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" | |
| 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 | |
| needs: [build] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test-package: ["gemmi"] | |
| python: | |
| - "3.13" | |
| - "3.12" | |
| - "3.11" | |
| - "3.10" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Python ${{ matrix.python }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: dist | |
| path: dist | |
| - 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 | |
| shell: bash | |
| working-directory: dist | |
| run: uv pip install --disable-pip-version-check *.whl | |
| - name: "Install ${{ matrix.test-package }}" | |
| shell: bash | |
| run: uv pip install "${{ matrix.test-package }}" | |
| - name: Generate stubs | |
| shell: bash | |
| run: | | |
| source .venv/bin/activate | |
| pybind11-stubgen "${{ matrix.test-package }}" -o flavour-1 --numpy-array-wrap-with-annotated | |
| pybind11-stubgen "${{ matrix.test-package }}" -o flavour-2 --numpy-array-remove-parameters | |
| pybind11-stubgen "${{ matrix.test-package }}" -o flavour-3 --print-invalid-expressions-as-is | |
| pybind11-stubgen "${{ matrix.test-package }}" -o flavour-4 --numpy-array-use-type-var | |
| pybind11-stubgen "${{ matrix.test-package }}" --dry-run | |
| publish: | |
| name: Publish distribution | |
| needs: [check, build, tests, test-cli-options] | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for Trusted Publishing | |
| id-token: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |