When I have small dependencies, I try to embed them. It works if, theses dependencies doesn’t change too often and are not required between multiple apps (or I move them to a framework).
If I don’t want to embed them for any reason (binaries, frequent updates, module shared with non SGTK code), I pip install on the fly in a user folder ($HOME or %APPDATA% on windows).
Shotgun doesn’t have any built-in mechanism for this. Some options you have are:
Install pip packages to a central repository
You can install them to a central repository and simply add this repository in the app_launch hook. There’s a hook that runs before that with you need packages in tk-desktop. I’m away from the my workstation right now, but it’s something to do with the pipeline_configuration.
Install on the spot
Similar to what you are doing. You can also do things like this.
Use a package manager.
This is the more robust solution, but it requires some work. Rez is a very good one. You can integrate rez in Shotgun in a variety of ways. From calling shotgun from rez to using rez to launch your apps from tk-desktop.
Using rez you can either make your own packages or use pipz to do it for you.
I suppose Rez is suitable.
However, we have a separate system for machine set up (using Salt), which installs any needed libraries. This is pretty easy, because you can apply a whole set of installations and setup at once.
Specifically for tk apps it would be nice to manage dependencies via tk though, I agree. Perhaps something similar to how frameworks are specified.
Thanks for answering! This is definitely an option I am considering, though I have read many posts online where they mention embedding packages is not the best practice per se, but if it works it works!