Feature request: mark certain config keys as required
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 42
- Forks
- 11
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
Is it in scope for Donfig to mark certain config keys as required? My use case is one where I'd like to require a user to specify some keys as part of their local config (like how Git requires you to configure your user name and email).
Two potential APIs that would work for my use case:
- Insert a sentinel value into defaults
from donfig import Config, required # sentinel value
config = Config(
'my_lib',
defaults = [{
'user': {'name': required, 'name': required},
'foo': {'bar': None},
}]
)
- A separate constructor arg for required keys:
config = Config(
'my_lib',
defaults = [{
'user': {},
'foo': {'bar': None},
}],
required=['user.name', 'user.email']
)
I'd like to raise an error if a user required value is not found in any of the user configs (or environment variables) during setup of the Config class.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Config class constructor and its setup path, focusing on how defaults, user configs, and environment variables are loaded. Compare the two proposed required-key APIs and define how missing values should be detected and reported during setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100