iterative/gto

How to get `gto describe --path`

rnoxy opened this issue · 6 comments

rnoxy commented

I am using artifacts.yml in the repo in order to annotate the artifacts registered with GTO.
I noticed that in the lates version v0.3.1 the command describe is removed.

How can I get the filepath to the artifact that is registered with gto?

Hi @rnoxy! Starting from 0.3.0, artifact annotations migrate from artifacts.yaml to dvc.yaml. For more details on the update, check out this comment specifically #337 (comment)

There is a DVC API to add/read annotations if you need them:

from dvc import Repo

repo = Repo.Repo(".")

# reading
repo.artifacts.read()
# adding
repo.artifacts.add("added-from-python", Artifact(path="some"))

For the reasons for this migration, please check out the discussion here #337

Are you using GTO with DVC, or GTO as a standalone tool? Also, once you read this, please let me know if this is solves your issue. Thanks!

Also, if you need to get path in CI, there is an action for that http://github.com/iterative/gto-action
It also uses the DVC API I mentioned, so you can check it out to see an example of using it.

rnoxy commented

Hi @aguschin , thanks for your reply. It really helped.
I am using GTO with DVC, but the confusion came from this documentation https://mlem.ai/doc/gto/command-reference/describe
Now I know how to migrate. Thanks.

rnoxy commented

Also, if you need to get path in CI, there is an action for that http://github.com/iterative/gto-action It also uses the DVC API I mentioned, so you can check it out to see an example of using it.

Hey @aguschin ,
but could you tell how to use this action with --repo option.
I see it can only work with . local repository, right?

So I cannot run gto dedscribe artifact_name --path with new dvc in CLI.

rnoxy commented

I have found the env variable GITHUB_REF
https://github.com/iterative/gto-action/blob/v2/read_annotation.py#L13
so one can try (probably) setting this to be --repo option.

The action works with the repo that's cloned in GH workflow. So to use that script, you better to cd into the repo dir. So yes, it doesn't work with remote repos. Moreover, I think DVC doesn't work with them if you do Repo(remote_url), but you can give it a try I think.