Hacker News new | past | comments | ask | show | jobs | submit login

>What's the point of this? Why would I want a single-file version of Python?

If I want to deploy a Python program on a Windows machine, my current workflow is roughly:

  - Install Python system wide
  - Ensure there is Python venv + pip + (QoL) virtualenvwrapper
  - Create virtual environment per program
  - Load up my code
Not horrible, but if I could package Python + extra code into a zip file, I could just create foobar-v20220512.zip send that to anybody, and have them unzip the entire program into the same directory every time. Then they could do it without admin privileges and with the most minimal of user training. Easy versioning to boot.

PyInstaller, Nukita, etc probably already make this possible, but I have never taken the plunge to explore them. I have assumed there are some rough edge gotchas (C libraries) that would make me regret the decision.




PyOxy could be a great complement to `shiv` (generates zipapps like you described). Shiv had system-installed python as a requirement, so this makes it fully portable.

https://shiv.readthedocs.io/en/latest/

EDIT: oh I just read through the PyOxidizer docs, seems like they already do have this capability as a goal, PyOxy is actually extracting out the shippable one-exec python out.


Okay, so more for end-user facing applications? That makes a lot more sense. I still have server installed applications in my head, where getting the “right” Python installed can be solved by multiple mechanisms. For end-user applications, having a Python binary that travels with the program code makes a ton of sense. Thanks!


You should also check out cx_Freeze, I have had better luck with it than PyInstaller with my project(s).


FWIW, if your PyInstaller experience is from several years ago, I'd strongly recommend checking it out again. I used to dread its updates because they usually broke something, but everything has been super smooth in the last 1-2 years. :)


Recent, actually. I got PyInstaller working but I tried cx_Freeze because it had an easier route to generating a quick .msi. I found cx_Freeze easier to use and ended up porting over to it, but to each their own.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: