File tree Expand file tree Collapse file tree 6 files changed +19
-78
lines changed Expand file tree Collapse file tree 6 files changed +19
-78
lines changed Original file line number Diff line number Diff line change @@ -30,4 +30,3 @@ package-lock.json
3030/pytest-speed /
3131/src /self_schema.py
3232/worktree /
33- /wasm-preview /tests.zip
Original file line number Diff line number Diff line change 22
33[ ![ CI] ( https://github.com/samuelcolvin/pydantic-core/workflows/ci/badge.svg?event=push )] ( https://github.com/samuelcolvin/pydantic-core/actions?query=event%3Apush+branch%3Amain+workflow%3Aci )
44[ ![ Coverage] ( https://codecov.io/gh/samuelcolvin/pydantic-core/branch/main/graph/badge.svg )] ( https://codecov.io/gh/samuelcolvin/pydantic-core )
5+ [ ![ pypi] ( https://img.shields.io/pypi/v/pydantic-core.svg )] ( https://pypi.python.org/pypi/pydantic-core )
6+ [ ![ versions] ( https://img.shields.io/pypi/pyversions/pydantic-core.svg )] ( https://github.com/samuelcolvin/pydantic-core )
7+ [ ![ license] ( https://img.shields.io/github/license/samuelcolvin/pydantic-core.svg )] ( https://github.com/samuelcolvin/pydantic-core/blob/main/LICENSE )
58
69This package provides the core functionality for pydantic.
710
Original file line number Diff line number Diff line change 3434</ style >
3535< main >
3636 < h1 >
37- < a href ="https://github.com/samuelcolvin/pydantic-core/tree/main/wasm-preview "> pydantic-core</ a > unit tests
37+ < a href ="https://github.com/samuelcolvin/pydantic-core/tree/main/wasm-preview "> pydantic-core</ a > v < span id =" version " > 0.1.0 </ span > unit tests
3838 </ h1 >
3939 < aside >
4040 pydantic-core is compiled to webassembly and run in the browser using
5252 const Convert = require ( 'ansi-to-html' )
5353 const ansi_converter = new Convert ( )
5454 let terminal_output = ''
55+ const version = document . getElementById ( 'version' ) . textContent
5556
5657 output_el . innerText = 'Starting worker...'
5758 const worker = new Worker ( `./worker.js?v=${ Date . now ( ) } ` )
6970 // scrolls to the bottom of the div
7071 output_el . scrollIntoView ( false )
7172 }
72- worker . postMessage ( { } )
73+ worker . postMessage ( { version } )
7374</ script >
Original file line number Diff line number Diff line change 1313# this seems to be required for me on M1 Mac
1414sys .setrecursionlimit (200 )
1515
16- # compiled manually an uploaded to smokeshow, there seems to be no nice way of getting a file from a CI build
17- pydantic_core_wheel = (
18- 'https://smokeshow.helpmanual.io'
19- '/4o4l4x0t2m6z1w4n6u4b/pydantic_core-0.0.1-cp310-cp310-emscripten_3_1_14_wasm32.whl'
20- )
2116
22-
23- async def main (tests_zip : str ):
17+ async def main (tests_zip : str , version : str ):
2418 print (f'Extracting test files (size: { len (tests_zip ):,} )...' )
19+ # File saved on the GH release
20+ pydantic_core_wheel = (
21+ 'https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/releases/'
22+ f'download/v{ version } /pydantic_core-{ version } -cp310-cp310-emscripten_3_1_14_wasm32.whl'
23+ )
2524 zip_file = ZipFile (BytesIO (base64 .b64decode (tests_zip )))
2625 count = 0
2726 for name in zip_file .namelist ():
@@ -45,7 +44,7 @@ async def main(tests_zip: str):
4544 pytest .main ()
4645
4746try :
48- await main (tests_zip )
47+ await main (tests_zip , version )
4948except Exception as e :
5049 traceback .print_exc ()
5150 raise
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -72,13 +72,15 @@ async function get(url, mode) {
7272 }
7373}
7474
75- self . onmessage = async ( ) => {
76- self . postMessage ( 'Downloading repo archive to get tests...\n' )
75+ self . onmessage = async ( { data} ) => {
76+ const { version} = data
77+ self . postMessage ( `Downloading repo v${ version } archive to get tests...\n` )
78+ const zip_url = `https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/archive/refs/tags/v${ version } .zip`
7779 try {
7880 const [ python_code , tests_zip , ] = await Promise . all ( [
7981 get ( `./run_tests.py?v=${ Date . now ( ) } ` , 'text' ) ,
8082 // e4cf2e2 commit matches the pydantic-core wheel being used, so tests should pass
81- get ( 'https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/archive/e4cf2e2.zip' , 'blob' ) ,
83+ get ( zip_url , 'blob' ) ,
8284 importScripts ( 'https://cdn.jsdelivr.net/pyodide/v0.21.0a3/full/pyodide.js' )
8385 ] )
8486
@@ -88,7 +90,7 @@ self.onmessage = async () => {
8890 FS . mkdir ( '/test_dir' )
8991 FS . chdir ( '/test_dir' )
9092 await pyodide . loadPackage ( [ 'micropip' , 'pytest' , 'pytz' ] )
91- await pyodide . runPythonAsync ( python_code , { globals : pyodide . toPy ( { tests_zip} ) } )
93+ await pyodide . runPythonAsync ( python_code , { globals : pyodide . toPy ( { version , tests_zip} ) } )
9294 post ( )
9395 } catch ( err ) {
9496 console . error ( err )
You can’t perform that action at this time.
0 commit comments