> transpiles them from Python to JavaScript
There are projects that do that, but it looks like PyScript instead runs Python code directly. It uses a Python interpreter compiled to WebAssembly - either CPython (from Pyodide) or MicroPython.
There are projects that do that, but it looks like PyScript instead runs Python code directly. It uses a Python interpreter compiled to WebAssembly - either CPython (from Pyodide) or MicroPython.
You can't have a listening socket anyway. And if the browser has to imitate the connection, there are numerous less oblique ways than running fastAPI.