Skip to content

Commit 30177ca

Browse files
authored
Merge pull request #128 from python-project-templates/copier-update-2026-08-23T05-40-34Z
Update from Copier (2026-08-23T05-40-34Z)
2 parents 1fd6bfe + d578cec commit 30177ca

7 files changed

Lines changed: 77 additions & 24 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: rustjswasm

.github/workflows/build.yaml

Lines changed: 51 additions & 15 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,7 +67,7 @@ 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
@@ -49,48 +76,57 @@ jobs:
4976
uses: actions-ext/node/setup@0ea5bdcd24d2488b28e16bf611b446a2f8e1e12f
5077
with:
5178
version: 22.x
79+
if: matrix.target == 'native'
5280

5381
- name: Install dependencies
5482
run: make develop
83+
if: matrix.target == 'native'
5584

5685
- name: Lint
5786
run: make lint
58-
if: matrix.os == 'ubuntu-latest'
87+
if: matrix.name == 'ubuntu-latest'
5988

6089
- name: Checks
6190
run: make checks
62-
if: matrix.os == 'ubuntu-latest'
91+
if: matrix.name == 'ubuntu-latest'
6392

6493
- name: Build
6594
run: make build
95+
if: matrix.target == 'native'
6696

6797
- name: Test
6898
run: make coverage
99+
if: matrix.target == 'native'
100+
101+
- name: Build and test Pyodide wheel
102+
run: make test-pyodide
103+
if: matrix.target == 'pyodide'
69104

70105
- name: Upload test results (Python)
71106
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
72107
with:
73-
name: test-results-${{ matrix.os }}
108+
name: test-results-${{ matrix.name }}
74109
path: '**/junit.xml'
75-
if: matrix.os == 'ubuntu-latest'
110+
if: matrix.name == 'ubuntu-latest'
76111

77112
- name: Publish test results
78113
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
79114
with:
80115
files: '**/junit.xml'
81-
if: matrix.os == 'ubuntu-latest'
116+
if: matrix.name == 'ubuntu-latest'
82117

83118
- name: Upload coverage
84119
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
85120
with:
86121
token: ${{ secrets.CODECOV_TOKEN }}
122+
if: matrix.target == 'native'
87123

88124
- name: Free disk space
89125
run: |
90126
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /usr/share/swift
91127
df -h /
92128
shell: bash
93-
if: runner.os == 'Linux'
129+
if: matrix.target == 'native' && runner.os == 'Linux'
94130

95131
- name: Build distributions (Linux x86_64)
96132
run: |
@@ -102,7 +138,7 @@ jobs:
102138
shell: bash
103139
env:
104140
CIBW_ARCHS_LINUX: native
105-
if: matrix.os == 'ubuntu-latest'
141+
if: matrix.name == 'ubuntu-latest'
106142

107143
- name: Build distributions (Linux ARM64)
108144
run: |
@@ -112,7 +148,7 @@ jobs:
112148
shell: bash
113149
env:
114150
CIBW_ARCHS_LINUX: native
115-
if: matrix.os == 'ubuntu-24.04-arm'
151+
if: matrix.name == 'ubuntu-24.04-arm'
116152

117153
- name: Build distributions (macOS/Windows)
118154
run: |
@@ -122,22 +158,22 @@ jobs:
122158
shell: bash
123159
env:
124160
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
125-
if: runner.os != 'Linux'
161+
if: matrix.target == 'native' && runner.os != 'Linux'
126162

127163
- name: Test wheel
128164
uses: actions-ext/python/test-wheel@6e1b91a408ea89f49bc8aff8724f83826f7b5446
129165
with:
130166
module: python_template_rust
131-
if: runner.os == 'Linux'
167+
if: matrix.target == 'native' && runner.os == 'Linux'
132168

133169
- name: Test source distribution
134170
uses: actions-ext/python/test-sdist@6e1b91a408ea89f49bc8aff8724f83826f7b5446
135171
with:
136172
module: python_template_rust
137-
if: matrix.os == 'ubuntu-latest'
173+
if: matrix.name == 'ubuntu-latest'
138174

139175
- name: Upload distributions
140176
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
141177
with:
142-
name: dist-${{ matrix.os }}
143-
path: dist
178+
name: dist-${{ matrix.name }}
179+
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
@@ -14,9 +14,7 @@ develop: develop-rs develop-js develop-py ## setup project for development
1414

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

2119
requirements-js: ## install prerequisite javascript build requirements
2220
cd js; pnpm install && npx playwright install
@@ -133,8 +131,14 @@ tests-rs: test-rs
133131
coverage-rs: ## run rust tests and collect test coverage
134132
make -C rust coverage
135133

136-
.PHONY: test coverage tests
134+
.PHONY: test test-pyodide coverage tests
137135
test: test-py test-js test-rs ## run all tests
136+
137+
test-pyodide: ## build and test the Python package in Pyodide
138+
rustup target add wasm32-unknown-emscripten
139+
rm -rf dist/pyodide
140+
uvx --from cibuildwheel==4.2.0 cibuildwheel --only cp314-pyodide_wasm32 --output-dir dist/pyodide .
141+
138142
coverage: coverage-py coverage-js coverage-rs ## run all tests and collect test coverage
139143

140144
# alias

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
requires = [
33
"hatchling",
44
"hatch-js",
5-
"hatch-rs",
5+
"hatch-rs>=0.3.0",
66
]
77
build-backend = "hatchling.build"
88

@@ -41,7 +41,7 @@ develop = [
4141
"cibuildwheel",
4242
"codespell",
4343
"hatch-js",
44-
"hatch-rs",
44+
"hatch-rs>=0.3.0",
4545
"hatchling",
4646
"mdformat",
4747
"mdformat-tables>=1",
@@ -123,6 +123,13 @@ archs = "arm64"
123123
environment = {PATH="$UserProfile\\.cargo\bin;$PATH", CARGO_TERM_COLOR="always"}
124124
skip = "*win32 *arm_64"
125125

126+
[tool.cibuildwheel.pyodide]
127+
environment = {SKIP_HATCH_JS="1"}
128+
test-command = "python -m pytest -vvv --pyargs python_template_rust.tests"
129+
test-extras = []
130+
test-requires = ["pytest"]
131+
xbuild-tools = ["cargo", "rustc", "rustup"]
132+
126133
[tool.coverage.run]
127134
branch = true
128135
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)