Command-line entry point into toolkit pipeline

Im trying to create a macos/gnome/windows terminal entry point into toolkit. Ideally, you’d be able to launch a terminal and using some sh/bat scripts, bootstrap toolkit to the command line and run further commands. Similar to the ‘tank’ commands but customizable with tk-apps to extend the functionality.

I’d like to be able to A) launch the terminal directly and use a command like ‘sgtk {show_code}’ to bootstrap sgtk to the terminal or B) launch the terminal from shotgun desktop and have it automatically bootstrap to the project context. From either of those entry points, a user (or farm machine) could then use a command like ‘context {shot_code}/{task_name}’ or ‘context {id}’ to switch context.

Some things of note:

  1. We are using a distributed config but I do have a copy of the latest tk-core available on a shared device for bootstrapping.
  2. I’ve experimented with tk-shell engine, but it seems like I can only bootstrap the python shell running inside a terminal. Once I quit that shell, I loose my bootstrap.
  3. I’ve got a modified tk-shell that im testing some ideas out on:

Any help would be appreciated.

1 Like

I’m not sure how much help I can provide here. What you’re working on sounds really cool though.

tk-shell seems like it is a good place to start
The tk-shell engine and the tank command which uses it, only stay’s alive for the lifetime of that command. ie each time you run a new command it imports sgtk and starts the tk-shell engine.

It sounds like you would like to keep the engine alive between execution of commands?

1 Like

Yes. Ideally I’d like to keep the instance of that engine alive so I dont have to bootstrap the engine every time I run a sh/bat script.

My current thought is that this may only be possible thru some socketIO implementation (which I don’t know much about yet). That seems like it would allow me to have a python interpreter running in the BG and accepting commands thru a socket. Maybe?


That sounds similar to how Shotgun Desktop works. When you select a project in SG Desktop it spawns off a separate process that bootstraps the engine and then communicates back to the main process. It should be doable, though I guess the question would be, what would be the main process that keeps track of the bootstrapped engines, and when would that get started and shut down.