Closed ghost closed 5 years ago
The big question for me here is: do we need to add any code to Flambé? Seems like we can just provide a small tutorial that explains how you can use Jinja to do this
I like the idea of templating, but I don't really think this requires additional code, which is kind of cool :)
Why not include the function I wrote above?
All of the code is super boilerplate. Plus, you can control how the config is written back to disk (removing spaces, comments, etc.).
For me, the question is: does this help people to get started with/fall more in love with flambé, and at what cost?
The answer is: yes, and at a very small one of a single helper.
Whether we add this snippet to the code or the docs what does it change?
They will still need to run a script on their template
Just to clarify I do want to keep your snippet! I just think it's so small it can just go in a tutorial directly. Do you think there is a strong reason to put it in the repo? If so, we can PR it in flambe.utils
:)
I think it would be fine to add to utils - but there is one cost: we add jinja as a dependency
@nmatthews-asapp it's already a flask dependency, which is a dependency of ours (at least until we make the website a different repo or something)
@williamabrwolf want to make a PR into flambe.utils?
Is your feature request related to a problem? Please describe.
Yes. I'm trying to dynamically inject pathnames into a config, then run an experiment using that config. Out of the box, there is no clean way to do this.
Describe the solution you'd like
A function that accepts a path to a Jinja2-templated flambe config, an output path, and key:val pairs to inject.
Describe alternatives you've considered
Loading the config into memory with YAML or flambe-YAML tools, editing in memory, then writing a new config to disk.
Additional context
Here's what I've come up with:
Where a config template might look like: