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

Added a warning if primary config is missing _self_ #1756

Merged
merged 2 commits into from Aug 9, 2021
Merged

Conversation

omry
Copy link
Collaborator

@omry omry commented Aug 4, 2021

Closes #1755.

See #1755 and documentation changes in this diff for context.

@omry omry requested review from jieru-hu and Jasha10 August 4, 2021 22:02
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 4, 2021
@jieru-hu jieru-hu self-requested a review August 5, 2021 00:05
@omry
Copy link
Collaborator Author

omry commented Aug 5, 2021

The primary feedback I am looking for is about the clarity of the doc changes.

@omry
Copy link
Collaborator Author

omry commented Aug 5, 2021

You can read them in context at the website preview:

https://deploy-preview-1756--hydra-preview.netlify.app/

@jieru-hu
Copy link
Contributor

jieru-hu commented Aug 5, 2021

taking another pass of the doc...

Copy link
Contributor

@jieru-hu jieru-hu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall, the doc updates need to be replicated in 1.1 version.

Copy link
Collaborator

@Jasha10 Jasha10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few edits.
I made each suggestion twice (once for the main docs, once for the versioned docs).

Comment on lines +71 to +76
### Composition order of primary config
Your primary config can contain both config values and a Defaults List.
In such cases, you should add the `_self_` keyword to your defaults list to specify the composition order of the config file relative to the items in the defaults list.

* If you want your primary config to override the values of configs from the Defaults List, append `_self_` to the end of the Defaults List.
* If you want the configs from the Defaults List to override the values in your primary config, insert `_self_` as the first item in your Defaults List.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These guidelines apply to nested configs too, not just the primary config, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. For nested configs, in all cases I have seen so far trailing _self_ makes sense so requiring users to specify it is not something I want to do.

website/docs/tutorials/structured_config/5_schema.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@Jasha10 Jasha10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

#### Requiring users to specify a default list value
### A Note about composition order
The default composition order in Hydra is that values defined in a config are merged into values introduced from configs in the Defaults List - or in other words - overriding them.
This behavior can be unintuitive when your primary config is a Structured Config, like in the example above.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely quite unintuitive, though seeing the _self_ makes it a bit clearer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Unfortunately this behavior makes a ton of sense in all other use cases and making the behavior special in this unique cases will likely add even more confusion.

@kandluis
Copy link

kandluis commented Aug 9, 2021

Left a few minor nits, but overall, the updated docs will be helpful! Thanks :)

@omry omry merged commit 7388549 into master Aug 9, 2021
@omry omry deleted the self_warning branch August 9, 2021 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue a warning if primary config is missing _self_ and is overriding config values
5 participants