3 ms·
If a selling point is run from "one file", that's quite difficult to do in python. There are things like pyinstaller but you end up shipping the entire interpre
by rekwah 4y ago
If a selling point is run from "one file", that's quite difficult to do in python. There are things like pyinstaller but you end up shipping the entire interpreter in the bundle.
- mypalmike 4y agoThe pex tool lets you build single file python executables which are well suited for server deployments.
- ezekiel11 4y agooh 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!
- mypalmike 4y agoYeah 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.
- killingtime74 4y agoYou could also just use Docker to wrap anything
- mhio 4y agoHow big is a python3 runtime when pex has packaged it up? And do you happen to know what the output binary is linked to?
- mypalmike 4y agoAs 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.