Skip to content
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

OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict #3618

Closed
noklam opened this issue Feb 12, 2024 · 0 comments · Fixed by #4030

Comments

@noklam
Copy link
Contributor

noklam commented Feb 12, 2024

Description

Currently, base_env and default_run_env is not included in the __repr__.

When it is printed, it shows something like this

In [11]: c
Out[11]: OmegaConfigLoader(conf_source=/Users/Nok_Lam_Chan/dev/kedro-inspect/demo-project/conf, env=None, config_patterns={'catalog': ['catalog*', 'catalog*/', '/catalog*'], 'parameters': ['parameters*', 'parameters*/', '/parameters*'], 'credentials': ['credentials*', 'credentials*/', '/credentials*'], 'globals': ['globals.yml']})

Context

Even it inherits from UserDict, but the dictionary interface seems broken. For example:

for key in config_loader.keys():
  print(key)

will print nothing even though config_loader["parameters"] exist. For the context, I was trying to build a plugin that iterate the config loader and "compile" the configuration.

I need to use a workaround looks like this:

keys = config_loader.config_patterns.keys()
for key in keys:
   config = config_loader[key] 
   ...

In addition, if __repr__ is removed, the config_loader will be printed as if it is a "dictionary". Right now it always print the __repr__ regardless of the keys, values, items or print method.

Cc @merelcht

@noklam noklam changed the title OmegaConfigLoader's __repr__ is not implemented correctly OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict Feb 12, 2024
@noklam noklam changed the title OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict [DRAFT] - OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict Feb 22, 2024
@noklam noklam changed the title [DRAFT] - OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict OmegaConfigLoader's __repr__ is not implemented correctly, and it does not behave similar to a UserDict Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant