simplistix / configurator

A Python library for handling configuration files.
https://configurator.readthedocs.io
MIT License
39 stars 6 forks source link

origin of data indication #9

Open RonnyPfannschmidt opened 2 years ago

RonnyPfannschmidt commented 2 years ago

sometimes when debugging merged configurations, its really helpful to be able to tell what file/line/source an element came from

for example, if a setting can be provided by cli, default settings file and optional settings file it would be a great help to tell

a) where the final setting came from b) if its a parsed file what line it was

cjw296 commented 2 years ago

Yes! This was very much something I wanted from the start, but it's hard :-)

cjw296 commented 2 years ago

So, one tricky thing... even if .data objects know their origin, how do we provide that information in such a way that downstream (for example: exceptions raised by validation with voluptous or pydantic) can sensibly make use of them?

Surfacing in both str and repr maybe be one way, but that feels a bit unclean. Thoughts?

RonnyPfannschmidt commented 2 years ago

unless those libraries provide a entrypint for this, its not something to be concerned with directly, a layer that adds the details to validation errors is a separate concern

the key is that the data is easily available for debugging values/their origin all the better if frameworks have standard ways to consume them, but we shouldnt shoehorn them