-
Notifications
You must be signed in to change notification settings - Fork 1.2k
cli: config: add support for --show-origin #5126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. Fixes iterative#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 iterative/dvc#5119 References iterative/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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
@@ -48,9 +48,15 @@ def _do_test(self, local=False): | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we parametrize these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are being reworked in #5179.
@efiop |
No, |
Apologies for the delay. I added a couple tests for the output. |
929e71d
to
87155e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@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 iterative#5126 and iterative#5184 by showing the full merged config when listing or getting config options. References iterative#5126 References iterative#5184 References iterative/dvc.org#2028 Fixes iterative#5119
Support the --show-origin option for config, which, similar to git, prefixes each config option with the source file it originated from. References iterative/dvc#5119 References iterative/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 iterative/dvc.org#2028 Fixes #5119 * Add additional tests. * Add test for merged config. * config: rename methods Co-authored-by: OLOLO ALALA <[email protected]>
* 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 iterative/dvc#5119 References iterative/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 <[email protected]>
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. 🙏