-
Notifications
You must be signed in to change notification settings - Fork 52
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
Cretae config from template #86
Comments
Hello! What would a "template dict" look like? Would all the values be missing? I'm not 100% clear on how this would work. |
The file generated would have the default values if defined in the template dict or empty values , if possible the expected type as comment. From this example template dict:
This should create a file like: library: /some/file.name # Filename
import_write: False # OneOf([bool, 'ask', 'skip'])
ignore: # StrSeq
plugins: # list
paths:
directory: # Filename
default: # Filename(relative_to='directory')
servers:
- hostname: localhost # str
options: # strSeq |
Aha! To directly answer your question, no, we don't currently have anything like that. It actually seems pretty hard to do, because the resulting value-less config file isn't valid YAML—so we couldn't use a straightforward |
I think this is a great suggestion. I've just started using
If this issue were to somehow be addressed, the default config could be generated as a part of some build process or via a git hook, and the Perhaps I'm doing it wrong and focusing too much on the Thanks! |
A validation template could possibly generate an appropriate minimum config file but I doubt it could produce a good default config file. It wouldn't, for example, generate the comments you would expect in a config file that explains the meaning of each parameter. For my projects, I write the When the program starts, if a |
Is there a way to create a yaml config file from a defined template dict like the one in
/eample/__init__.py
The use case is to generate a new config file to start with if there is no configuration file defined yet.
config.dump() only dumps the currently loaded config, but I can't find an option how to dump a template dict.
The text was updated successfully, but these errors were encountered: