As I recall, pex doesn't package up the runtime. It essentially packages up your venv, code, and resources and runs them under an installed runtime. It makes use of a relatively unknown bit of python functionality, which is that CPython will try to treat a zip file as a valid python script.
oh wow thanks i didn't know about this. in that case it would be super simple for me to wrap up a FastAPI server with SQLite or even some in-memory database that runs elsewhere, deliver as a single file!
Yeah this kind of thing was common when I worked at Twitter (where AFAIK pex/pants was developed) on an infrastructure team. It's a cool tool that few outside of Twitter seem to be aware of.