Skip to content

Commit b6c0d07

Browse files
authored
Merge pull request #122 from python-project-templates/copier-update-2026-08-23T05-39-43Z
Update from Copier (2026-08-23T05-39-43Z)
2 parents 77e7229 + 9a004d9 commit b6c0d07

7 files changed

Lines changed: 75 additions & 23 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: 2f83523
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ __pycache__/
1313
*.exp
1414
*.lib
1515

16+
# vcpkg
17+
vcpkg/
18+
vcpkg_installed/
19+
1620
# Rust
1721
target
1822
target-capi
@@ -142,6 +146,7 @@ python_template_rust/labextension
142146

143147
# Emscripten SDK (locally installed)
144148
emsdk
149+
.pyodide_build/
145150

146151
# Mac
147152
.DS_Store

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ develop: develop-rs develop-py ## setup project for development
1212

1313
.PHONY: requirements-py requirements-rs requirements
1414
requirements-py: ## install prerequisite python build requirements
15-
python -m pip install --upgrade pip toml
16-
python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'`
17-
python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print(" ".join(c["project"]["optional-dependencies"]["develop"]))'`
15+
uv pip install -r pyproject.toml --extra develop
1816

1917
requirements-rs: ## install prerequisite rust build requirements
2018
make -C rust requirements
@@ -110,8 +108,14 @@ tests-rs: test-rs
110108
coverage-rs: ## run rust tests and collect test coverage
111109
make -C rust coverage
112110

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

117121
# alias

pyproject.toml

Lines changed: 8 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,12 @@ 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"]
119+
114120
[tool.coverage.run]
115121
branch = true
116122
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)