Skip to content

Add --yes support to self remove and self update subcommands#108

Merged
jezdez merged 1 commit intomainfrom
fix/self-remove-update-yes-flag
Mar 4, 2026
Merged

Add --yes support to self remove and self update subcommands#108
jezdez merged 1 commit intomainfrom
fix/self-remove-update-yes-flag

Conversation

@jezdez
Copy link
Member

@jezdez jezdez commented Mar 4, 2026

Summary

Fixes #107.

  • conda self remove: Was hardcoding yes=False when spawning conda remove, causing an interactive prompt that hangs in non-interactive contexts. Now uses confirm_yn() in-process (matching the self reset pattern), then always passes --yes to the subprocess.
  • conda self update: install_package_list_in_protected_env ran conda install without --yes. Now accepts and passes through context.always_yes. Also removed a duplicate --dry-run flag that would conflict with the one from add_output_and_prompt_options.
  • Both subcommands now use add_output_and_prompt_options consistently, gaining --yes, --dry-run, --json, and --quiet flags.

Test plan

  • test_remove_protected_plugin — protected specs still raise SpecsCanNotBeRemoved
  • test_remove_unprotected_plugin_passes_validation — non-protected specs pass validation with --yes
  • test_remove_nonessential_plugin — end-to-end remove in a tmp env (previously hung locally)
  • test_update_conda / test_update_plugin / test_update_all — update tests still pass with --dry-run
  • test_reset_migrate — reset test using self update --yes no longer hangs

`conda self remove` hardcoded `yes=False` when spawning `conda remove`
in a subprocess, causing an interactive confirmation prompt that hangs
in non-interactive contexts (tests, CI with a tty, etc.).

Fix by adding `add_output_and_prompt_options` to both `self remove` and
`self update` parsers, which registers `--yes`, `--dry-run`, `--json`,
and `--quiet` flags consistently with other subcommands like `self reset`.

For `self remove`, the confirmation is now handled in-process via
`confirm_yn()` (matching the `self reset` pattern), and the subprocess
always runs with `--yes` once the user has confirmed.

For `self update`, the duplicate `--dry-run` argument is removed (now
provided by `add_output_and_prompt_options`) and `context.always_yes`
is passed through to `install_package_list_in_protected_env`.
@jezdez jezdez changed the title Add --yes support to self remove and self update subcommands Add --yes support to self remove and self update subcommands Mar 4, 2026
@jezdez jezdez requested a review from marcoesters March 4, 2026 11:32
@jezdez
Copy link
Member Author

jezdez commented Mar 4, 2026

Merging this myself since it's blocking the tests locally right now

@jezdez jezdez merged commit c6f43e2 into main Mar 4, 2026
23 checks passed
@jezdez jezdez deleted the fix/self-remove-update-yes-flag branch March 4, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

conda self remove and conda self update hang in non-interactive contexts

1 participant