8451 / 8451/labrea

Similar logic to `.explain()`, create a function to show unneeded options or missing options

Aperta
#14 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
17
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Similar to `explain` create a function to show unneeded options or missing options. For example, consider a large application with many options and datasets, one of which is below.
```
@dataset
def foo(
region = Option("APPLICATION.REGION", "North")
):
...
```

A user may mistakenly add an option to their options dictionary with a small typo, such as `{"APPLICATION": {"REGIONS": "South"}}`, mistaking `"REGION"` for `"REGIONS"`. The application would still run without error because the option has a default value, but it would run with a wrong value, and the user might not catch the mistake.

A function that would show the user what options are missing from the config and what options are not used (because they are entered incorrectly) would help validate options dictionaries. For example:

```
options = {"APPLICATION": {"REGIONS": "South"}}
validate(foo, options)

# Missing options: 'APPLICATION.REGION'
# Unused options: 'APPLICATION.REGIONS'
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Look at the existing `.explain()` function to understand how options are introspected. The new `validate` function needs to compare declared options in dataset definitions (like `foo`) against a provided options dictionary. Identify where option metadata is stored and how to traverse the dataset's parameter defaults. Check for existing tests around options or explanation to see the patterns. 'Done' means the function returns lists of missing and unused option paths.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
50/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.