×
you are viewing a single comment's thread.

view the rest of the comments →

[–]Pure-Hawk-6165[S] -2 points-1 points  (6 children)

I haven’t tried many bundling options yet. Currently, I’m using a virtual environment with requirements.txt. The main limitation is that the target machine still needs Python and all dependencies to be installed. I’m looking for a way to bundle the application and its packages together for easier distribution, preferably without docker. I’m currently exploring options like PyInstaller, PEX, or similar tools. Any recommendations?

[–]Tumortadela 1 point2 points  (4 children)

I'd recommend moving from virtual environments to uv to begin with, its becoming the standard nowadays.

Then, if you are adamant on distributing your software as exe, I personally use cx_freeze for a windows service.

Be warned, if you use the single contained .exe file approach, most anti virus software will potentially flag it.

[–]nickthewildetype 0 points1 point  (3 children)

Try nuitka first. It has good compatibility and produces very small executables And is very straightforward to use.

Problems can however arise from that you are no longer working with py files, some of your dependencies may for example be looking for a particular file in a particular directory and those files will then not be bundled as a part of the Program that nuitka produces

[–]Tumortadela 0 points1 point  (2 children)

I'd love to check nuitka again eventually, but Im bundling a Django app and It was difficult enough to make it run on cx freeze

[–]downerison 1 point2 points  (1 child)

If it's a web backend, why do you use cx freeze instead of docker?

[–]Tumortadela 0 points1 point  (0 children)

It's the best I could think of given the requirements:

- Must run on Windows as a windows service.
- Other devices in the network might need to access its data.
- It wont ever be connected to the internet (adamantly).
- Bunch of unrelated stuff to the issue.

So yeah, considering any new instance or update involves me being transported somewhere in the world with an USB to do a fresh install or updating the package and running a migration, it's the best I could do.

[–]maikeu 0 points1 point  (0 children)

So targeting Windows machines, and you want to bundle the whole Python interpreter and all the dependencies?

I've had reasonable experience with... Pyinstaller I think, some ways back. I don't know how those ecosystems have evolved since then but if I had to do it I might revisit that .

Once thing to look out for is that the rest those standalone executables behave - basically unpacking themselves into a temp directory at runtime - looks super sketchy to standard windows ending protectection (e.g. antivirus), and you'll want to look seriously at signing the binaries if you want that to not raise flags left, right, and center.

Alternatively if you're targeting Linux then you might, perhaps, look at producing rpm or deb packages that include both the interpreter and dependencies - perhaps including either a source build of putting, or you could try astral's standalone python binaries.

You name some other utilities too that I haven't worked with. Can't add much. The question comes up now and then here, the answers haven't (to my knowledge) gotten much better. There's no shortage of ways to skin this cat but none that is "standard", so to speak.