From 71be15844dd1ced1b62ac2c9c13d1c0ac362a030 Mon Sep 17 00:00:00 2001 From: "python-templates-copier-update[bot]" Date: Sun, 16 Aug 2026 23:14:55 +0000 Subject: [PATCH] Update from Copier (2026-08-16T23-14-51Z) Signed-off-by: python-templates-copier-update[bot] --- .copier-answers.yaml | 2 +- .github/workflows/build.yaml | 60 ++++++++++++++++++++------- .gitignore | 2 + Makefile | 6 ++- pyproject.toml | 8 +++- python_template_cpp/tests/__init__.py | 1 + 6 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 python_template_cpp/tests/__init__.py diff --git a/.copier-answers.yaml b/.copier-answers.yaml index a7b5082..a503fc7 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: d814faa +_commit: 8ac03b9 _src_path: https://github.com/python-project-templates/base.git add_docs: true add_extension: cpp diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 02c2d31..e703f6e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,11 +25,20 @@ permissions: jobs: build: - runs-on: ${{ matrix.os }} + name: build (${{ matrix.platform.name }}-${{ matrix.python.version }}) + runs-on: ${{ matrix.platform.os }} strategy: matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] + platform: + - name: ubuntu-latest + os: ubuntu-latest + - name: ubuntu-24.04-arm + os: ubuntu-24.04-arm + - name: macos-latest + os: macos-latest + - name: windows-latest + os: windows-latest python: - version: "3.11" cibuildwheel: "cp311" @@ -40,6 +49,19 @@ jobs: - version: "3.13" cibuildwheel: "cp313" primary: false + include: + - target: native + dist_path: dist + - platform: + name: pyodide + os: ubuntu-latest + python: + version: "3.14" + cibuildwheel: "cp314" + primary: false + target: pyodide + dist_path: dist/pyodide + steps: - name: Checkout @@ -60,38 +82,46 @@ jobs: - name: Install dependencies run: make develop + if: matrix.target == 'native' - name: Lint run: make lint - if: matrix.os == 'ubuntu-latest' && matrix.python.primary + if: matrix.platform.name == 'ubuntu-latest' && matrix.python.primary - name: Checks run: make checks - if: matrix.os == 'ubuntu-latest' && matrix.python.primary + if: matrix.platform.name == 'ubuntu-latest' && matrix.python.primary - name: Test run: make coverage + if: matrix.target == 'native' + + - name: Build and test Pyodide wheel + run: make test-pyodide + if: matrix.target == 'pyodide' - name: Upload test results (Python) uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: test-results-${{ matrix.os }}-${{ matrix.python.version }} + name: test-results-${{ matrix.platform.name }}-${{ matrix.python.version }} path: junit.xml - if: matrix.os == 'ubuntu-latest' && matrix.python.primary + if: matrix.platform.name == 'ubuntu-latest' && matrix.python.primary - name: Publish test results uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0 with: files: '**/junit.xml' - if: matrix.os == 'ubuntu-latest' && matrix.python.primary + if: matrix.platform.name == 'ubuntu-latest' && matrix.python.primary - name: Upload coverage uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: token: ${{ secrets.CODECOV_TOKEN }} + if: matrix.target == 'native' - name: Install build dependencies run: pip install cibuildwheel + if: matrix.target == 'native' - name: Build distributions (Linux x86_64) run: | @@ -103,7 +133,7 @@ jobs: CIBW_BUILD: "${{ matrix.python.cibuildwheel }}-manylinux*" CIBW_ARCHS_LINUX: native CIBW_BUILD_VERBOSITY: 3 - if: matrix.os == 'ubuntu-latest' + if: matrix.platform.name == 'ubuntu-latest' - name: Build distributions (Linux ARM64) run: | @@ -114,7 +144,7 @@ jobs: CIBW_BUILD: "${{ matrix.python.cibuildwheel }}-manylinux*" CIBW_ARCHS_LINUX: native CIBW_BUILD_VERBOSITY: 3 - if: matrix.os == 'ubuntu-24.04-arm' + if: matrix.platform.name == 'ubuntu-24.04-arm' - name: Build distributions (macOS) run: | @@ -123,7 +153,7 @@ jobs: env: CIBW_BUILD: "${{ matrix.python.cibuildwheel }}-macos*" CIBW_BUILD_VERBOSITY: 3 - if: matrix.os == 'macos-latest' + if: matrix.platform.name == 'macos-latest' - name: Build distributions (Windows) run: | @@ -131,22 +161,22 @@ jobs: make dist-py-wheel env: CIBW_BUILD: "${{ matrix.python.cibuildwheel }}-win_amd64" - if: matrix.os == 'windows-latest' + if: matrix.platform.name == 'windows-latest' - name: Test wheel uses: actions-ext/python/test-wheel@6e1b91a408ea89f49bc8aff8724f83826f7b5446 with: module: python_template_cpp - if: runner.os == 'Linux' + if: matrix.target == 'native' && runner.os == 'Linux' - name: Test source distribution uses: actions-ext/python/test-sdist@6e1b91a408ea89f49bc8aff8724f83826f7b5446 with: module: python_template_cpp - if: matrix.os == 'ubuntu-latest' + if: matrix.platform.name == 'ubuntu-latest' - name: Upload distributions uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: dist-${{ matrix.os }}-${{ matrix.python.version }} - path: dist + name: dist-${{ matrix.platform.name }}-${{ matrix.python.version }} + path: ${{ matrix.dist_path }} diff --git a/.gitignore b/.gitignore index e48ddfc..8b398b1 100644 --- a/.gitignore +++ b/.gitignore @@ -146,6 +146,8 @@ python_template_cpp/labextension # Emscripten SDK (locally installed) emsdk +.pyodide_build/ + # Mac .DS_Store diff --git a/Makefile b/Makefile index dea2748..ea9dd13 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,12 @@ tests-py: test-py coverage-py: ## run python tests and collect test coverage python -m pytest -v python_template_cpp/tests --cov=python_template_cpp --cov-report term-missing --cov-report xml -.PHONY: test coverage tests +.PHONY: test test-pyodide coverage tests test: test-py ## run all tests + +test-pyodide: ## build and test the Python package in Pyodide + uvx --from cibuildwheel==4.2.0 cibuildwheel --only cp314-pyodide_wasm32 --output-dir dist/pyodide . + coverage: coverage-py ## run all tests and collect test coverage # alias diff --git a/pyproject.toml b/pyproject.toml index 4f1d5c6..049183b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "hatchling", - "hatch-cpp", + "hatch-cpp>=0.5.0", "pybind11", ] build-backend = "hatchling.build" @@ -39,7 +39,7 @@ develop = [ "check-dist", "cibuildwheel", "codespell", - "hatch-cpp", + "hatch-cpp>=0.5.0", "hatchling", "mdformat", "mdformat-tables>=1", @@ -93,6 +93,10 @@ archs = "arm64" archs = "AMD64" skip = "*win32 *arm_64" +[tool.cibuildwheel.pyodide] +test-command = "python -m pytest -vvv --pyargs python_template_cpp.tests" +test-extras = [] +test-requires = ["pytest"] [tool.coverage.run] branch = true omit = [ diff --git a/python_template_cpp/tests/__init__.py b/python_template_cpp/tests/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/python_template_cpp/tests/__init__.py @@ -0,0 +1 @@ +