-
Notifications
You must be signed in to change notification settings - Fork 1.8k
resolve #4274 add option to remove an existing environment with 'conda create' #7133
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
3b9aeff
to
d1f6b40
Compare
conda/cli/common.py
Outdated
@@ -4,6 +4,7 @@ | |||
import re | |||
import sys | |||
|
|||
from conda.common.constants import NULL |
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.
TODO: before merge, fix this import
I'm interested to have feedback on this workflow. In the original commit, I had a command flag and configuration parameter for |
if is_conda_environment(context.target_prefix): | ||
if paths_equal(context.target_prefix, context.root_prefix): | ||
raise CondaValueError("The target prefix is the base prefix. Aborting.") | ||
confirm_yn("WARNING: A conda environment already exists at '%s'\n" |
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.
TODO: Incorporate conda.common.io.timeout
into the confirm_yn()
function before this PR is merged.
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.
Done.
03b29be
to
318e0fd
Compare
The original issue suggested using --force to provide this behavior. Is force not the right "concept" so the additional new flag can be avoided? |
I originally had a I'll demo it next Wednesday and see what other people think. |
Ok, now I am confused, so now there is no extra flag, and only |
Oops that's wrong. No wonder you were confused. I'll fix that. There's no The flow in this PR is that if you do |
Signed-off-by: Kale Franz <kfranz@continuum.io>
conda/cli/common.py
Outdated
from ..exceptions import DryRunExit | ||
raise DryRunExit() | ||
if context.always_yes: | ||
return True | ||
try: | ||
choice = confirm(message=message, choices=('yes', 'no'), | ||
choice = timeout(30, confirm, message=message, choices=('yes', 'no'), |
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 timeout should be configurable and, I guess, infinite on default for now.
It could be helpful to prevent complete stalling in unattended execution. But other times it could be annoying:
Even though conda >=4.4
has a considerably faster solving phase, there still might be situations where a user isn't actively waiting and the "grab-a-coffee-time" might exceed 30 seconds 😉.
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.
I'm starting to become sensitive to configuration parameter fatigue. This is trivial enough that I'd rather not even use the timeout wrapper here then if we think it's something that needs to be configurable.
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.
I'm starting to become sensitive to configuration parameter fatigue.
Understandable. At some point this becomes nightmare fuel 😨
Signed-off-by: Kale Franz <kfranz@continuum.io>
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.
Ok, looks better now :-)
Hi there, thank you for your contribution to Conda! This pull request has been automatically locked since it has not had recent activity after it was closed. Please open a new issue or pull request if needed. |
resolves #4274
This PR also introduces one new capability. The
conda create
command has learned a--remove-existing
flag, that'll remove an existing conda environment at the target location if one already exists (rather than throwing an error).