AcademySoftwareFoundation / rez

An integrated package configuration, build and deployment system for software
https://rez.readthedocs.io
Apache License 2.0
936 stars 332 forks source link

Use pyinstaller to build a portable rez edition #1812

Open FhyTan opened 1 month ago

FhyTan commented 1 month ago

Motivation First of all, I would like to thank Rez for providing a great DCC environment setup solution. However, the installation process for Rez can be somewhat complicated for CG artists, especially for companies that prohibit employee computers from connecting to the internet.

I reviewed the differences between the script installation version and the pip installation version described in the official documentation. The main difference is that the script installation can provide an independent Python environment to run Rez. Pyinstaller can directly package the entire Python environment, allowing the packaged files to be placed and run anywhere. This portable installation method is very user-friendly.

I saw an issue where someone asked about a portable version of Rez, but it seems there was no follow-up. I'm not sure if it's actually possible to use Pyinstaller to build Rez, and I also wonder if the official team has any intention of doing this.

Related Issues/PRs

loonghao commented 1 month ago

@FhyTan I've established a repository for creating portable rez, and you can download the binary executable from the releases section.

https://github.com/loonghao/portable_rez/releases/tag/v0.4.5

JeanChristopheMorinPerso commented 1 month ago

Note that we don't support non official distributions. Also, one issue with pyinstaller like executable is that they are bloated and slow to start. I also fail to see how it makes it easier for companies that block internet access since you still need internet to get the executable in the first place.

If you want an easy to deploy python that will work for rez, I suggest to look at https://github.com/indygreg/python-build-standalone.

Basically, we (the rez maintainers) don't think that pyinstaller is a good fit for rez. We are instead evaluating other solutions that would help bootstrapping rez in studios. For example, we started to write down our thoughts here: https://hackmd.io/@jcmorin/H1MnfXvWR.

davidlatwe commented 1 month ago

Hey @JeanChristopheMorinPerso, I am not in rez loop for quite a while but somehow the universe leads me to your hackmd writeup. Which looks great!

I just wanted to let you know that, I have already took the name rezup for my CLI tool that I developed a couple years ago, and it's on public PyPI.

rezup is really a good name for a tool in such purpose, and I believe this name can bring more good to the world if it's in you guys' hands. So please feel free to let me know if you guys want to take over that name. I am happy to help. 💪🏼

FhyTan commented 1 month ago

Note that we don't support non official distributions. Also, one issue with pyinstaller like executable is that they are bloated and slow to start. I also fail to see how it makes it easier for companies that block internet access since you still need internet to get the executable in the first place.

If you want an easy to deploy python that will work for rez, I suggest to look at https://github.com/indygreg/python-build-standalone.

Basically, we (the rez maintainers) don't think that pyinstaller is a good fit for rez. We are instead evaluating other solutions that would help bootstrapping rez in studios. For example, we started to write down our thoughts here: https://hackmd.io/@jcmorin/H1MnfXvWR.

Thank you for your reply!

Regarding how to obtain executable files in a company without internet access, it’s relatively simple. Just package the files into a zip file and copy it to the artist’s computer.

Regarding the issue of program bloat, modern computers generally have ample storage space, so it's not a big concern. As for the slow startup speed, the dependencies we use in most cases are relatively simple, so a slight delay in startup is acceptable.

I have tried using PyInstaller to package the application, and there is minimal difference in usage, although further testing is still needed.

FhyTan commented 1 month ago

@loonghao Thanks, It does work!

wandth commented 2 weeks ago

@FhyTan You can use rez as a python package, develop it using rez's api, and then build it normally using pyinstaller, just use it in the code startup line os.environ["REZ_CONFIG_FILE"] = "your_rez_config_file_path_in_your_code"