pipenv powershell shell should label prompt when inside pipenv shell (similar to venv)
See original GitHub issuetl;dr pipenv shell
should label the powershell prompt when inside a shell. This is what venv
currently does. Something like(pipenv: project1-LQTIN6Io) PS C:\Users\user1\Projects\project1>
venv module
When using the venv
module and then entering the virtual environment shell, the shell prompt becomes labeled. Here’s an example in powershell:
PS C:\Users\user1\Projects\project1> C:\Python\Python37\python.exe -m venv .venv
PS C:\Users\user1\Projects\project1> .\.venv\Scripts\activate
(.venv) PS C:\Users\user1\Projects\project1>
I find the prepended label “(.venv)
” tremendously helpful. That prepended label is also colored green which is different than the remainder of the powershell prompt “PS C:\Users\user1\Projects>
” in light-gray. It’s easy to visually distinguish the green string “(.venv)
” was prepended to the default powershell prompt. I often have several powershell windows open. That prepended label helps me remember which powershell window is currently in a python virtual environment.
this pipenv enhancement follows venv module
This Enhancement is to recommend pipenv implement the same feature. I imagine this would look like
PS C:\Users\user1\Projects\project1> C:\Python\Python37\Scripts\pipenv.exe --python 3
Creating a virtualenv for this project…
Pipfile: C:\Users\user1\Projects\project1\Pipfile
Using C:/Python/Python37/python.exe (3.7.1) to create virtualenv…
[=== ] Creating virtual environment...Using base prefix 'C:\\Python\\Python37'
New python executable in C:\Users\user1\.virtualenvs\project1-LQTIN6Io\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter C:/Python/Python37/python.exe
Successfully created virtual environment!
Virtualenv location: C:\Users\user1\.virtualenvs\project1-LQTIN6Io
PS C:\Users\user1\Downloads\deleteme> C:\Python\Python37\Scripts\pipenv.exe shell
(pipenv: project1-LQTIN6Io) PS C:\Users\user1\Projects\project1>
Notice the prepended prompt string "(pipenv: project1-LQTIN6Io)
". Ideally, it would also be colorized different than the remaining prompt string.
This Issue is similar to pipenv Issue #40 (which addressed bash shell).
btw, after reading Pipenv: A Guide to the New Python Packaging Tool (realpython.com), I really want more pipenv!
Additional context
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: 'c:\\python\\python37\\lib\\site-packages\\pipenv'
Python location: 'c:\\python\\python37\\python.exe'
Python installations found:
3.7.1
:C:\Python\Python37\python.exe
3.6.7
:C:\Python\Python36\python.exe
3.4
:C:\Python\Python34\python.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.1',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'python_full_version': '3.7.1',
'python_version': '3.7',
'sys_platform': 'win32'}
Powershell version:
PS C:\Users\user1 > $PSVersionTable.PSVersion
Major Minor
----- -----
5 1
System environment variables:
- …
PIPENV_ACTIVE
PIP_DISABLE_PIP_VERSION_CHECK
PIP_PYTHON_PATH
- …
PROMPT
PSMODULEPATH
- …
PYTHONDONTWRITEBYTECODE
- …
VIRTUAL_ENV
- …
PIP_SHIMS_BASE_MODULE
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv?specific environment variables:
PIPENV_ACTIVE
:1
Debug?specific environment variables:
PATH
:...
VIRTUAL_ENV
:C:\Users\user1\.virtualenvs\foo-3kR5jZ-L
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:15 (3 by maintainers)
Top GitHub Comments
Here is what I use to get a specific prompt for each environment (faster than above as it does not run a command every time the prompt is evaluated):
See https://ss64.com/ps/syntax-prompt.html on how to update your configuration to include this.
Here is some refactoring of code above I used original ‘Activate.ps1’ file from venv package for reference