Skip to content

Commit 3d31c58

Browse files
Merge pull request #89 from pyscript/issue-84
Fix #84 - Provide enough details behind the PyScript project and stack
2 parents fc4b706 + ddef885 commit 3d31c58

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Diff for: docs/user-guide/architecture.md

+36
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,42 @@ PolyScript's capabilities, upon which PyScript is built, can be summarised as:
7474
(in addition to Pyodide and MicroPython, PolyScript works with Lua and Ruby -
7575
although these are beyond the scope of this project).
7676

77+
#### How to contribute
78+
79+
The *Polyscript* scope can then be summarized as such:
80+
81+
* provide as little as possible abstraction to bootstrap different interpreters (Pyodide, MicroPython, R, Lua, Ruby, others ...) without affecting *PyScript* goal
82+
* simplify the bootstrap of any interpreter through DOM primitives (script, custom-elements, or both ...)
83+
* understand and parse any explicit configuration option (being this a file to parse or an already parsed object literal)
84+
* forward any defined **hook** to the interpreter, either main or worker thread, so that code before, or right after, can be transparently executed
85+
* orchestrate a single bootstrap per each involved element, being this a script or a `<custom-script>` on the living page
86+
* ensure a *Worker*, optionally *Atomics* and *SharedArrayBuffer* based, stand-alone environment can be bootstrapped and available for at least not experimental runtime (Lua, Ruby, [others](https://pyscript.github.io/polyscript/#interpreter-features))
87+
88+
While this is a simplification of all the things polyscript does behind the scene, the rule of thumb to "*blame*" *polyscript* for anything affecting your project/idea is likely:
89+
90+
* is my interpreter not loading?
91+
* where are errors around my interpreter not loading?
92+
* is my *HTML* event not triggering? (`py-*` or `mpy-*` or ...)
93+
* how come this feature handled explicitly by *polyscript* is not reflected in my *PyScript* project? (this is likely and advanced issue/use case, but it's always OK to ask *why* in polyscript, and answers will flow accordingly)
94+
95+
To summarize, as much as *PyScript* users should never encounter one of these issues, it is possible some specific feature request or issue might be enabled in polyscript first to land then in PyScript.
96+
97+
#### Coincident
98+
99+
At the core of *polyscript* project there is one extra project enabling all the seamless worker to main, and vice-versa, features called [coincident](https://github.com/WebReflection/coincident#readme).
100+
101+
The purpose of this project is to enable, in a memory / garbage collector friendly way, a communication channel between one thread and another, handling the main thread dealing with workers references, or the other way around, as its best core feature.
102+
103+
Anything strictly related to *SharedArrayBuffer* issues is then an orchestration *coincident* is handling, and to some extend also anything memory leak related could as well fall down to this module purpose and scope.
104+
105+
In a nutshell, this project takes care of, and is responsible for, the following patterns:
106+
107+
* invoking something from a worker that refers the main thread somehow fails
108+
* there is a reproducible and cross platform (browsers) memory leak to tackle
109+
* some function invoke with some specific argument from a worker doesn't produce the expected result
110+
111+
All these scenarios are unlikely to happen with *PyScript* project, as these are all battle tested and covered with such general purpose cross-env/realm oriented project way before landing in *PyScript*, but if you feel something is really off, leaking, or badly broken, please feel free to file an issue in this project and, once again, there is never a silly question about it so that, as long as you can provide any minimal reproducible issue, all questions and issues are more than welcome!
112+
77113
### The stack
78114

79115
The stack describes how the different building blocks _inside_ a PyScript

0 commit comments

Comments
 (0)