You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have had the problem that I often want variables defined in the top-most layers of my config (e.g. a logger as seen below), which I then want to refer to in multiple places. This causes a recursion error:
I don't see any principled reason why that would not be possible (though I might be wrong). My question is simply if I were to find the time to make a PR for this would it be considered useful?
Minimal example:
importcataloguefromconfectionimportConfig, registryclassRegistry(registry):
registry=catalogue.create("my_package", "loggers")
@Registry.registry.register("my_logger")deftest_fn(name: str):
returnname# desired configconfig_str_unnested="""[logger]@registry = "my_logger"name = "test_logger"[training]batch_size = 32logger = ${logger}"""# current configconfig_str_nested="""[logger][logger.logger]@registry = "my_logger"name = "test_logger"[training]batch_size = 32logger = ${logger.logger}"""if__name__=="__main__":
cfg=Config().from_str(text=config_str_nested)
# works, but is less readablecfg=Config().from_str(text=config_str_unnested)
# does not work, but is more readable
The text was updated successfully, but these errors were encountered:
Hey @KennethEnevoldsen - sorry for the slow response to these very reasonable questions / suggestions, we're working through a bit of a backlog for support after the holiday season.
We'd definitely think this would be useful if you'd find the time for a PR.
Just for my understanding - do you want the function called multiple times, or the same object referenced?
Hi, I have had the problem that I often want variables defined in the top-most layers of my config (e.g. a logger as seen below), which I then want to refer to in multiple places. This causes a recursion error:
I don't see any principled reason why that would not be possible (though I might be wrong). My question is simply if I were to find the time to make a PR for this would it be considered useful?
Minimal example:
The text was updated successfully, but these errors were encountered: