8451 / 8451/labrea

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

未关闭
#14 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
17
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

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'
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。