Repository navigation
Add #key.path selector to config file paths, e.g. pyproject.toml#tool.myapp - #1022
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1022 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 9886 9926 +40
=========================================
+ Hits 9886 9926 +40 ☔ View full report in Codecov by Harness. |
[Medium impact] The change affects config loading across the library's explicit and default config workflows. Fix the false loop error for different sections of the same file before merging. Findings
SummaryAdds
The author, mauvilsa, explicitly preserves existing hash-containing filenames ahead of selector parsing.
|
|



What does this PR do?
Config file paths can now end in
#followed by a dot separated key, e.g.pyproject.toml#tool.myapporpackage.json#myapp, so that only that part of the file gets parsed. This is useful for config files shared with other tools. The selector works indefault_config_files, with the config argument (--config) and withArgumentParser.parse_path.#, and only when the full value is not a path to an existing file but the part before the#is. Files with#in their name keep working as before.__default_config__, error messages and value provenance. Line numbers in provenance are still found for values inside the selected key.Combined with the
extension_or_*parser modes from #1021, an app can read bothpyproject.tomland its own YAML file, e.g.default_config_files=['pyproject.toml#tool.myapp', '.myapp.yaml'].Before submitting