transpiling from Python to JS
that may lead to problems with refcounting when using python libraries that were designed with c-api. It happened here for example https://github.com/brython-dev/brython/issues/275 so asm.js (python2) and later wasm(py3) were choosen instead of transpilation.
if you are thinking of a bytecode only solution like eg only keep cpython VM, then it would not be Python but a subset of it because you would loose
eval : that’s good for size but …
But bytecode opcode map ( ceval.c ) is subject to change anytime each version so it’s a risky way with possibly multiple runtime maintenance ( for ever ?). I would choose to embed code in page or get it from a server like js but please without minifying
Right it is slow for remote dom, also probably very slow for webgl/canvas in a notebook as questionned there https://github.com/panda3d/panda3d/issues/887
but maybe not if running Python client side, problem is running a worker or async and communicating with js host is not standardized yet.
One could hope for a decent -fast- serialization module both side first ( may CBOR - RFC 7049 ? ), and perhaps direct access to utf-8 strings in wasm heap.
I see you have found the privmsg, so please try and elaborate on what you need or would like to achieve first with a Python in the browser : it’s uncharted territory and each player on the field may have different objectives.