-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Goodness, I don't even know where ChatGPT would have got that from! I don't recognise the flag name at all! (If someone somewhere wrote some extension like this, feel free to get in touch!) Yes, you're right @yt-invers, Configvars does a bit more than just loading from yaml - it interacts with the pypyr config system, checks multiple file locations and also pyproject.toml. If you're happy just to load from a specific yaml file, you can do this: context_parser: pypyr.parser.keyvaluepairs
steps:
- name: pypyr.steps.fetchyaml
in:
fetchYaml:
path: my-file.yaml
key: defaults
- pypyr.steps.default
- name: pypyr.steps.echo
in:
echoMe: '{play}' In this case your yaml file will look like this (note to # ./my-file.yaml
play: set in yaml The magic here is that the The net result is that it you will keep your CLI arguments - i.e the CLI argument will always take precedence over the yaml file values. You can achieve the same sort of idea using # ./pypyr-config.yaml
vars:
defaults:
play: set in yaml in config file and the pipeline: context_parser: pypyr.parser.keyvaluepairs
steps:
- pypyr.steps.configvars
- pypyr.steps.default
- name: pypyr.steps.echo
in:
echoMe: '{play}' Doing it like this means you could set your # ./pyproject.toml
[tool.pypyr.vars.defaults]
play = "from pyproject.toml" But you raise a good point, this is a frequent use-case: use cli args as an override for a set of defaults. Although you can achieve this using the code above, to interact with the pypyr config system natively we should probably add a *not the world's greatest name 🤔 |
Beta Was this translation helpful? Give feedback.
Goodness, I don't even know where ChatGPT would have got that from! I don't recognise the flag name at all! (If someone somewhere wrote some extension like this, feel free to get in touch!)
Yes, you're right @yt-invers,
pypyr.steps.configvars
will always overwrite on update - so it will overwrite cli arguments.Configvars does a bit more than just loading from yaml - it interacts with the pypyr config system, checks multiple file locations and also pyproject.toml.
If you're happy just to load from a specific yaml file, you can do this: