-
Notifications
You must be signed in to change notification settings - Fork 1.3k
cli: support external commands available in PATH #7259
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
Conversation
5332d55 to
02c0fb1
Compare
Would we be better off using python entrypoints here (rather than using PATH)? If we defined a This way everyone could expect things like The disadvantage here would be that using PATH means users aren't forced to use python, but I'm assuming that anyone writing custom DVC subcommands is probably using python and e: Also, thinking about it some more, the entrypoints method would only work with DVC installed in pip/conda environments (and not with the binary packages), but using PATH would not have that limitation. |
9037b36 to
055830b
Compare
I think we need both approaches, and have different use cases. Let's start with their respective pros and cons: PATH based plugins:Pros:
Cons:
So, this approach forces users to use the CLI interface more. This is more useful for using simple scripts the user has. Python entrypoints based approachPros:
Cons:
So, at least to me, it looks like for dvclive and similar packages that we maintain, providing an API is the best solution. |
This commit adds support for external commands that are available in one of the directory set in PATH. The executable should be in format of \'dvc-*\' format, should have executable permissions and need to exist (duh). The suffix, after 'dvc-' will be used as a subcommand name, and all tha arguments after that subcommand will be passed to that external command.
055830b to
44baacd
Compare
for more information, see https://pre-commit.ci
This commit adds support for external commands that are available
in one of the directory set in PATH.
The executable should be in format of 'dvc-*' format, should
have executable permissions and need to exist (duh). The suffix,
after 'dvc-' will be used as a subcommand name, and all tha arguments
after that subcommand will be passed to that external command.
Closes #6489.
Motivation
This makes DVC extensible with new subcommands without having to modify DVC itself. This can help users to use
custom commands outside of DVC.
We may be able to maintain
dvcliveoutsidedvc. Although it's not clear if this will be enough, or if we need python-based plugins.Users may be able to combine multiple dvc commands for their workflow or use it to set an alias. Introduce DVC aliases #7040.
We also lack plumbing/low-level commands that I always wanted to have, especially during debugging/development.
These commands could be modifying
dvc-objectsor manipulatingdvc.yaml/dvc.lockfiles, or debugging pipelines workflow, etc. We have too many commands already, and we may not want to have more commands, that are niche.This gives us the ability to share scripts among the team. See dvc: introduce
dvc md5ordvc checksumcommand #1500.This is not expected to be documented yet, we may try using it within the team and gather feedback first.
Other projects that support this mechanism:
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏