arche
arche copied to clipboard
Allow to set parameteres like threshold
A reloadable config or passing arguments is needed, so anybody can set report_all()
at once:
E.g. we have threshold
for coverage diff, which defaults to 0.2, so the config might look like:
config = Config()
config.threshold = 0.1
Arche(source, target, config).report_all()
It can be:
- A config
- Parameters from top-level -
arche.report_all(threshold=0.2)
- Environment variables - in a notebook
%env THRESHOLD=0.2
...
arche.report_all()
@ejulio Any comments or ideas?
@manycoding , my idea here is, if it is only a config for report_all
, then it would be better to set it only in report_all
.
Since most of the time arche runs in jupyter notebooks, I don't think an environment variable is a good choice, at least at first.
So, my idea of an API would be
a = Arche(source, target)
a.report_all(
threshold=0.2
)
# or
a.report_all({
"threshold": 0.2
})
Both are fine and can be accomplished by **kwargs
or **config
(to use a better name)
@ejulio Do you think these threshold should be treated equally or be separated?
- Coverage diff between jobs (currently 0.1 for errors and 0.05 for warnings)
- Category diff between jobs (0.2, 0.1)
- Boolean diff between jobs (0.1, 0.05)
IMHO, they should be different. I might accept a diff of 0.3 in categories but only 0.05 for coverage for example. So
a = Arche(source, target)
a.report_all(
coverage_threshold=(0.1, 0.05),
category_threshold=(0.3, 0.1)
)
Though I'm not sure about tuples
in the example above.
I don't know what the numbers mean and their use cases unless I read the docs/underlying code.
Maybe NamedTuples
or a simple data class.
@dataclass
class ReportThreshold:
error_threshold: float
warning_threshold: float