Skip to content
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

Add DVC commands to vscode View -> Command Palette ... #40

Closed
RandomFractals opened this issue Dec 25, 2020 · 2 comments
Closed

Add DVC commands to vscode View -> Command Palette ... #40

RandomFractals opened this issue Dec 25, 2020 · 2 comments

Comments

@RandomFractals
Copy link

RandomFractals commented Dec 25, 2020

For convenience we should add DVC commands users can run from vscode Command Palette and assign shortcuts.

Think of these commands as global DVC actions for the open workspace in vscode.

The following DVC commands seem like good candidates:

VSCode Command DVC Command Description
DVC: Initialize dvc init Initializes DVC project in the open vscode workspace. Creates .dvc/ directory and DVC cache and config files.
DVC: Initialize Directory dvc init --subdir <dir> Promps for a directory name via vscode Quick Input UI interface and runs dvc init command for subdirectories to create a project with mulitple DVC managed directories. Note: add DVC: Initialize Directory to the vscode file explorer context menu to initialize DVC directories from the file explorer tree view. See #41
DVC: Install Git Actions dvc install Installs Git hooks for DVC repository to automate certain common dvc actions paired with git checkout, git push, git commit, etc.
DVC: Add dvc add targets <targets> Prompts for a data file name or directory and adds it to DVC. Note: also add DVC: Add context menu to the vscode file explorer for adding data files to DVC from that file tree view. See #41
DVC: Add Matching Files dvc add --glob <patern> Prompts for a glob file pattern and adds matching files to DVC.
DVC: Add Files Recursive dvc add --recursive <dir> Prompts for a data directory name and adds files to DVC recursively.
DVC: Checkout dvc checkout Runs dvc checkout for the open workspace in vscode.
DVC: Checkout Files dvc checkout targets <files> Prompts for a checkout file list and runs dvc checkout for them.
DVC: Checkout Files Recursive dvc checkout --recursive targets <directories> Prompts for the checkout target directories and runs dvc checkout for them recursively.
DVC: Commit dvc commit Commits changes for dvc tracked files and directories.
DVC: Fetch All Remote Data dvc fetch Downloads files and directories from all remotes added to DVC. See #42
DVC: Fetch Remote Data dvc fetch targets <remoteName> Displays remotes Quick Pick List and downloads files and directories for the selected DVC remote to data cache. See #42
DVC: Garbage Collect dvc gc Removes unused files and directories from DVC cache.
DVC: Remove Remote Data dvc gc --cloud --remote <remoteName> Prompts for a remote via Quick Pick list and removes unused files and directories from local DVC cache and remote storage. See #42
DVC: Get Data from URL dvc get-url <url> Prompts for a data URL via Quick Input and downloads file or directory from the specified remote end-point .
DVC: Get Data from Repository dvc get <repositoryUrl> <dataPath> Prompts for a DVC or git repository URL and data path and downloads repository data to the current DVC workspace.
DVC: Import Data URL dvc import-url <dataUrl> Imports data from the specified URL. Creates a .dvc file for tracking that remote data changes.
DVC: Import Data from Repository dvc import <repositoryUrl> <dataPath> Prompts for a DVC or git repository URL and data path and imports that repository data to the current DVC workspace.
... ... ...
DVC: Remove dvc destroy Removes all DVC files and internals from the open DVC project in vscode.
... ... ...
@ryanraposo
Copy link

ryanraposo commented Jan 1, 2021

Hi @RandomFractals. About this issue and comment...

In any case, I want to create a base DVCCommand class we can all use that runs these checks & wires launching dvc in one place. Should be part of #40

This DVCCommand class is something I've been thinking about a lot. I'm not sure the best way to 'trade notes' on this but if you have any thoughts about it I'd love to hear them! Same goes for classes to model dvc generally, but that's separate (sort of).

Anyways, here are a few points/resources that stand out for me:

  • Mirroring the sensible way Git uses output channels in VS Code. It's a clear log of the activity/sequences underpinning all of the UI Commands. @rogermparent my first instincts were the same as yours re: output, and now I think this is the way to go. I'd say you were on point about using other indicators (ex vscode.showInformationMessage). In my experience, Output channels are always low-key. They're a lot like log files--suited to diagnostics, not so much as prompts.

image

  • Git comes stock with VS Code now and has for a while, but its a lot like any other SCM extension. On that note, I think everyone should check out the architecture decisions in the Mercurial (hg) extension. There are similar patterns again in GitGraphView, and that codebase is super high-quality IMO. I always stand to learn from it.

  • Some of what you'll find is dipping back into the wider DVC modeling question, but it is/will be connected. Things like modeling repositories, handling a missing (DVC) installation, supplementing commands with QuickInput/InputDialogs etc.

  • To refocus a bit and get back to Commands, take a look specifically at vscode-hg/blob/master/src/commands.ts for interesting architecture, and then at this Shell extension for some simple child-process patterns that fit VS Code.

Sorry if this was messy. I guess I wanted to share techniques/parallels that are on my radar since I don't have any code yet. I want to tap into everyone else's knowledge before even trying... this is an interesting problem for me but it'd be irresponsible to take on by myself. At any rate, I really don't think this is something we can underestimate/move too quickly on.

EDIT: your table is awesome! forgot to acknowledge that you started this conversation in a big way!

@mattseddon
Copy link
Contributor

@rogermparent I am going to close this one off as it is a bit of a red herring to leave it lying around. We can come back to some of the commands later but I don't see them as a priority.

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

No branches or pull requests

4 participants