-
Notifications
You must be signed in to change notification settings - Fork 906
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
Enable PyYAML special tag in the Kedro config loader #1011
Comments
For reference: https://pyyaml.org/wiki/PyYAMLDocumentation |
I like this idea. My general opinion on config is that we should let users do whatever they want with it and not be constrained by the strict rules of yaml. And since this functionality is already in pyyaml, great. I think we should either support it natively in kedro or provide documentation on how users can write their own config loader to enable it. The only thing I don't like is that it is specific to yaml (as opposed to the other config types we support), but in reality does anyone use those other config types anyway? ImplementationI would suggest three different things:
Looking at develop, We would then either expose Side note: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
For anyone else stumbling on this when trying to add custom |
I'm going to close this issue, because we intend to move away completely from |
Description
PyYAML supports a large range of non-standard YAML magic functions which allow the user to pass in special tags that extend the standard YAML functionality beyond what is allowed out of the box + cross platform. Examples include
!!tuple
for casting a list to a pythontuple
or event complex tags such as!!python/object:module.cls
for a class instance.Users in the past have asked for tuple and object support so it is something that would be helpful.
Possible Implementation
Kedro uses
anyconfig
to parse configuration files and we can coerce it into parsing this special PyYAML syntax like follows:To enable this it would be nice to put a toggle in the
TemplatedConfigLoader
constructor with a boolean argument likeallow_unsafe
and an extra check at this point to enable this special loading mechanism if theConfigLoader
is parsing a file ending with.yml
or.yaml
:https://github.com/quantumblacklabs/kedro/blob/be3022ecf9ea18f6a448ef9d2c57bd8ad089c769/kedro/config/config.py#L156
Possible Alternatives
Keep as it is, there may be some unintended security risks enabling this functionality.
The text was updated successfully, but these errors were encountered: