Skip to content
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

Integrate setting the prompt so that the user sees they are in a pixi shell #219

Closed
ruben-arts opened this issue Jul 14, 2023 · 5 comments
Closed
Assignees
Labels
🆘 help wanted Maintainers would like community input

Comments

@ruben-arts
Copy link
Contributor

ruben-arts commented Jul 14, 2023

When moving into a pixi shell it can be convenient to see that the shell is active.

[rarts@fedora test] $ pixi shell
(test) [rarts@fedora test] $ exit
[rarts@fedora test] $ 

NOTE: to get this to work you have to run pixi completion in your shells activation script, e.g. .bashrc or .zshrc. There are examples in the docs

Currently supported:

Shell Supported
Bash
Zsh
Fish
Xonsh
Powershell
CMD.exe
@kolibril13
Copy link

kolibril13 commented Aug 21, 2023

Yep, I totally agree with this, I think this is super useful! For me, this does not work in Zsh on an Mac M1, as can be seen in this screenshot.

image

Also, I'm wondering why it's possible to activate the shell with micromaba and conda, as can also be seen in the screenshot.
With that approach, I however get the full path (/Users/jan-hendrik/projects/trying-pixi/.pixi/env) , where it would be nice to only get the relative path (.pixi/env)

Made with

which python


pixi shell
which python
exit

conda activate .pixi/env
which python
conda deactivate

micromamba activate .pixi/env
which python
micromamba deactivate

@traversaro
Copy link
Contributor

traversaro commented Aug 23, 2023

Currently supported:
Shell Supported
Bash
Zsh
Fish ❌
Xonsh ❌
Powershell ❌
CMD.exe ❌

Just to understand, the feature is expected to work on bash/zsh with pixi 0.2.0 ? I am asking as it is not working for me on Bash/WSL2, so if it useful I can provide debug info.

@ruben-arts
Copy link
Contributor Author

ruben-arts commented Aug 23, 2023

Just to be sure I added a note in this issue, that you need to add the pixi completion to your rc files. Are you @traversaro @kolibril13 both running that resulting script before you run pixi shell ?

This is my result using v0.2.0:

[rarts@fedora test]$ pixi shell
(test) [rarts@fedora test]$ exit 
exit
[rarts@fedora test]$ 

@kolibril13 The fact that all tools can activate the environment is because we all implement the "conda spec" so its "just" a conda environment. pixi does nothing special to those environments. The magic is in the interaction with those environments. The default behaviour of the conda environments is to use the "name" or the path but since we don't store a global list of names for the environments we can't use the same logic that conda uses to get the name in the prompt.

@traversaro
Copy link
Contributor

Just to be sure I added a note in this issue, that you need to add the pixi completion to your rc files. Are you @traversaro @kolibril13 both running that resulting script before you run pixi shell ?

I was not, indeed after doing that the feature is working for me, thanks!

@ruben-arts
Copy link
Contributor Author

This has been fixed in #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆘 help wanted Maintainers would like community input
Projects
None yet
Development

No branches or pull requests

4 participants