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

Add vox enter command #5

Open
AstraLuma opened this issue Oct 17, 2016 · 9 comments
Open

Add vox enter command #5

AstraLuma opened this issue Oct 17, 2016 · 9 comments

Comments

@AstraLuma
Copy link
Member

AstraLuma commented Oct 17, 2016

Basically, a magic command that will apply the named venv to the prompt, or create a new prompt in the venv, without having to install xonsh & xontribs into the venv.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@AstraLuma AstraLuma added the help wanted Extra attention is needed label Oct 17, 2016
@AstraLuma
Copy link
Member Author

Hm. Could be done with caching state (sys.path and $PATH) and using site.addsitedir().

@ghost
Copy link

ghost commented Oct 17, 2016

note: vox has an 'enter' command which is an alias of activate.

@Granitosaurus
Copy link

@astronouth7303 Could you elaborate a bit more of what you mean? {env_name} in $PROMPT is already there. Do you mean a feature that would allow setting an unique $PROMPT for every virtual env?

I use something like this with xonsh-autoxsh

~ $ cd ~/test
~/test $ echo "$PROMPT = 'foobar $'" > .autoxsh
~/test $ cd .
Unauthorized ".autoxsh" file found in this directory. Authorize and invoke? (y/n/ignore): y
foobar $ echo "prompt was changed!"

Since it's usually a good idea to use a new virtualenvironment for every project this snipped kinda serves the same purpose.

@AstraLuma
Copy link
Member Author

I mean applying a virtual environment to your xonsh session.

Or maybe spawning a xonsh shell in the environment?

Either way, it involves crossing environments and other weirdness, so it's certainly non-trivial.

@jnoortheen
Copy link
Member

@AstraLuma vox activate already applies virtual environment to the current xonsh session. perhaps you want to spawn a new shell session with the env variable applied, like pew does?

@AstraLuma
Copy link
Member Author

No, the python contents, not just the commands.

@jnoortheen
Copy link
Member

No, the python contents, not just the commands.

could you elaborate on this? I still don't get it.

@AstraLuma
Copy link
Member Author

Add the python environment of the venv to xonsh's python environment.

So you have a repl kinda matching the project you're working on.

@jnoortheen
Copy link
Member

That can be done by adding site-packages to the PYTHONPATH of the xonsh's venv. I think it should be a separate xontrib than vox itself. It just manages the virtualenv, and to facilitate imports from the current env, seems a different thing.

@anki-code anki-code removed the help wanted Extra attention is needed label Aug 3, 2022
@anki-code anki-code transferred this issue from xonsh/xonsh Feb 14, 2023
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

No branches or pull requests

4 participants