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

[Feature Request] Allow @hydra.main() to take a config object and pass it through #575

Closed
Darktex opened this issue May 7, 2020 · 4 comments · Fixed by #609
Closed

[Feature Request] Allow @hydra.main() to take a config object and pass it through #575

Darktex opened this issue May 7, 2020 · 4 comments · Fixed by #609
Labels
enhancement Enhanvement request
Milestone

Comments

@Darktex
Copy link

Darktex commented May 7, 2020

🚀 Feature Request

Allow @hydra.main() to take a config and pass it through

@Darktex Darktex added the enhancement Enhanvement request label May 7, 2020
@omry omry added this to the 1.0.0 milestone May 7, 2020
@omry
Copy link
Collaborator

omry commented May 7, 2020

Will look into it.

@lkhphuc
Copy link

lkhphuc commented May 7, 2020

Hi, is this feature the only way to run test of a decorated hydra function?
I have something like this with run decorated by hydra.main:

def test_main():
        experimental.initialize("../cfg/")
        cfg = experimental.compose("../cfg/config.yaml")
        run(cfg)

but it is not allowed.

@omry
Copy link
Collaborator

omry commented May 7, 2020

currently there is no supported way to do it. this feature is exactly about supporting this use case.

@omry
Copy link
Collaborator

omry commented May 7, 2020

you can work around this easily though:

def real_run(cfg):
  ...

@hydra.main(...)
def run(cfg):
  real_run(cfg)

def test_main():
        experimental.initialize("../cfg/")
        cfg = experimental.compose("../cfg/config.yaml")
        real_run(cfg)

@omry omry changed the title [Feature Request] Allow @hydra.main() to take a config and pass it through [Feature Request] Allow @hydra.main() to take a config object and pass it through May 13, 2020
@omry omry closed this as completed in #609 May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants