Skip to content

Commit

Permalink
Implement a custom format parser
Browse files Browse the repository at this point in the history
This commit is a major change to ramble's expander logic. Previously, we
relied heavily on Python's f-string format syntax. This causes issues
related to formatting template files (like json and yaml), and prevents
some usecases (such as in-line variable definitions).

This change adds a custom parser for processing strings while they are
being expanded.
  • Loading branch information
douglasjacobsen committed Oct 4, 2023
1 parent 3699cd1 commit 8cd6005
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 123 deletions.
1 change: 1 addition & 0 deletions lib/ramble/ramble/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ def _make_experiments(self, workspace):

for template_name, template_conf in workspace.all_templates():
expand_path = os.path.join(experiment_run_dir, template_name)
tty.msg(f'Writing template {template_name} to {expand_path}')

with open(expand_path, 'w+') as f:
f.write(self.expander.expand_var(template_conf['contents']))
Expand Down
Loading

0 comments on commit 8cd6005

Please sign in to comment.