[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Abdur-Rahmaan Janhangeer
@Christopher Barker You nailed it! I've used the conda activate command many times. It should in theory be possible in Python @Chris Angelico Yes mere shell commands passing via Py does not work, maybe a file way with results in current shell as @M.-A. Lemburg points out, venv already genera

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Christopher Barker
I know nothing of the details, but I think the goal is to have the same command work (almost) everywhere, yes? That does not need to be a python script, however. In fact, it's nice if activating an environment is as fast as possible so firing up Python to do it is less than ideal. Anyway -- I'd e

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread M.-A. Lemburg
On 04.01.2021 15:45, Chris Angelico wrote: > On Tue, Jan 5, 2021 at 1:42 AM Abdur-Rahmaan Janhangeer > wrote: >> >> Greetings list, >> >> put simply, >> >> be able to use >> >> $ python -m venv venv_name activate >> >> To activate an env instead of having each platform have a way of >> handling it

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Chris Angelico
On Tue, Jan 5, 2021 at 2:37 AM Abdur-Rahmaan Janhangeer wrote: > > You just execute the appropriate shell commands via Python Try it. It won't work. See previous posts. ChrisA ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Abdur-Rahmaan Janhangeer
You just execute the appropriate shell commands via Python Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius On Mon, Jan 4, 2021 at 7:34 PM Chris Angelico wrote: > On Tu

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Chris Angelico
On Tue, Jan 5, 2021 at 2:29 AM Abdur-Rahmaan Janhangeer wrote: > > Unfortunately, that wouldn't work. Activating a virtual environment > means setting some env vars in the current shell, and Python is > fundamentally unable to do that - it can only be done within the shell > itself (by sourcing a

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Abdur-Rahmaan Janhangeer
Errata: subprocess(['os', 'stuff', ...]) Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius ___ Python-ideas mailing list -- pytho

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Abdur-Rahmaan Janhangeer
Unfortunately, that wouldn't work. Activating a virtual environment means setting some env vars in the current shell, and Python is fundamentally unable to do that - it can only be done within the shell itself (by sourcing a script). You can, of course, simply run the Python executable from that v

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Chris Angelico
On Tue, Jan 5, 2021 at 1:52 AM Calvin Spealman wrote: > > > > On Mon, Jan 4, 2021 at 9:47 AM Chris Angelico wrote: >> >> On Tue, Jan 5, 2021 at 1:42 AM Abdur-Rahmaan Janhangeer >> wrote: >> > >> > Greetings list, >> > >> > put simply, >> > >> > be able to use >> > >> > $ python -m venv venv_name

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Stestagg
On Mon, Jan 4, 2021 at 2:53 PM Calvin Spealman wrote: > > This is true, but... > it might be possible to include something more like pipenv's "shell" which > spawns a new instance of your shell with the right paths. It effectively > achieves the same goal, without needing to source, > > > There i

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Valentin Berlier
To get around the fact that activating a virtualenv requires setting environment variables in the current shell poetry has a shell command that simply spawns a new shell with the appropriate environment variables: https://python-poetry.org/docs/cli/#shell So a cross-platform `activate` command

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Calvin Spealman
On Mon, Jan 4, 2021 at 9:47 AM Chris Angelico wrote: > On Tue, Jan 5, 2021 at 1:42 AM Abdur-Rahmaan Janhangeer > wrote: > > > > Greetings list, > > > > put simply, > > > > be able to use > > > > $ python -m venv venv_name activate > > > > To activate an env instead of having each platform have a

[Python-ideas] Re: Add venv activate command to the venv modules

2021-01-04 Thread Chris Angelico
On Tue, Jan 5, 2021 at 1:42 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings list, > > put simply, > > be able to use > > $ python -m venv venv_name activate > > To activate an env instead of having each platform have a way of > handling it > Unfortunately, that wouldn't work. Activating a virtua