cli: config: add support for --show-origin#5126
Conversation
Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. Fixes treeverse#5119
|
@mrstegeman hey! 👋 Thanks for the PR! I see that you set the docs checkbox, but I don't see any issues/PRs in the docs repo? Is it still WIP? |
Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. References treeverse/dvc#5119 References treeverse/dvc#5126
|
Ah, apologies. I was thinking it was just documentation in this repo. |
|
@mrstegeman no worries at all (the layout is not very usual indeed when you have a separate repo with docs). Thanks for the PR, we'll take a look asap!! Give us please a bit of time for this. |
There was a problem hiding this comment.
Hi @mrstegeman !
Thanks for the PR! 🙏 Looks good!
I totally forgot that we still didn't introduce --repo flag for dvc config and didn't switch to loading the merged config in dvc config without --repo/--local/--global/--system 🤦♂️ 🤦♂️ 🤦♂️ It is on our 2.0 todo list though. Which would make the task a bit harder :)
Yep, that was the biggest difference I noticed versus |
@mrstegeman Would you be willing to introduce the changes for that? Our master branch is currently preparing for 2.0, so we can do backward-incompatible changes without any problems. But we could merge this first and then think about the next step too, no problem. |
|
@efiop The two changes are really independent of each other, but should be done separately. It probably makes the most sense to just merge this as is, and then figure out the logic to merge and print all of the configs in a separate PR. I'd be happy to take on the other PR as well, after this is merged. |
|
For my own reference: 2.0 checklist |
efiop
left a comment
There was a problem hiding this comment.
@mrstegeman Sounds good!
Ok, this PR looks good, but we need to add a test that tests the output. Please see tests/func/test_config.py::test_config_remote for an example of using caplog.
| self.assertEqual(ret, 0) | ||
| self.assertTrue(self._contains(section, field, value, local)) | ||
|
|
||
| ret = main(base + [section_field, value, "--show-origin"]) |
There was a problem hiding this comment.
Can we parametrize these tests?
@efiop |
No, |
|
Apologies for the delay. I added a couple tests for the output. |
929e71d to
87155e7
Compare
|
@mrstegeman I've added --repo flag and changed dvc config behaviour in #5179 (we need it for the upcoming 2.0 soon anyway), but temporarily forbid the use of --show-origin without --system/--global/--repo/--local flag so you could continue your work on a proper implementation as we've discussed here before. Please feel free to send a PR for that 🙂 |
Builds on treeverse#5126 and treeverse#5184 by showing the full merged config when listing or getting config options. References treeverse#5126 References treeverse#5184 References treeverse/dvc.org#2028 Fixes treeverse#5119
Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. References treeverse/dvc#5119 References treeverse/dvc#5126
* cli: config: show merged config with --show-origin Builds on #5126 and #5184 by showing the full merged config when listing or getting config options. References #5126 References #5184 References treeverse/dvc.org#2028 Fixes #5119 * Add additional tests. * Add test for merged config. * config: rename methods Co-authored-by: OLOLO ALALA <ruslan@iterative.ai>
* cli: config: add docs for --show-origin Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. References treeverse/dvc#5119 References treeverse/dvc#5126 * Update wording. * Add note about the options near config file locations. * Update content/docs/command-reference/config.md Co-authored-by: Jorge Orpinel <jorgeorpinel@users.noreply.github.com>
Support the --show-origin option for config, which, similar to git,
prefixes each config option with the source file it originated from.
Fixes #5119
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏