Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Rye support installer packaging for end users (like PyInstaller)? #325

Open
rachtsingh opened this issue Jun 16, 2023 · 8 comments
Open

Comments

@rachtsingh
Copy link
Contributor

I don't have a direct use-case at the moment, and feel free to close if out of scope, but I think it would be pretty useful to have the equivalent of cargo build in Rye, that produces a binary that an end-user can use without installing Python separately. I think this was mentioned earlier in discussion but I didn't find an existing issue so I figured I'd make one.

I think PyInstaller does a lot of work (i.e. source analysis) that is maybe subsumed by modern pyproject.tomls (i.e. PEP 518), and since Rye already manages downloads of indygreg's Python binaries, it can probably figure out binary management here.

I think one design decision that would need to be made is whether to do full app packaging (e.g. .msi vs.exe, .app vs Mach-O executable, etc.).

Caveat: unfortunately I don't have a lot of time to attempt to implement it right now, but I might in a few months (sorry for a drive-by request).

@cnpryer
Copy link
Contributor

cnpryer commented Jun 17, 2023

Fwiw https://github.com/ofek/pyapp might be relevant

@mitsuhiko
Copy link
Collaborator

One of the reasons I really like hanging close to the indygreg Python builds is that they are also the base of PyOxidizer. Long term I would love to see that you can directly build binaries via PyOxidizer's infrastructure.

@sandangel
Copy link

Hi, is there any update to this issue? It would be a nice feature to have, especially when I need to build a desktop application

@mitsuhiko
Copy link
Collaborator

@sandangel the issue with supporting redistributable Python executables is not the lack of ambition, but that Python's ecosystem really does not support this well. You can look into the history of PyOxidizer and what it ran into. I do not expect there to be progress made for a year or two just because there is a lot that needs to be addressed first.

@sandangel
Copy link

I see hatch already has support for pyapp, which also work well. Can we consider adding it to rye?

@nickchomey
Copy link

This would be fantastic to see, especially since PyOxidizer was essentially deprecated a few weeks ago.

@nickchomey
Copy link

As an alternative to this, I'm now looking into embedding Python in a Go binary.

Putting aside the particulars of that process, is it possible to run a Python app created with Rye on a system where Rye is not installed?

Like, can you just copy the project directory that contains the Python standalone build and run the application without rye run appname? My thought is that this would be akin to using PyInstaller'a One Folder mode to create a self contained, executable folder for a Python application.

Or is it necessary to have Rye installed in order to make use of the Python standalone build etc...?

@trappitsch
Copy link

@sandangel PyApp and PyOxidizer/PyInstaller are quite different: PyApp takes a python version and bundles it along with your code. Upon first installation, the binary puts the python binary into its own environment, gets the required dependencies, and runs your code. When you run a CLI, these differences are not very visible to the user in the day-to-day usage, however, if your program is a GUI, you will for example see that the PyApp executable just starts python in the background and then runs the GUI (see ofek/pyapp#96 and explanation in ofek/pyapp#97). Thus, the running program and the binary are not associated with each other anymore, resulting in icon/executable mismatches. However, PyApp is really powerful, since it works really well for what it does and it is very simple to use!

For my own projects, I started writing a simple CLI (repo, docs) that allows you to package rye and other projects easily. Hope this is useful for other people as well. Many features I would like to have are still missing (see issues - any input would be much appreciated!), but the bare-bones should be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants