renpy icon indicating copy to clipboard operation
renpy copied to clipboard

Installing python packages from the launcher

Open javascript-error opened this issue 4 years ago • 1 comments

Currently, a tutorial exists at: https://www.renpy.org/doc/html/python.html#first-and-third-party-python-modules-and-packages

It has instructions for installing python packages into a renpy project, but can be a non-starter for anyone unfamiliar with the terminal or python in general.

As a UI based alternative, the launcher could add an interface for installing packages. I've created a working example at: https://github.com/jsfehler/renpy_launcher_package_installer

The interface isn't intended to be a full wrapper over pip, just a way to easily and consistently place packages into a game.

Other considerations:

  • The example writes out a requirements.txt file to the root of the current project. This isn't intended to be a full dependency graph or to ensure 100% reproducible builds. It's just a way to track which packages the user has installed. A further iteration of the interface could allow the reverse, installing from an existing requirements.txt. Anything more ambitious would be better off wrapping poetry or pip-tools instead.

  • Ren'Py's custom python 2.7 doesn't include pip and can't (without adding in more of the standard lib). This is why the python executable location must be specified.

javascript-error avatar Dec 30 '21 18:12 javascript-error

In general, I think it's fine that it's a non-starter for people who aren't familiar with the terminal or python in general. I wouldn't expect random third party packages to work with Ren'Py, and so if you don't have a minimal level of python experience necessary to run pip, then you're unlikely to be able to get the packages it installs to work.

renpytom avatar Dec 30 '21 19:12 renpytom