|
1 |
| -# @pyscript/core |
| 1 | +# @pyscript/core - deprecated |
2 | 2 |
|
3 |
| -[](https://github.com/WebReflection/python/actions/workflows/node.js.yml) [](https://coveralls.io/github/WebReflection/python?branch=api) |
| 3 | +After various discussions around this topic, we decided to avoid any confusion around this folder which never really belonged in here, as _core_ as we meant it was meant to be a _PyScript Next_ dependency, not the _PyScript Next_ itself. |
4 | 4 |
|
5 |
| ---- |
6 |
| - |
7 |
| -## Documentation |
8 |
| - |
9 |
| -Please read [the documentation page](./docs/README.md) to know all the user-facing details around this module. |
10 |
| - |
11 |
| -## Development |
12 |
| - |
13 |
| -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). |
14 |
| - |
15 |
| -```sh |
16 |
| -# install all dependencies needed by core |
17 |
| -npm i |
18 |
| -``` |
19 |
| - |
20 |
| -### Build / Artifacts |
21 |
| - |
22 |
| -This project requires some automatic artifact creation to: |
23 |
| - |
24 |
| - * create a _Worker_ as a _Blob_ based on the same code used by this repo |
25 |
| - * create automatically the list of runtimes available via the module |
26 |
| - * create the `core.js` or the `pyscript.js` file used by most integration tests |
27 |
| - * create a sha256 version of the Blob content for CSP cases |
28 |
| - |
29 |
| -Accordingly, to build latest project: |
30 |
| - |
31 |
| -```sh |
32 |
| -# create all artifacts needed to test core |
33 |
| -npm run build |
34 |
| - |
35 |
| -# optionally spin a server with CORS, COOP, and COEP enabled |
36 |
| -npm run server |
37 |
| -``` |
38 |
| - |
39 |
| -If **no minification** is desired or helpful while debugging potential issues, please use `NO_MIN=1` in front of the _build_ step: |
40 |
| - |
41 |
| -```sh |
42 |
| -NO_MIN=1 npm run build |
43 |
| - |
44 |
| -npm run server |
45 |
| -``` |
46 |
| - |
47 |
| -### Dev Build |
48 |
| - |
49 |
| -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. |
50 |
| - |
51 |
| -## Integration Tests |
52 |
| - |
53 |
| -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: |
54 |
| - |
55 |
| -```sh |
56 |
| -npm run test:integration |
57 |
| -``` |
58 |
| - |
59 |
| -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. |
60 |
| - |
61 |
| -The tool to test integration is still _playwright_ but moves things a bit faster (from my side) tests are written in JS. |
62 |
| - |
63 |
| -#### Integration Tests Structure |
64 |
| - |
65 |
| -``` |
66 |
| -integration |
67 |
| - ├ interpreter |
68 |
| - │ ├ micropython |
69 |
| - │ ├ pyodide |
70 |
| - │ ├ ruby-wasm-wasi |
71 |
| - │ ├ wasmoon |
72 |
| - │ ├ xxx.yy |
73 |
| - │ ├ xxx.toml |
74 |
| - │ └ utils.js |
75 |
| - ├ _shared.js |
76 |
| - ├ micropython.js |
77 |
| - ├ pyodide.js |
78 |
| - ├ ruby-wasm-wasi.js |
79 |
| - └ wasmoon.js |
80 |
| -``` |
81 |
| - |
82 |
| -- **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. |
83 |
| -- **\_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. |
84 |
| -- **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. |
85 |
| - |
86 |
| -The [test/integration.spec.js](./test/integration.spec.js) file simply loops over folders that match interpreters _by name_ and execute in parallel all tests. |
87 |
| - |
88 |
| -#### Manual Test |
89 |
| - |
90 |
| -To **test manually** an integration test, simply `npm run server` and reach the _html_ file created for that particular test. |
91 |
| - |
92 |
| -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. |
| 5 | +We have hence moved and renamed _core_ as [polyscript](https://github.com/pyscript/polyscript/#readme) which is the base module to build up a better _PyScript Next_ without confusing our users or ourselves while talking about these two distinct projects. |
0 commit comments