I want to propose a small feature request to add the fields “project.tank_name” and “step.short_name” to the sgtk.Context. They are used throughout all SGTK templates and I find myself querying them in quite a few places in my code. It would just be handy to have them at the finger tips when you need them.
To be clear here I would love this to pseudo code to work:
>>> import sgtk
>>> tk = sgtk.sgtk_from_path("/studio.08/demo_project")
>>> ctx = tk.context_from_path("/studio.08/demo_project/sequences/AAA/ABC/Light/work")
>>> ctx.project
{'type': 'Project', 'id': 4, 'name': 'demo_project', 'tank_name': 'dp'} # extra "tank_name" field
>>> ctx.step
{'type': 'Step', 'id': 12, 'name': 'Light', 'short_name': 'LGT'} # extra "short_name" field
I know that you probably do not want to start adding “arbitrary” fields to the Context object, but since these fields are used quite a lot, I hope you are willing to consider .
fwiw, you can get at the tank name via tk.pipeline_configuration._project_name.
But I agree it would be nice to have this information in the context, and the step short name, too.
I think the feature request is probably too small for the Roadmap. Can try to submit it, but I think it will not be accepted. Maybe @philip.scadding and @jfboismenu have some input on this feature request ?
I’d add my +1 to this but with the added possibility of being able to choose which extra fields to store (maybe in a core hook?) as we drive our step name on disk via a different field (legacy reasons).
Also useful for ctx.entity as we also use custom fields for Shots on disk.