File tree Expand file tree Collapse file tree
python_template_rust/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changes here will be overwritten by Copier
2- _commit : d814faa
2+ _commit : 053fbed
33_src_path : https://github.com/python-project-templates/base.git
44add_docs : true
55add_extension : rust
Original file line number Diff line number Diff line change @@ -135,3 +135,31 @@ jobs:
135135 with :
136136 name : dist-${{ matrix.os }}
137137 path : dist
138+
139+
140+ pyodide :
141+ runs-on : ubuntu-latest
142+
143+ steps :
144+ - name : Checkout
145+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
146+ with :
147+ persist-credentials : false
148+
149+ - name : Setup Python
150+ uses : actions-ext/python/setup@6e1b91a408ea89f49bc8aff8724f83826f7b5446
151+ with :
152+ version : " 3.14"
153+
154+ - name : Setup Rust
155+ uses : actions-ext/rust/setup@2db8e3e4c56beb7320c7d730bd2c2d6a6447bf6b
156+
157+ - name : Build and test Pyodide wheel
158+ run : make test-pyodide
159+
160+ - name : Upload Pyodide distribution
161+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
162+ with :
163+ name : dist-pyodide
164+ path : dist/pyodide
165+
Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ python_template_rust/labextension
142142
143143# Emscripten SDK (locally installed)
144144emsdk
145+ .pyodide_build /
146+
145147
146148# Mac
147149.DS_Store
Original file line number Diff line number Diff line change @@ -110,8 +110,13 @@ tests-rs: test-rs
110110coverage-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
114114test : 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+
115120coverage : coverage-py coverage-rs # # run all tests and collect test coverage
116121
117122# alias
Original file line number Diff line number Diff line change 11[build-system ]
22requires = [
33 " hatchling" ,
4- " hatch-rs>=0.1.4 " ,
4+ " hatch-rs>=0.3.0 " ,
55]
66build-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"
111111environment = {PATH =" $UserProfile\\ .cargo\b in;$PATH" , CARGO_TERM_COLOR =" always" }
112112skip = " *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 ]
115120branch = true
116121omit = [
Original file line number Diff line number Diff line change 1+
Original file line number Diff line number Diff line change 1- from python_template_rust import *
1+ from python_template_rust . python_template_rust import Example
22
33
44def test_all ():
5- assert True
5+ assert str ( Example ( "test" )) == "test"
You can’t perform that action at this time.
0 commit comments