From e7aff9c5fca39f3208a9a206103a9466b3accd1c Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 30 Jun 2020 18:51:20 +0200 Subject: [PATCH 1/3] bugfix exec usage in dvc.yaml --- spacy/cli/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/cli/project.py b/spacy/cli/project.py index 6d0ec7991..a5debc8b6 100644 --- a/spacy/cli/project.py +++ b/spacy/cli/project.py @@ -523,9 +523,9 @@ def update_dvc_config( outputs_no_cache = command.get("outputs_no_cache", []) if not deps and not outputs and not outputs_no_cache: continue - # Default to "." as the project path since dvc.yaml is auto-generated + # Default to the working dir as the project path since dvc.yaml is auto-generated # and we don't want arbitrary paths in there - project_cmd = ["python", "-m", NAME, "project", ".", "exec", name] + project_cmd = ["python", "-m", NAME, "project", "exec", name] deps_cmd = [c for cl in [["-d", p] for p in deps] for c in cl] outputs_cmd = [c for cl in [["-o", p] for p in outputs] for c in cl] outputs_nc_cmd = [c for cl in [["-O", p] for p in outputs_no_cache] for c in cl] From 8eca7e995e3dcc723b3796640251c5a32a4c5594 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 30 Jun 2020 21:53:40 +0200 Subject: [PATCH 2/3] add try-except to git commands to get an informative warning --- spacy/cli/project.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spacy/cli/project.py b/spacy/cli/project.py index a5debc8b6..771d192da 100644 --- a/spacy/cli/project.py +++ b/spacy/cli/project.py @@ -240,12 +240,16 @@ def project_clone( try: run_command(cmd) except SystemExit: - err = f"Could not clone the repo '{repo}' into the temp dir '{tmp_dir}'" + err = f"Could not clone the repo '{repo}' into the temp dir '{tmp_dir}'." msg.fail(err) with (tmp_dir / ".git" / "info" / "sparse-checkout").open("w") as f: f.write(name) - run_command(["git", "-C", str(tmp_dir), "fetch"]) - run_command(["git", "-C", str(tmp_dir), "checkout"]) + try: + run_command(["git", "-C", str(tmp_dir), "fetch"]) + run_command(["git", "-C", str(tmp_dir), "checkout"]) + except SystemExit: + err = f"Could not clone {name} in the repo '{repo}'." + msg.fail(err) shutil.move(str(tmp_dir / Path(name).name), str(project_dir)) msg.good(f"Cloned project '{name}' from {repo} into {project_dir}") for sub_dir in DIRS: From a7d547c65e728aaa4c1b8c92e7fac118512f6979 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 30 Jun 2020 21:56:17 +0200 Subject: [PATCH 3/3] small fix --- spacy/cli/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/cli/project.py b/spacy/cli/project.py index 771d192da..a4f8670a2 100644 --- a/spacy/cli/project.py +++ b/spacy/cli/project.py @@ -248,7 +248,7 @@ def project_clone( run_command(["git", "-C", str(tmp_dir), "fetch"]) run_command(["git", "-C", str(tmp_dir), "checkout"]) except SystemExit: - err = f"Could not clone {name} in the repo '{repo}'." + err = f"Could not clone '{name}' in the repo '{repo}'." msg.fail(err) shutil.move(str(tmp_dir / Path(name).name), str(project_dir)) msg.good(f"Cloned project '{name}' from {repo} into {project_dir}")