DUNE-DAQ / minidaqapp

0 stars 1 forks source link

Insinuate a schema between and matching the CLI and factor body. #84

Open brettviren opened 2 years ago

brettviren commented 2 years ago

The CLI should work identically as before and is tested by making before/after json_dir output and doing a diff.

This work is to demonstrate how to refactor such a CLI to gain a the schema validation and provide a schema-protected general Pyhton API to yet higher order generators.

The refactoring goes like:

So we have CLI->gen()->validate()->body().

With this refactoring we gain a schema contract for this generator and an API (the .gen() method) which may be called by other code w/out detailed understanding of the arguments, as long as a schema-valid object/dict is provided.

brettviren commented 2 years ago

This is actually against dunedaq-v2.8.0 branch as that release environment is already broken for using this package on develop.

One thing that needs changing as this introduces a new schema .jsonnet file into the Python source area. For C++ packages it would go under the usual schema/ but this may be the first use of one in a Python package. The moo.otypes seems to find it fine.

This is meant as a proof of principle. If it looks good to everyone, let's merge. But I can imagine some discussion will be needed.