Add default file to example persistent_params_from_file - #606
Add default file to example persistent_params_from_file#606stefanthorstenson wants to merge 3 commits into
Conversation
ArisMorgens
left a comment
There was a problem hiding this comment.
Looks good! I left some comments that could reduce user confusion.
| @@ -0,0 +1,7 @@ | |||
| params: | |||
There was a problem hiding this comment.
Could you add a comment about what this file is about?
e.g. # Used in persistent_params_from_file.py
There was a problem hiding this comment.
Fixed. Added comment and changed name of the file to indicate relationship to python script.
| if __name__ == '__main__': | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('-f', '--file', type=str, help='The yaml file containing the arguments. ') | ||
| parser.add_argument('-f', '--file', type=str, default='params.yaml', |
There was a problem hiding this comment.
A common way to run an example in cflib is to use uv from the root of the repo, since that's where the pyproject.toml is. (uv run examples/parameters/persistent_params_from_file.py). This won't work now because the file path is relative to the root. We could use something like os.path.join(os.path.dirname(os.path.abspath(__file__)), 'params.yaml') to fix that. What do you think?
There was a problem hiding this comment.
Good point! Will fix it.
Add default file to example
persistent_params_from_file.py.Tested: