Distributing custom code and tools?


Have a question about some architecture here and how we are going about things. Currently we have a distributed configuration set up and were wondering about how to distribute other code libraries or plug-ins we may have for remote artists. As a example currently I have a python package call fs_tools that includes a few python scripts for certain tools our studio needs. Our idea was to add this package to our custom configuration and then in the before_app_launch hook add a call to append the python path env variable to include this library. The problem I am currently having is finding the call to get the path to this package on the local disk. I know where the package goes and can find it on disk I just don’t know how to build the path in shotguns code. But also it got me thinking if this is even the correct way to distribute tool packages. Any help would be appreciated.


Hey! Here are some pointers and ideas:

  • You can potentially use the https://developer.shotgunsoftware.com/tk-core/core.html#sgtk.Sgtk.configuration_descriptor method to figure out the location of your config. Once you have the descriptor object, you can query it’s path and work it out from there.

  • Another approach is to create a toolkit framework, bundle all your libraries in there, and then add that framework to your config. That is something that i think quite few people have done, and it can help you manage versions separate from config changes, which may be useful!



Hello Manne thanks for the reply. I ended up getting a response from a support ticket on this subject and here is what I ended up doing just for anyone else who might want to know approaches.

I used the before app launch hook to get that config path using self.disk_location. I was then able to build my code path from that and append it to my python path env variable.


perfect! glad it worked! That’s a nice solution, similar to using https://developer.shotgunsoftware.com/tk-core/core.html#sgtk.Sgtk.configuration_descriptor !

1 Like