I keep meaning to explore compiling Python +libs to WASM for running in a desktop environment. It is already Python, so I am willing to accommodate enormous performance losses. I just want to package up the code into something more straightforward than PyInstaller.
Self-contained highly-portable Python distributions
21–30 of 45 posts
Re: Self-contained highly-portable Python distributions
#22I keep meaning to explore compiling Python +libs to WASM for running in a desktop environment. It is already Python, so I am willing to accommodate enormous performance losses. I just want to package up the code into something more straightforward than PyInstaller.
JavaScript has module bundlers that will merge all your code modules into one module for deployment. It's a little surprising nobody (that I'm aware of) has done this for Python and PEP 723 dependency specifications. Then the single binary for uv is all that's required to run the bundle using this type of approach, at least on unix-ish machines (not sure if there's a trick to make this work on Windows): https://docs.…
Unfortunately, it’s still not my ideal use case of distributing executables to Windows machines. I really want a single artifact users could freely share without any pre-configuration. I guess I could have a batch/vbs script which would bootstrap uv plus the rest of the machinery, but that is more moving parts than I would like.
Re: Self-contained highly-portable Python distributions
#23Re: Self-contained highly-portable Python distributions
#24These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
> The net effect is that on Linux and macOS, you can't "download a Python binary" from... anywhere. Other than the python-build-standalone project.
Are you sure this is right about macOS? I just had a look inside the macOS installer from python.org and there are definitely some binaries in there.
Re: Self-contained highly-portable Python distributions
#25Earlier quoted context omitted.
JavaScript has module bundlers that will merge all your code modules into one module for deployment. It's a little surprising nobody (that I'm aware of) has done this for Python and PEP 723 dependency specifications. Then the single binary for uv is all that's required to run the bundle using this type of approach, at least on unix-ish machines (not sure if there's a trick to make this work on Windows): https://docs.…
That’s not a bad idea. uvx feels like a temporary hack on which I can’t rely for a permanent deployment, but it is all probably fine. I would want to at least materialize a real environment so I know that it is not getting randomly deleted as cache/temp gets cleared. Unfortunately, it’s still not my ideal use case of distributing executables to Windows machines. I really want a single artifact users could freely shar…
Re: Self-contained highly-portable Python distributions
#26These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
I install these Python builds into distroless containers with uv python install and it just works. (If you try this with Google’s images, use gcr.io/distroless/cc, libgcc/libstdc++ is needed for some extensions, like numpy)
Re: Self-contained highly-portable Python distributions
#27These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
> When you download Python from http://python.org (on Linux or macOS), what you're actually downloading is an installer that builds Python from source on your machine. > The net effect is that on Linux and macOS, you can't "download a Python binary" from... anywhere. Other than the python-build-standalone project. Are you sure this is right about macOS? I just had a look inside the macOS installer from python.org and…
(That said, I've rarely used it, preferring either the macOS/Xcode-provided Python or these self-contained Pythons which I use via uv.)
Re: Self-contained highly-portable Python distributions
#28These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
i'm also doing the same for ruby—maintaining the binaries myself which is becoming the default in mise next week: https://github.com/jdx/ruby
i'm a firm believer that pre-compiled, portable binaries are the best way to distribute runtimes and clis.
Re: Self-contained highly-portable Python distributions
#29These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
> When you download Python from http://python.org (on Linux or macOS), what you're actually downloading is an installer that builds Python from source on your machine. > The net effect is that on Linux and macOS, you can't "download a Python binary" from... anywhere. Other than the python-build-standalone project. Are you sure this is right about macOS? I just had a look inside the macOS installer from python.org and…
EDIT: actually no, I think charlie is wrong on that point, he said the installers compile python but that only happens with python-build-based installers like pyenv. still, the fact those binaries lack portability is the real problem.
Re: Self-contained highly-portable Python distributions
#30These are the Python distributions we use in uv ( https://github.com/astral-sh/uv ), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.) Most of our engineering time on the project over the past ~year and a half has been split into three buckets: 1. Keeping up with upstream…
> When you download Python from http://python.org (on Linux or macOS), what you're actually downloading is an installer that builds Python from source on your machine. > The net effect is that on Linux and macOS, you can't "download a Python binary" from... anywhere. Other than the python-build-standalone project. Are you sure this is right about macOS? I just had a look inside the macOS installer from python.org and…