-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using path relative to DVC project root #779
Comments
Hi @prihoda !
Actually, we have support for external local files merged into master and for those /path is a valid one.
Unfortunately I can't see a good way for dvc to setup those env vars automatically without getting into your bashrc. Maybe I'm missing something. In the upcoming 0.9.8 you could setup a remote with the project's root directory and reference that in dependencies/outputs of your stages. I.e.:
But it still looks a bit too long. Though, we could consider treating Another option would be to do as git does(i.e. git rev-parse --git-dir or smth like that) and introduce some dvc command that will spit out root dir, so that you could reference it in your commands(both -d/-o and the cmd itself). I.e. |
Yup I'm using the path to the script also in the command. Not sure how DVC runs the command, but you can pass environment variables to commands from python like so: import subprocess, os
my_env = os.environ.copy()
my_env["DVCPATH"] = "/some/path"
subprocess.Popen("echo $DVCPATH/file.txt", env=my_env, shell=True)
# /some/path/file.txt The remotes look cool, I'll look into the docs when they are ready. |
Thanks for clarifying. Looks like
Unfortunately that would not work in a general case, because you also need to be able to use that env in -d/-o notation for
First one will evaluate to:
because shell doesn't know DVCROOT env var. So this method would cause a lot annoyances. On the other hand the proposed
which is acceptable. Thanks, |
Fixes iterative#779 Signed-off-by: Ruslan Kuprieiev <[email protected]>
Hi guys. I was wondering whether we could make use of DVC's knowledge of the project root path.
I'm regularly referencing my /scripts folder from DVC files inside my /data folder using relative paths such as ../../../scripts/something.py, which can get quite annoying.
Would it be possible to reference paths relative to the DVC project root?
The text was updated successfully, but these errors were encountered: