https://github.com/pyscript/polyplug
A framework for linking the DOM and DOM based events with scripting languages compiled to WASM. Part of the PyScript project.
https://github.com/pyscript/polyplug
Last synced: 7 months ago
JSON representation
A framework for linking the DOM and DOM based events with scripting languages compiled to WASM. Part of the PyScript project.
- Host: GitHub
- URL: https://github.com/pyscript/polyplug
- Owner: pyscript
- License: other
- Archived: true
- Created: 2022-11-30T10:49:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T08:57:12.000Z (about 1 year ago)
- Last Synced: 2025-03-16T10:42:19.641Z (9 months ago)
- Language: JavaScript
- Size: 226 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# PolyPlug 🦜🔌 (RETIRED)
## This was a successful experiment: it helped us to learn. Lessons have been integrated into PyScript. This archived repository is kept for posterity.
PolyPlug is a browser based framework for linking the DOM and DOM based events
with scripting languages compiled to WASM.
For more information [please read our documentation](https://polyplug.readthedocs.io/en/latest/) (the source for which is in the `./docs` directory).
It is:
* Agnostic of the interpreter receiving and responding to DOM events.
* Message based (JSON).
* Small (efficient to start).
* Simple (easier to maintain).
* Expressive (capable of many things).
This is the way:
* Obvious code.
* Simple is good.
* No dependencies.
* Vanilla JavaScript.
* Comments.
* Tests.
* Build for change.
This project was created for research purposes as part of the efforts to build
[PyScript](https://pyscript.net).
There are two sides to PolyPlug:
* The `polyplug.js` code to be run in the main thread of the browser.
* Code, to be run in the interpreter of the scripting language, to communicate
with PolyPlug. Currently only `polyplug.py` exists as a reference
implementation.
That is all.
## Developer setup
For Python development, create a new virtual environment and install the
required packages:
```
$ pip install -r requirements.txt
```
For JavaScript development, just edit the file and run the tests. _There are
deliberately no dependencies or complex tooling to ensure simplicity_. Should
you wish to minify the JavaScript source, you can (optionally) install
[uglifyjs](https://github.com/mishoo/UglifyJS).
Common tasks are scripted by a Makefile (tested on Linux and Mac):
```
$ make
There's no default Makefile target right now. Try:
make flake8 - run the flake8 Python checker.
make testjs - run the JavaScript test suite.
make testpy - run the Python test suite.
make minify - minify the project.
make tidy - tidy the Python code with black.
make docs - use Sphinx to create project documentation.
```
## Running the tests
For the sake of simplicity (and familiarity) we use the
[Jasmine test framework](https://jasmine.github.io/index.html) to exercise the
JavaScript aspects of our code.
For similar reasons, we use [PyTest](https://pytest.org/) to exercise the
Pythonic aspects of our code.