question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to declare required fields?

See original GitHub issue

Hi, I’m trying out hydra right now because I like having sane defaults and the (java spring-config like) flexibility to configure everything. Looks good so far! 😃

I have a CLI app that has two required fields that need to be provided by the user and can’t have defaults. I want to use strict mode, so I declared those in my config file. But if I leave them empty, I get None as the value. Is there a way to mark those as required like in argparse and have hydra print usage/help if they are not delivered?

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
omrycommented, Jan 6, 2020

Hi Jonas, Thanks for your interest in Hydra! Do read the documentation of OmegaConf, it will help you understand what you can do with Hydra.

specifically for your question, you can specify required field with the string ??? (but really, go through the docs 😃 ).

1reaction
omrycommented, Jan 7, 2020

Look at the debugging section in the tutorial. What you want to use is the composition trace to understand how your config was actually composed.

Specific answer to your question: Config groups are mutually exclusive, there can be only one env. and that would be the last env, so prod. you want to put your scaffolding somewhere else, either in a different config group or in the default.yaml file itself (composition order will show you that it’s being composed before the rest of your config group, but after the hydra config groups, allowing you to override hydra from it, but also override it from your config groups.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marking Required Fields in Forms - Nielsen Norman Group
The solution is simple: mark all the required fields. Be as explicit and transparent as possible: for every single field that must be...
Read more >
How to make question a required field? - Jotform
It seems you want to make a question required field. You may like to take a look at the following guide which should...
Read more >
How to perform form validation for a required field in HTML
1. Required attribute: If you want to make an input mandatory to be entered by the user, you can use the required attribute....
Read more >
Required Field - Wufoo Help
When you make a field required, people must enter an answer to the field in order to submit their entry. When someone tries...
Read more >
How to make some fields mandatory in a questionnaire
creating a new field. Step 2: Choose a field type. · field types NutriAdmin · make this field required · example tick box...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found