qiime2 / provenance-lib

QIIME 2 Provenance Replay Tools
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Make EmptyParser a ParserResultsParser? #34

Open ChrisKeefe opened 2 years ago

ChrisKeefe commented 2 years ago

Empty ProvDAGs aren't very useful. Maybe we should refac this as a ParserResults parser. This would mean tools like Union that are basically constructing ParserResults "manually" don't need to create an empty ProvDAG and then overwrite its fields. Instead, they create a ParserResults and once the data's there, they throw it at ProvDAG().

In favor

By requiring tools to actually write ParserResults, we ensure they create all required data, and mypy can check it's correctly typed. This approach may be slightly more efficient, too.

I also don't love that passing no args to ProvDAG is possible, because it seems to encourage this somewhat useless behavior.

Against

The "create an empty object and populate it" idiom is common and familiar... :shrug: