gforsyth / xonda

DEPRECATED: (previously a thin wrapper around conda for xonsh)
BSD 3-Clause "New" or "Revised" License
11 stars 9 forks source link

Alias for conda deactivate in .xonshrc not working #15

Closed HenningTimm closed 5 years ago

HenningTimm commented 7 years ago

In my .xonshrc I define two aliases, because I am too lazy to type out conda (de)activate:

# file: .xonshrc
# conda
aliases["csa"] = "conda activate"
aliases["csd"] = "conda deactivate"

The first alias is working fine and I can activate environments like this:

$ csa myenv
(myenv) $

However, when I want to exit the environment using my alias, the unwrapped conda is used and I get an error. Using the same command (but not as an alias) works:

(myenv) $ csd
CommandNotFoundError: 'deactivate is not a conda command.
Did you mean 'source deactivate'?
(myenv) $ aliases["csd"]
['conda', 'deactivate']
(myenv) $ conda deactivate
$ 

Any idea what is going wrong here?

gforsyth commented 7 years ago

Hey @HenningTimm -- thanks for reporting! Sorry for the delay, I was traveling and am catching up on email. I really don't understand what's going on here, hopefully sleeping on it will provide some clarity. I would definitely understand if neither of your aliases worked, but having one work and the other fail is very, very weird.

gforsyth commented 7 years ago

For a workaround, you can do the following:

from xontrib.xonda import _deactivate
aliases['csd'] = _deactivate
HenningTimm commented 7 years ago

@gforsyth Thank you for the reply. The workaround is working fine. As far as I am concerned, you can assign a very low priority to this when catching up.