Skip to content

Commit 86e04a2

Browse files
Update from Copier (2026-08-16T23-14-58Z)
Signed-off-by: python-templates-copier-update[bot] <python-templates-copier-update[bot]@users.noreply.github.com>
1 parent 77e7229 commit 86e04a2

7 files changed

Lines changed: 69 additions & 20 deletions

File tree

.copier-answers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: d814faa
2+
_commit: 8ac03b9
33
_src_path: https://github.com/python-project-templates/base.git
44
add_docs: true
55
add_extension: rust

.github/workflows/build.yaml

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,38 @@ permissions:
2525

2626
jobs:
2727
build:
28+
name: build (${{ matrix.name }})
2829
runs-on: ${{ matrix.os }}
2930

3031
strategy:
3132
matrix:
32-
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
33+
include:
34+
- name: ubuntu-latest
35+
dist_path: dist
36+
os: ubuntu-latest
37+
python: "3.11"
38+
target: native
39+
- name: ubuntu-24.04-arm
40+
dist_path: dist
41+
os: ubuntu-24.04-arm
42+
python: "3.11"
43+
target: native
44+
- name: macos-latest
45+
dist_path: dist
46+
os: macos-latest
47+
python: "3.11"
48+
target: native
49+
- name: windows-latest
50+
dist_path: dist
51+
os: windows-latest
52+
python: "3.11"
53+
target: native
54+
- name: pyodide
55+
dist_path: dist/pyodide
56+
os: ubuntu-latest
57+
python: "3.14"
58+
target: pyodide
59+
3360

3461
steps:
3562
- name: Checkout
@@ -40,51 +67,60 @@ jobs:
4067
- name: Setup Python
4168
uses: actions-ext/python/setup@6e1b91a408ea89f49bc8aff8724f83826f7b5446
4269
with:
43-
version: "3.11"
70+
version: ${{ matrix.python }}
4471

4572
- name: Setup Rust
4673
uses: actions-ext/rust/setup@2db8e3e4c56beb7320c7d730bd2c2d6a6447bf6b
4774

4875
- name: Install dependencies
4976
run: make develop
77+
if: matrix.target == 'native'
5078

5179
- name: Lint
5280
run: make lint
81+
if: matrix.target == 'native'
5382

5483
- name: Checks
5584
run: make checks
56-
if: matrix.os == 'ubuntu-latest'
85+
if: matrix.name == 'ubuntu-latest'
5786

5887
- name: Build
5988
run: make build
89+
if: matrix.target == 'native'
6090

6191
- name: Test
6292
run: make coverage
93+
if: matrix.target == 'native'
94+
95+
- name: Build and test Pyodide wheel
96+
run: make test-pyodide
97+
if: matrix.target == 'pyodide'
6398

6499
- name: Upload test results (Python)
65100
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
66101
with:
67-
name: test-results-${{ matrix.os }}
102+
name: test-results-${{ matrix.name }}
68103
path: '**/junit.xml'
69-
if: always()
104+
if: always() && matrix.target == 'native'
70105

71106
- name: Publish test results
72107
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
73108
with:
74109
files: '**/junit.xml'
75-
if: matrix.os == 'ubuntu-latest'
110+
if: matrix.name == 'ubuntu-latest'
76111

77112
- name: Upload coverage
78113
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
79114
with:
80115
token: ${{ secrets.CODECOV_TOKEN }}
116+
if: matrix.target == 'native'
81117

82118
- name: Free disk space
83119
run: |
84120
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/share/swift
85121
df -h /
86122
shell: bash
87-
if: runner.os == 'Linux'
123+
if: matrix.target == 'native' && runner.os == 'Linux'
88124

89125
- name: Build distributions (Linux x86_64)
90126
run: |
@@ -96,7 +132,7 @@ jobs:
96132
shell: bash
97133
env:
98134
CIBW_ARCHS_LINUX: native
99-
if: matrix.os == 'ubuntu-latest'
135+
if: matrix.name == 'ubuntu-latest'
100136

101137
- name: Build distributions (Linux ARM64)
102138
run: |
@@ -106,7 +142,7 @@ jobs:
106142
shell: bash
107143
env:
108144
CIBW_ARCHS_LINUX: native
109-
if: matrix.os == 'ubuntu-24.04-arm'
145+
if: matrix.name == 'ubuntu-24.04-arm'
110146

111147
- name: Build distributions (macOS/Windows)
112148
run: |
@@ -116,22 +152,22 @@ jobs:
116152
shell: bash
117153
env:
118154
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
119-
if: runner.os != 'Linux'
155+
if: matrix.target == 'native' && runner.os != 'Linux'
120156

121157
- name: Test wheel
122158
uses: actions-ext/python/test-wheel@6e1b91a408ea89f49bc8aff8724f83826f7b5446
123159
with:
124160
module: python_template_rust
125-
if: runner.os == 'Linux'
161+
if: matrix.target == 'native' && runner.os == 'Linux'
126162

127163
- name: Test source distribution
128164
uses: actions-ext/python/test-sdist@6e1b91a408ea89f49bc8aff8724f83826f7b5446
129165
with:
130166
module: python_template_rust
131-
if: matrix.os == 'ubuntu-latest'
167+
if: matrix.name == 'ubuntu-latest'
132168

133169
- name: Upload distributions
134170
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
135171
with:
136-
name: dist-${{ matrix.os }}
137-
path: dist
172+
name: dist-${{ matrix.name }}
173+
path: ${{ matrix.dist_path }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ python_template_rust/labextension
142142

143143
# Emscripten SDK (locally installed)
144144
emsdk
145+
.pyodide_build/
146+
145147

146148
# Mac
147149
.DS_Store

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@ tests-rs: test-rs
110110
coverage-rs: ## run rust tests and collect test coverage
111111
make -C rust coverage
112112

113-
.PHONY: test coverage tests
113+
.PHONY: test test-pyodide coverage tests
114114
test: test-py test-rs ## run all tests
115+
116+
test-pyodide: ## build and test the Python package in Pyodide
117+
rustup target add wasm32-unknown-emscripten
118+
uvx --from cibuildwheel==4.2.0 cibuildwheel --only cp314-pyodide_wasm32 --output-dir dist/pyodide .
119+
115120
coverage: coverage-py coverage-rs ## run all tests and collect test coverage
116121

117122
# alias

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
33
"hatchling",
4-
"hatch-rs>=0.1.4",
4+
"hatch-rs>=0.3.0",
55
]
66
build-backend = "hatchling.build"
77

@@ -39,7 +39,7 @@ develop = [
3939
"check-dist",
4040
"cibuildwheel",
4141
"codespell",
42-
"hatch-rs",
42+
"hatch-rs>=0.3.0",
4343
"hatchling",
4444
"mdformat",
4545
"mdformat-tables>=1",
@@ -111,6 +111,11 @@ archs = "arm64"
111111
environment = {PATH="$UserProfile\\.cargo\bin;$PATH", CARGO_TERM_COLOR="always"}
112112
skip = "*win32 *arm_64"
113113

114+
[tool.cibuildwheel.pyodide]
115+
test-command = "python -m pytest -vvv --pyargs python_template_rust.tests"
116+
test-extras = []
117+
test-requires = ["pytest"]
118+
xbuild-tools = ["cargo", "rustc", "rustup"]
114119
[tool.coverage.run]
115120
branch = true
116121
omit = [
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from python_template_rust import *
1+
from python_template_rust.python_template_rust import Example
22

33

44
def test_all():
5-
assert True
5+
assert str(Example("test")) == "test"

0 commit comments

Comments
 (0)