How do folks go about making distribution as simple as possible for their Python applications?

Hi all,

I’ve been maintaining two projects that are distributed as CLI to their users: and For the latter, I also maintain a commercial product distributed as a Python application.

I’ve chosen Python for the perfect balance (for me anyway) between its versatility and capability. It has never failed me. The only place where I’ve always been surprised is the challenge of building a self-standalone binary. I mean, I fully understand the notion that Python isn’t designed for this. I even contemplated the idea to switch to Rust in the last couple of years though it would be a huge undertaking .

Over the years, I tried zipapp, pyinstaller, pyoxidizer and nuitka. All four are powerful in their own right:

  • zipapp: would work great for a simple Python script but beyond that, I am not sure. That said, I haven’t dug into that one as much
  • pyinstaller: works and that’s how I distribute also the Chaos Toolkit
  • pyoxidizer: my favourite in spirit but has never been stable enough for me to rely on it when building complex packages
  • nuitka: similar experience to pyoxidizer

Basically, every time I try any of these, thinking things may have improved, I fail to get anywhere after many days of struggle. Sometimes it’s a bug they still have, sometimes a quirk in one of my dependencies (typically __file__ and pyoxidizer is usually a fail), or at other times I rely on a package that uses namespaces and they just fail to properly deal with namespaced packages (for instance Open Telemetry) - they cause so much trouble these namespaces but that’s another debate.

At the end of the day, I cannot build enough confidence in them to work for all my users.

And it’s a shame for me because I have to resort to ask my users to create a virtual environment before they can do a pip install. I know these steps aren’t long but compared to basically downloading a binary, they are an order of magnitude less attractive.

As a side note, because of this, I had to provision a full blown private PyPI to protect my commercial package so users can download it. That means users also need now to remember to add an index to the pip install command. This isn’t friendly.

Am I the only one struggling with this? How do other people distribute? Should I go flatpak instead?

Is there any appetite for a PSF-backed project that make Python more easily distribuable as a binary package?


1 Like

What problems have you had with zipapp? Since this is part of the standard library, it seems like the best option to pursue.

That’s the one I tested the less extensively so I might need to circle back to it.

But IIRC, I think it was failing with namespaced projects as well. I will try again and report.

I have run into similar things. I’ve also resorted to a venv with pip install for distribution, with the same concerns.

This discussion does get rather technical and down in weeds, but it looks like there is an appetite for improving the Python distribution story.

1 Like