-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
exp init: interactive and explicit options #6637
Conversation
The template is not usable yet in packages nor it will be initialized during 'dvc init' though. But it supports custom templates if user adds the template in .dvc/stages or in dvc's codebase on resources/stages.
This could be a problem unless we implement optional outputs (#4410), and we might need optional dependencies also. Otherwise, it seems like this will break a lot of simple scenarios where users don't have plots or some other part of the stage template. I was thinking that we could have a template with conditionals, but behavior for custom templates that don't implement those conditionals could be confusing 🤔. The spec used jinja because it's familiar, flexible, and doesn't require custom DSL/templating. However, usability is more important than flexibility since this feature is about solving simple use cases. Also, we already have custom templating for If we reuse cmd: ${cmd}
deps:
- ${code}
- ${data}
params:
- ${params}
outs:
- ${models}
metrics:
- ${metrics}:
cache: false
plots:
- ${plots}:
cache: false I assume this provides more control to do things like:
Let me know if you have other ideas. The spec defines expected usage, but implementation is up to you. |
Either jinja or any other custom template, I am not super convinced that we need one. Playing with this current implementation, the template has been only useful to specify For working around optional dependency, maybe we can just allow user to skip some of the options? $ dvc exp init -i
Command to run: python script.py
Path to data file/directory [data, n to skip]:
Path to source file/directory [src, n to skip]:
... And, in non-interactive mode, we can have |
I was thinking it could be useful for other reasons:
However, you are right that it's probably not essential, especially in an initial release, if the optional outputs issue is resolved.
Would it be better to support optional dependencies and outputs and not need to implement any workaround? All of the workarounds so far seem clunky (having different behavior for interactive mode and non-interactive mode seems odd to me, and behavior of |
For
Even without optional dependencies, we may want to give users the choice of skipping some stuff. We could have skip on non-interactive mode with Thinking about templates more, we may just end up using the templates just for our own purpose of skipping some stuff. Considering this is targeted at the new users, will they even use it? Even if they do, are we not directing them to learn more complicated stuff? Maybe guiding them to the docs/UG is a better thing to do here. |
I agree that we can forget about obscure options like
With optional dependencies, we wouldn't need any of this, right? Since this command should focus on simplicity, I would try to avoid lots of options like |
Thinking more about how optional outputs/dependencies would work here. Would they be explicitly marked as Maybe we are better off keeping the Some ideas for interactive mode:
Interactive mode should probably also include a question about template/whether this is a DVCLive experiment (for logging checkpoints in deep learning). |
Asking after every blank input maybe too much, I think we can just ask at the end for confirmation. I think we can learn from $ poetry init
This command will guide you through creating your pyproject.toml config.
Package name [dvc]:
Version [0.1.0]:
Description []:
Author [AuthorName <[email protected]>, n to skip]: user
License []:
Compatible Python versions [^3.8]:
Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
Generated file
[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.poetry]
name = "dvc"
version = "0.1.0"
description = ""
authors = ["user"]
[tool.poetry.dependencies]
python = "^3.8"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Do you confirm generation? (yes/no) [yes] yes
It may be helpful if we add support for path suggestion, but I'd like to leave it for minimal implementation. Could think of it later. |
The poetry confirmation seems more like if dvc prints what will be added to I think some version of your original Suggested wording: Edit: Yes, I realize this is all the behavior you proposed in #6637 (comment) 😄 . |
This is stale, superseded by #6681. |
On top of #6630.
Defaults from the config is not supported yet.
The
--interactive
will ask for the options that are specified in the template file and will fall back to the default values from the command flags + configs (not implemented yet) + hardcoded defaults.When
--explicit
is used, it won't fall back to the defaults from config or hardcoded values. Mixed with--interactive
, it won't allow users to proceed ahead without answering. This is against the spec, that particular values should be skipped, but with templates, it's not possible to do that.Custom templates are supported, whatever it is created in
.dvc/stages
. You can create default templates in.dvc/stages
by runningpython -m dvc.repo.experiments.init
, but it can also fallback to the default files it keeps inresources/stages
.