-
Notifications
You must be signed in to change notification settings - Fork 5
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
Jinja2 Templating Infra #446
Conversation
Functionality to render jinja2 templates to make creating batch files easier. Also opens up the door to future use of templates like creating config files. Associated docs+tests included.
Attempt to fix Jinja2 lader issue by falling back to a file system loader if a package loader fails.
b5f3aad
to
1d82cd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine, but I think there are some engineering questions to answer.
Related: how should we be maintaining the answers to questions like these? I see the method docstrings, but where is the developer comments explaining our thinking / decisions?
Per @pearsonca request: * Only use the `PackageLoader` for setting up the jinja environment. * Removed `gempyor._jinja._get_template/_render_template`.
Isn't that what PRs are for? I don't see why code needs documentation to reflect the decisions made to produce it. |
Describe your changes.
This pull request extracts out the
Jinja2
templating infrastructure from GH-394 to make that pull request a bit more simple to review. It adds an internal_jinja
module to thegempyor
package with the (closely related) functions:_get_template
to pull templates from thetemplates/
directory,_render_template
to render a template with provided template data,_render_template_to_file
to render a template and save it to a file, and_render_template_to_temp_file
to render a template to a temp file and return that temp file.Changes include unit tests and docstrings to document internal functionality.
Does this pull request make any user interface changes? If so please describe.
The user interface changes are none. All changes provide internal utilities to the
gempyor
python package.Those are reflected in updates to the documentation in the docstrings of the relevant functions.
What does your pull request address? Tag relevant issues.
This pull request addresses GH-365 by simplifying GH-394.