You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-guide/architecture.md
+36
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,42 @@ PolyScript's capabilities, upon which PyScript is built, can be summarised as:
74
74
(in addition to Pyodide and MicroPython, PolyScript works with Lua and Ruby -
75
75
although these are beyond the scope of this project).
76
76
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
+
77
113
### The stack
78
114
79
115
The stack describes how the different building blocks _inside_ a PyScript
0 commit comments