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

RFC: hydra.compose() decoration #219

Closed
omry opened this issue Oct 11, 2019 · 7 comments
Closed

RFC: hydra.compose() decoration #219

omry opened this issue Oct 11, 2019 · 7 comments
Labels
enhancement Enhanvement request In progress Work in progress
Milestone

Comments

@omry
Copy link
Collaborator

omry commented Oct 11, 2019

Initial API idea:

@hydra.compose(config_path="path/file.yaml", overrides=["foo=bar", "db=mysql"])
def foo(cfg, userarg):
    pass

result = foo(userarg)
@omry omry added the enhancement Enhanvement request label Oct 11, 2019
@withsmilo
Copy link

withsmilo commented Oct 11, 2019

It looks good! It seems to be similar to what I had proposed before(#215). What is userarg? user-defined ArgumentParser, or another something?

@omry
Copy link
Collaborator Author

omry commented Oct 11, 2019

Thanks!
Not quiet the same.
This is a way to access the composition power of Hydra in a regular function call.
User arg is just an example of something else the user is passing to the function (pass through).

@withsmilo
Copy link

withsmilo commented Oct 11, 2019

I understood. New hydra.compose decorator also seems to be useful in various place. I have a question. Will new decorator return something according to your initial design? As you know, hydra.main decorator doesn’t return anything.

@omry
Copy link
Collaborator Author

omry commented Oct 11, 2019

Yes, the new decorator will be able to return results.
In fact, so can the current hydra.main() although nothing is using it as of now.

@omry omry changed the title hydra.compose() decoration RFC: hydra.compose() decoration Oct 17, 2019
@omry omry added this to the 0.11.0 milestone Oct 21, 2019
@omry omry added the In progress Work in progress label Nov 8, 2019
@omry
Copy link
Collaborator Author

omry commented Nov 16, 2019

Done, this will be available with the next 0.11.0 release candidate.

@omry omry closed this as completed Nov 16, 2019
@omry omry mentioned this issue Nov 20, 2019
@hrchu
Copy link
Contributor

hrchu commented Dec 20, 2019

Glad to see you hear the user voice!

@omry
Copy link
Collaborator Author

omry commented Dec 20, 2019

Actually this is not quiet what you asked for, the compose API does not support anything in the command line.
I am planning on supporting something like what you wanted #274 is implemented.
There is a reasonable workaround for allowing users to specify a config file in the comments there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request In progress Work in progress
Projects
None yet
Development

No branches or pull requests

3 participants