dvc
dvc copied to clipboard
parsing: Use double quotes for str interpolation in dict unpacking.
Single quote was causing issues on windows.
Closes #8203
There is a possibility that paths in windows that end with a backslash could cause issues (since paths in windows use backslashes instead of forward slashes). However, it's hard for me to imagine a case where someone cannot just remove the backslash slash at the end without changing functionality. Worth thinking about whether it's worth handling at least.
Also you may want try running this on a windows machine (I can if you don't have one and dvc isn't tested with one). Windows should actually be able to handle single quotes, it's odd that when DVC uses them, they don't get handled. It's possible that simply changing the quote type will just change the extra quotes in the parsed strings, not actually get rid of them.
Also you may want try running this on a windows machine (I can if you don't have one and dvc isn't tested with one). Windows should actually be able to handle single quotes, i
The CI also runs on windows. I added a regression test:
https://github.com/iterative/dvc/blob/26a5f542929227bef8da6fe1d70194ff5387f0ca/tests/func/parsing/test_interpolated_entry.py#L322-L352
The test breaks (argparse fails to parse, only on windows) with single quotes, and passes after this P.R. (using double quotes).
t's odd that when DVC uses them, they don't get handled. It's possible that simply changing the quote type will just change the extra quotes in the parsed strings, not actually get rid of them.
There are some nuances between argparse, windows, and the shell used to invoke the command (which can vary across users, see subprocess.Popen with shell=True on windows) so it's not that simple to anticipate/test all cases but after simple research looks like we just have to avoid single quotes in the cmd.
@abhmul Can you confirm if this P.R. fixes your issue?
@abhmul Can you confirm if this P.R. fixes your issue?
Just checked, it worked!
@daavoo What's the status of this?
@daavoo What's the status of this?
It fixes the issues but I need to address https://github.com/iterative/dvc/pull/8204#discussion_r991797547
Codecov Report
Base: 94.30% // Head: 94.34% // Increases project coverage by +0.03% :tada:
Coverage data is based on head (
08a643e) compared to base (ba2e8bd). Patch has no changes to coverable lines.
:exclamation: Current head 08a643e differs from pull request most recent head f2d3e1f. Consider uploading reports for the commit f2d3e1f to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #8204 +/- ##
==========================================
+ Coverage 94.30% 94.34% +0.03%
==========================================
Files 430 432 +2
Lines 32893 33436 +543
Branches 4602 4648 +46
==========================================
+ Hits 31021 31544 +523
- Misses 1450 1471 +21
+ Partials 422 421 -1
| Impacted Files | Coverage Δ | |
|---|---|---|
| dvc/commands/experiments/ls.py | 75.86% <0.00%> (-20.92%) |
:arrow_down: |
| tests/func/experiments/test_queue.py | 87.09% <0.00%> (-12.91%) |
:arrow_down: |
| dvc/repo/experiments/run.py | 94.87% <0.00%> (-2.69%) |
:arrow_down: |
| dvc/repo/experiments/queue/celery.py | 84.68% <0.00%> (-2.58%) |
:arrow_down: |
| dvc/repo/index.py | 92.69% <0.00%> (-2.40%) |
:arrow_down: |
| tests/unit/remote/test_base.py | 91.17% <0.00%> (-1.25%) |
:arrow_down: |
| dvc/stage/utils.py | 95.41% <0.00%> (-1.22%) |
:arrow_down: |
| dvc/repo/experiments/executor/base.py | 82.01% <0.00%> (-1.09%) |
:arrow_down: |
| dvc/repo/metrics/show.py | 93.97% <0.00%> (-0.90%) |
:arrow_down: |
| tests/func/test_repro_multistage.py | 99.18% <0.00%> (-0.82%) |
:arrow_down: |
| ... and 64 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.