HTTP APIs for avalon/pyblish (aport)
- Aport is abbreviation for Avalon-port
- based on Pico server pico on github
- it is run as server on
http://localhost:4242and ip and port could be changed in environment variables - it is using simple HTTP APIs. Example:
http://localhost:4242/<python_module>/<module_function>?<argument1>=<value1>?<argument2>=<value2> - It could be better connected to javascript, and Extended Scrpt used in Adobe CC so any of their software could be integrated.
- a prototype we have and testing at the moment is able to:
- set context - set avalon session into particular context and host application
- deregister pyblish plugin directory paths - remove all paths from PUBLISH_PATH
- register pyblish plugin directory paths - adding path for host application plugins into PUBLISH_PATH
- publish from input json file - it will open pyblish qml and load instances from json file
- Aport could be run as part of the Avalon Tray menu and it could be waiting for any host to submit new publishing subset
- this way it could be used for by: NukeStudio, Adobe Premiere, Davinci Resolve, rest of Adobe products and other software which is not supporting python
Example of use from adobe Premiere Pro:

Example of function from api.py (using some functions from pype's avalon config):
@pico.expose()
def context(project, asset, task, app):
# url: `http://localhost:4242/api/context?project=jakub_projectx&asset=shot02&task=rotopaint&app=premiere`
os.environ["AVALON_PROJECT"] = project
avalon.update_current_task(task, asset, app)
project_code = pype.get_project_code()
pype.set_project_code(project_code)
hierarchy = pype.get_hierarchy()
pype.set_hierarchy(hierarchy)
fix_paths = {k: v.replace("\\", "/") for k, v in SESSION.items()
if isinstance(v, str)}
SESSION.update(fix_paths)
SESSION.update({"AVALON_HIERARCHY": hierarchy,
"AVALON_PROJECTCODE": project_code,
"current_dir": os.getcwd().replace("\\", "/")
})
return SESSION
To add to this somewhat.
We need to connect Premiere and eventually other adobe applications to avalon. Because they don't run python we were looking for an elegant solution and @jezscha came up with idea of using pico server to connect to standalone pyblish and json temp files with collected data for Publish to pick-up instances.
So far it seems like a very feasible option and could open up possibilities for queued publishes from multiple applications as a by product potentially.
Right now all the work is done on config level and we're opening this up to keep you up to date on developments and get potential feedback on the architecture.
Dunno if you guys had a look at this? https://github.com/pyblish/pyblish-aftereffects/pull/1
How would we interact with the Adobe apps from actions?
Dunno if you guys had a look at this? pyblish/pyblish-aftereffects#1
Yes we were considering this, but as we were about to implement something more avalon centric and universal for any host, this would not allow us to do so
How would we interact with the Adobe apps from actions?
Thanks for the question! yes and the way it is done is proposed in #368. But basically. It will run bat script with python host wrapper which will set all environment variables, synchronize a extension into correct adobe respected folder and then run the host application. Python process will end of it could be waiting. But as it is all done from extension to Aport communication, the python wrapper process could exit.
Could you provide an example of an Pyblish/Avalon action plugin? Do we write ExtendScript in the plugin?
It's very unclear what this is doing.
http://localhost:4242/<python_module>/<module_function>?<argument1>=<value1>?<argument2>=<value2>
Is the idea to facilitate calls to arbitrary Python from JavaScript? It sounds like we need to narrow the scope of this somewhat, has it's scope expanded beyond Premiere and Pyblish? Is it still being used? What is the current state of it?
@jezscha @mkolar are you using this in production? Is it working well?
we are using it at one site. However we didn't have capacity to spend some good time on it, so it's a bit temperamental and not very stable.
Thanks for the info. At least for the moment I won't spend time investigating this. :)