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.pyis a wrapper for htm.py that transparently switches to developit/htm when it's compiled with Transcrypt. -
compile.pyprecompiles 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.pycontains some example code that usesmyhtm. It's our app's entrypoint. -
npm run buildrunscompile.pyagainstmain.pyand then transpiles the result to JavaScript with Transcrypt. -
npm startruns 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