iterative / gto

🏷️ Git Tag Ops. Turn your Git repository into Artifact Registry or Model Registry.
https://dvc.org/doc/gto
Apache License 2.0
142 stars 16 forks source link

How to get `gto describe --path` #364

Closed rnoxy closed 1 year ago

rnoxy commented 1 year ago

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?

aguschin commented 1 year ago

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 https://github.com/iterative/gto/issues/337#issuecomment-1559806244

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 https://github.com/iterative/gto/issues/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!

aguschin commented 1 year ago

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 1 year ago

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 1 year ago

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 1 year ago

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.

aguschin commented 1 year ago

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.