This is a Rube Goldberg machine that aims to demonstrate how htm.py could be used with the Python-to-JS compiler Transcrypt. This idea could, maybe, be combined with this gist.
It contains the following moving parts:
-
myhtm.py
is a wrapper for htm.py that transparently switches to developit/htm when it's compiled with Transcrypt. -
compile.py
precompiles Python 3 code from STDIN to one that doesn't depend on tagged's stack inspection shenanigans (which htm.py depends on). This should make the code more compatible with Transcrypt. -
main.py
contains some example code that usesmyhtm
. It's our app's entrypoint. -
npm run build
runscompile.py
againstmain.py
and then transpiles the result to JavaScript with Transcrypt. -
npm start
runs the transpiled code.
Requirements:
-
Python 3.6 or so, assumed to be executable with the command
python3
. -
A recent version of Transcrypt
-
A recent version of Node.js
Start by installing the JavaScript dependencies:
$ npm install
Then transpile main.py
to JavaScript:
$ npm run build
Then run the transpiled JavaScript program:
$ npm start