Skip to content

dvc.api: doesn't work with repo with SSH URL #3111

@jorgeorpinel

Description

@jorgeorpinel
$ dvc version
DVC version: 0.80.0
Python version: 3.7.6
Platform: Darwin-19.0.0-x86_64-i386-64bit
Binary: False
Package: brew

This script

import csv
import dvc.api

with dvc.api.open(
  "sea_ice.csv",
  repo="git@github.com:iterative/df_sea_ice_no_header.git"
) as fd:
  reader = csv.reader(fd)
  for row in reader:
    print(row[0])

Throws

Traceback (most recent call last):
  File "tests/open-test.py", line 6, in <module>
    repo="git@github.com:iterative/df_sea_ice_no_header.git"
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/Users/drbidibombom/DVC-repos/api-tests/.env/lib/python3.7/site-packages/dvc/api.py", line 78, in _open
    with _make_repo(repo, rev=rev) as _repo:
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/Users/drbidibombom/DVC-repos/api-tests/.env/lib/python3.7/site-packages/dvc/api.py", line 98, in _make_repo
    yield Repo(repo_url)
  File "/Users/drbidibombom/DVC-repos/api-tests/.env/lib/python3.7/site-packages/dvc/repo/__init__.py", line 77, in __init__
    root_dir = self.find_root(root_dir)
  File "/Users/drbidibombom/DVC-repos/api-tests/.env/lib/python3.7/site-packages/dvc/repo/__init__.py", line 145, in find_root
    raise NotDvcRepoError(root)
dvc.exceptions.NotDvcRepoError: you are not inside of a dvc repository (checked up to mount point '/')

It looks like it's trying to use my cwd . as the repo (and I'm not working from a DVC repo).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?p1-importantImportant, aka current backlog of things to do

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions