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
As a Hydra beginner, I quickly stumbled upon this issue of hydra.main() not returning values (#769). Then I switch to the Compose API, which I find really useful when starting & testing a project from scratch, when I do not need complex functions like multirun at this stage. Sometimes only config and some logging are needed.
Pitch
It would be great if hydra.compose() decorator is supported to use Compose API functions like in the original idea (#219).
It would also be great if the basics like config, output, logging, (optional) disable output, etc, are supported. They are really helpful for those functions not in app() and do need to return parameters. And it would be helpful for transition from prototype code to final parameter-sweeping.
The text was updated successfully, but these errors were encountered:
I strongly suggest using @hydra.main by default and reverting to compose() in cases where you do not have access to the command line. (tests, notebooks etc).
By starting your project using compose you are basically guaranteeing that you will have difficulties down the line.
If you want to return a value from your @hydra.main you are probably thinking about it in the wrong way. It is designed to be the entry point to your application. not a function you call.
At this point I have no plans of closing the functional gap between compose and @hydra.main().
I do have plans to make allow disabling the output directory management of @hydra.main() though, (#910).
furthermore, The current API for compose is more flexible than a the decorator style API and I do not plan to switch it to a decorator API.
FWIW I was unit testing some code where several downstream tasks assumed the Hydra log file would be present. Rather than modify my source code to deal with this (just for the sake of testing), I used hydra.core.utils.configure_log() to ensure the logging was setup even with the Compose API
I'm not sure if this is discouraged, but the function is public and it's just a thin wrapper around logging.config.dictConfig
🚀 Feature Request
Promote Compose API to
hydra.compose()
decoratorMotivation
As a Hydra beginner, I quickly stumbled upon this issue of
hydra.main()
not returning values (#769). Then I switch to the Compose API, which I find really useful when starting & testing a project from scratch, when I do not need complex functions like multirun at this stage. Sometimes only config and some logging are needed.Pitch
It would be great if
hydra.compose()
decorator is supported to use Compose API functions like in the original idea (#219).It would also be great if the basics like config, output, logging, (optional) disable output, etc, are supported. They are really helpful for those functions not in app() and do need to return parameters. And it would be helpful for transition from prototype code to final parameter-sweeping.
The text was updated successfully, but these errors were encountered: