Redesign --sync as optional-value option (ask/do) for download and upload#1835
Open
yarikoptic-gitmate wants to merge 2 commits intomasterfrom
Open
Redesign --sync as optional-value option (ask/do) for download and upload#1835yarikoptic-gitmate wants to merge 2 commits intomasterfrom
yarikoptic-gitmate wants to merge 2 commits intomasterfrom
Conversation
When using `dandi download --sync`, the CLI prompts for confirmation before deleting local assets not found on the server. This fails in headless environments (CI/CD, cron jobs) where no interactive terminal is available. The new `--yes` / `-y` flag auto-confirms such prompts. Closes #1833 https://claude.ai/code/session_01297X1VGdztFArkpVFB1zEk
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1835 +/- ##
===========================================
- Coverage 76.27% 51.57% -24.70%
===========================================
Files 87 87
Lines 12484 12517 +33
===========================================
- Hits 9522 6456 -3066
- Misses 2962 6061 +3099
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…load Instead of a separate --yes flag, make --sync itself accept an optional value: 'ask' (default when --sync is passed bare, preserving backward compatibility) prompts before deleting, while 'do' deletes without prompting. This applies to both `dandi download --sync` and `dandi upload --sync`, keeping the control co-located with the feature. Usage: dandi download --sync ... # prompts (same as before) dandi download --sync ask ... # prompts (explicit) dandi download --sync do ... # no prompt, headless-friendly The Python API still accepts bool for backward compatibility (True is normalized to SyncMode.ASK). Closes #1833 https://claude.ai/code/session_01297X1VGdztFArkpVFB1zEk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--syncfrom a boolean flag to an optional-value option acceptingaskordo, on bothdandi downloadanddandi upload--syncalone (bare flag) defaults toask— preserving full backward compatibility--sync doskips the interactive prompt and proceeds with deletion, enabling headless usage (CI/CD, cron jobs)SyncModeenum inconsts.pyshared between download and uploadboolfor backward compatibility (Truenormalizes toSyncMode.ASK)Usage
Closes #1833
Changes
dandi/consts.py: AddedSyncModeenum (ask,do)dandi/cli/cmd_download.py: Changed--syncfromis_flag=Trueto optional-value withflag_value="ask"andtype=Choice(["ask", "do"]); removed the separate--yesflag from the prior commitdandi/cli/cmd_upload.py: Same--syncredesign as downloaddandi/download.py: Changedsyncparameter type tobool | SyncMode | None; whenSyncMode.DO, skipsabbrev_promptdandi/upload.py: Changedsyncparameter type tobool | SyncMode | None; whenSyncMode.DO, skipsclick.confirmdandi/tests/test_download.py: Addedtest_download_sync_doverifying prompt is skippeddandi/tests/test_upload.py: Addedtest_upload_sync_doverifying prompt is skippedTest plan
--syncwith no value,--sync ask,--sync do,--sync=doall accepted by CLI--yesflag removed from downloadSyncModeenum logic verified (truthiness, normalization from bool)test_download_sync_doandtest_upload_sync_doverify prompt-free deletionhttps://claude.ai/code/session_01297X1VGdztFArkpVFB1zEk