PyprojectTomlConfigSettingsSource
or extend TomlConfigSettingsSource
#253
Labels
PyprojectTomlConfigSettingsSource
or extend TomlConfigSettingsSource
#253
I have a need to accept user provided settings from either a file or environment variable. I personally like to limit the number of root-level files in my projects so I would like to provide the ability for my users to do that as well by enabling the use of a
[tool.*]
table for specifying settings. Looking through the current implementation ofTomlConfigSettingsSource
, there does not appear to be an easy way to do this.I would like to propose one of two approaches to add this functionality as I am likely not the only one that would benefit from it:
TomlConfigSettingsSource
(and it's configuration) to enable specifying a table within the TOML file to load data from.PyprojectTomlConfigSettingsSource
(fromTomlConfigSettingsSource
) as it's own source with the functionality described above. Additionally, it could default to using thepyproject.toml
file in the current working directory (or parent directory if not found) by default, if the source is enabled. Rational behind trying the parent directory relates to another tool I use, poetry. However, it will go beyond just the direct parent.A case could also be made for both to be implemented - extending
TomlConfigSettingsSource
so that the table selection is more widely available andPyprojectTomlConfigSettingsSource
for some file discovery be default.I have a PoC of
PyprojectTomlConfigSettingsSource
that I am currently using. I'm open to contributing this if desired and the approach I took the way the maintainers would like to go. I'm just not starting there to conserve time.The text was updated successfully, but these errors were encountered: