arche icon indicating copy to clipboard operation
arche copied to clipboard

Allow to set parameteres like threshold

Open manycoding opened this issue 5 years ago • 5 comments

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()

manycoding avatar Jun 05 '19 16:06 manycoding

It can be:

  1. A config
  2. Parameters from top-level - arche.report_all(threshold=0.2)
  3. Environment variables - in a notebook
%env THRESHOLD=0.2
...
arche.report_all()

manycoding avatar Jun 06 '19 17:06 manycoding

@ejulio Any comments or ideas?

manycoding avatar Jun 06 '19 17:06 manycoding

@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 avatar Jun 17 '19 12:06 ejulio

@ejulio Do you think these threshold should be treated equally or be separated?

  1. Coverage diff between jobs (currently 0.1 for errors and 0.05 for warnings)
  2. Category diff between jobs (0.2, 0.1)
  3. Boolean diff between jobs (0.1, 0.05)

manycoding avatar Jun 17 '19 17:06 manycoding

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

ejulio avatar Jun 18 '19 11:06 ejulio