How to get the path of a guild resource

Is there a better way of doing this? I tried to use guild.ipy but didn’t have any luck

import subprocess

subprocess.check_output(f"guild open {selection} -c echo", shell=True).decode("utf-8").strip()

A slightly cleaner command would be:

guild select {selection} --path

But no, nothing in ipy for this, other than programmatically finding the run and getting it’s dir. Something like this:

from guild import ipy

runs = ipy.runs()
runs.iloc[0].run.value.dir

It’d be nice if runs supported various filters but it’s designed for programmatic selection via the dataframe interface.

A yet-to-be-officially-released API module guild._api can be used this way:

from guild import _api as gapi

gapi.runs_list()[0].dir

This runs_list function supports all of the filters so you can do something like this:

gapi.runs_list(ops=["train"], completed=True)[0].dir

While this module is marked as private, it’s quite stable and used extensively to automate tests, which are run all the time.

This looks great. Being able to access guild via a python interface has been on my wish list for a while :smiley: