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
30
30
/pytest-speed /
31
31
/src /self_schema.py
32
32
/worktree /
33
- /wasm-preview /tests.zip
Original file line number Diff line number Diff line change 2
2
3
3
[ ![ 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 )
4
4
[ ![ 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 )
5
8
6
9
This package provides the core functionality for pydantic.
7
10
Original file line number Diff line number Diff line change 34
34
</ style >
35
35
< main >
36
36
< 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
38
38
</ h1 >
39
39
< aside >
40
40
pydantic-core is compiled to webassembly and run in the browser using
52
52
const Convert = require ( 'ansi-to-html' )
53
53
const ansi_converter = new Convert ( )
54
54
let terminal_output = ''
55
+ const version = document . getElementById ( 'version' ) . textContent
55
56
56
57
output_el . innerText = 'Starting worker...'
57
58
const worker = new Worker ( `./worker.js?v=${ Date . now ( ) } ` )
69
70
// scrolls to the bottom of the div
70
71
output_el . scrollIntoView ( false )
71
72
}
72
- worker . postMessage ( { } )
73
+ worker . postMessage ( { version } )
73
74
</ script >
Original file line number Diff line number Diff line change 13
13
# this seems to be required for me on M1 Mac
14
14
sys .setrecursionlimit (200 )
15
15
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
- )
21
16
22
-
23
- async def main (tests_zip : str ):
17
+ async def main (tests_zip : str , version : str ):
24
18
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
+ )
25
24
zip_file = ZipFile (BytesIO (base64 .b64decode (tests_zip )))
26
25
count = 0
27
26
for name in zip_file .namelist ():
@@ -45,7 +44,7 @@ async def main(tests_zip: str):
45
44
pytest .main ()
46
45
47
46
try :
48
- await main (tests_zip )
47
+ await main (tests_zip , version )
49
48
except Exception as e :
50
49
traceback .print_exc ()
51
50
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) {
72
72
}
73
73
}
74
74
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`
77
79
try {
78
80
const [ python_code , tests_zip , ] = await Promise . all ( [
79
81
get ( `./run_tests.py?v=${ Date . now ( ) } ` , 'text' ) ,
80
82
// 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' ) ,
82
84
importScripts ( 'https://cdn.jsdelivr.net/pyodide/v0.21.0a3/full/pyodide.js' )
83
85
] )
84
86
@@ -88,7 +90,7 @@ self.onmessage = async () => {
88
90
FS . mkdir ( '/test_dir' )
89
91
FS . chdir ( '/test_dir' )
90
92
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} ) } )
92
94
post ( )
93
95
} catch ( err ) {
94
96
console . error ( err )
You can’t perform that action at this time.
0 commit comments