0.16.5 • Published 7 days ago

polyscript v0.16.5

Weekly downloads
2
License
APACHE-2.0
Repository
-
Last release
7 days ago

Polyscript

build

PyScript single core to rule them all


Documentation

Please read the documentation page to know all the user-facing details around this module.

Development

The working folder (source code of truth) is the ./esm one, while the ./cjs is populated as a dual module and to test (but it's 1:1 code, no transpilation except for imports/exports).

# install all dependencies needed by core
npm i

Build / Artifacts

This project requires some automatic artifact creation to:

  • create a Worker as a Blob based on the same code used by this repo
  • create automatically the list of runtimes available via the module
  • create the core.js or the pyscript.js file used by most integration tests
  • create a sha256 version of the Blob content for CSP cases

Accordingly, to build latest project:

# activate once the Python env (to use pyminify)
. env.sh # or source env.sh

# create all artifacts needed to test core
npm run build

# optionally spin a server with CORS, COOP, and COEP enabled
npm run server

If no minification is desired or helpful while debugging potential issues, please use NO_MIN=1 in front of the build step:

NO_MIN=1 npm run build

npm run server

Dev Build

Besides spinning the localhost server via npm run server, the npm run dev will watch changes in the ./esm folder and it will build automatically non optimized artifacts out of the box.

Integration Tests

To keep it simple, and due to technical differences between what was in PyScript before and what we actually need for core (special headers, multiple interpreters, different bootstrap logic), core integration tests can be performed simply by running:

npm run test:integration

The package's entry takes care of eventually bootstrapping localhost, starting in parallel all tests, and shutting down the server after, if any was bootstrapped.

The tool to test integration is still playwright but moves things a bit faster (from my side) tests are written in JS.

Integration Tests Structure

integration
          ├ interpreter
          │           ├ micropython
          │           ├ pyodide
          │           ├ ruby-wasm-wasi
          │           ├ wasmoon
          │           ├ xxx.yy
          │           ├ xxx.toml
          │           └ utils.js
          ├ _shared.js
          ├ micropython.js
          ├ pyodide.js
          ├ ruby-wasm-wasi.js
          └ wasmoon.js
  • interpreter this folder contains, per each interpreter, a dedicated folder with the interpreter's name. Each of these sub-folders will contain all .html and other files to test every specific behavior. In this folder, it's possible to share files, config, or anything else that makes sense for one or more interpreters.
  • _shared.js contains some utility used across all tests. Any file prefixed with _ (underscore) will be ignored for tests purposes but it can be used by the code itself.
  • micropython.js and all others contain the actual test per each interpreter. If a test is the same across multiple interpreters it can be exported via the _shared.js file as it is for most Pyodide and MicroPython cases.

The test/integration.spec.js file simply loops over folders that match interpreters by name and execute in parallel all tests.

Manual Integration Test

To test manually an integration test, simply npm run server and visit http://localhost:8080/ or http://localhost:8080/test/integration.html to find a list of all integration tests available in the related folder.

As example, reaching http://localhost:8080/test/integration/interpreter/micropython/fetch.html would log in the console and show expectations on the page and this can be easily tested via multiple browsers by simply reaching the very same integration test.

0.16.4

8 days ago

0.16.5

7 days ago

0.15.10

1 month ago

0.15.11

1 month ago

0.15.12

1 month ago

0.15.4

2 months ago

0.15.5

2 months ago

0.15.6

2 months ago

0.15.7

1 month ago

0.15.8

1 month ago

0.15.9

1 month ago

0.15.1

2 months ago

0.15.2

2 months ago

0.15.3

2 months ago

0.16.3

20 days ago

0.16.0

1 month ago

0.16.1

1 month ago

0.16.2

1 month ago

0.13.6

5 months ago

0.13.7

5 months ago

0.13.8

4 months ago

0.13.9

4 months ago

0.13.0

5 months ago

0.13.1

5 months ago

0.13.2

5 months ago

0.13.3

5 months ago

0.13.4

5 months ago

0.13.5

5 months ago

0.12.11

5 months ago

0.14.5

3 months ago

0.14.0

3 months ago

0.14.1

3 months ago

0.12.12

5 months ago

0.14.2

3 months ago

0.12.13

5 months ago

0.14.3

3 months ago

0.12.14

5 months ago

0.14.4

3 months ago

0.12.15

5 months ago

0.15.0

3 months ago

0.14.0-rc2

3 months ago

0.14.0-rc1

3 months ago

0.13.10

4 months ago

0.14.0-rc3

3 months ago

0.14.6-rc1

3 months ago

0.12.10

6 months ago

0.12.9

6 months ago

0.12.8

6 months ago

0.12.7

6 months ago

0.12.6

7 months ago

0.12.5

7 months ago

0.12.4

7 months ago

0.12.3

7 months ago

0.12.2

7 months ago

0.12.1

7 months ago

0.11.4

7 months ago

0.11.2

8 months ago

0.11.3

8 months ago

0.11.1

8 months ago

0.11.0

8 months ago

0.10.0

9 months ago

0.9.0

9 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.7.2

9 months ago

0.7.1

9 months ago

0.7.0

9 months ago

0.6.18

9 months ago

0.6.17

9 months ago

0.6.16

9 months ago

0.6.15

10 months ago

0.6.14

10 months ago

0.6.12

10 months ago

0.6.13

10 months ago

0.6.11

10 months ago

0.6.9

10 months ago

0.6.10

10 months ago

0.6.8

11 months ago

0.6.7

11 months ago

0.6.6

11 months ago

0.6.3

11 months ago

0.6.5

11 months ago

0.6.4

11 months ago

0.5.10

1 year ago

0.5.11

1 year ago

0.5.12

12 months ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.20

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.9

1 year ago

0.4.19

1 year ago

0.4.17

1 year ago

0.4.18

1 year ago

0.4.15

1 year ago

0.4.16

1 year ago

0.4.13

1 year ago

0.4.14

1 year ago

0.4.11

1 year ago

0.4.12

1 year ago

0.6.2

11 months ago

0.6.1

12 months ago

0.6.0

12 months ago

0.4.9

1 year ago

0.4.8

1 year ago

0.3.9

1 year ago

0.3.10

1 year ago

0.4.10

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.4.5

1 year ago

0.3.6

1 year ago

0.4.4

1 year ago

0.3.5

1 year ago

0.4.7

1 year ago

0.3.8

1 year ago

0.4.6

1 year ago

0.3.7

1 year ago

0.4.1

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.2.2

1 year ago

0.4.3

1 year ago

0.3.4

1 year ago

0.2.5

1 year ago

0.4.2

1 year ago

0.3.3

1 year ago

0.2.4

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.0.0

11 years ago