Skip to content

Conversation

@vyloy
Copy link
Contributor

@vyloy vyloy commented Apr 16, 2019

This PR add the '--file' option for dvc import

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Do we enforce the file name somewhere? What would happen if I specify it w/o .dvc? We need to check that it does not allow creating stage files like this. Also, let's add a test for this.
  2. There is not first or second output in the import case.

In general, I don't like this description. It's too verbose. I would just keep something like - specify the name of the DVC file it generates. All other details should go to the docs.

The same questions stay for the dvc add. As we agreed in private we do both (even though it's turned out -f is already supported by dvc add but not documented).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test that it support subdirectories properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create the subdirectories when they are not exist?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question! I think it should behave the same way as dvc add and dvc run

Copy link
Contributor

@shcheklein shcheklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! I put two comments to address.

Also, let's create a PR request for the iterative/dvc.org to update docs.

Thanks! Good stuff.

@vyloy vyloy changed the title [WIP] import: support the '--file' option import: support the '--file' option Apr 17, 2019
@shcheklein shcheklein requested a review from efiop April 17, 2019 02:28
Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @vyloy ! Could you please rebase on top of master?

@vyloy
Copy link
Contributor Author

vyloy commented Apr 18, 2019

Sure.

Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment down below:

os.remove("bar.dvc")
os.mkdir("sub")

ret = main(["import", "--file", "sub/bar.dvc", self.external_source])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, one more thing. Please don't hardcode paths like sub/bar.dvc and use os.path.join() instead. We are running on both windows and *nix, so your test on windows was not creating bar.dvc in sub but rather a sole file named sub/bar.dvc(on windows / is a valid char in the filename).

@efiop efiop merged commit b057c81 into treeverse:master Apr 18, 2019
@efiop
Copy link
Contributor

efiop commented Apr 18, 2019

@vyloy Thank you! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants