mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
Refactor pyexec (#1318)
This is some refactoring I did on the way towards resolving pyscript#1313. I added a new _run_pyscript Python function which executes the code inside a context manager that sets the display target. We can then return a JS object wrapper directly from Python. I moved the "installation" of the pyscript module to loadInterpreter, and pyimport pyscript_py there and give it a type. This avoids a bunch of creating and deleting of proxies for pyscript_py and allows us to give it a type once and for all. I also did some minor logic cleanup in a few places.
This commit is contained in:
9
pyscriptjs/src/python_package.ts
Normal file
9
pyscriptjs/src/python_package.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// This file exists because I can only convince jest to mock real file system
|
||||
// files, not fake modules. This confuses me because jest.mock has a virtual
|
||||
// option for mocking things that don't live in the file system but it doesn't
|
||||
// seem to work.
|
||||
|
||||
// @ts-ignore
|
||||
import python_package from 'pyscript_python_package.esbuild_injected.json';
|
||||
declare const python_package: { dirs: string[]; files: [string, string][] };
|
||||
export { python_package };
|
||||
Reference in New Issue
Block a user