-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Is pipenv.core.inline_activate_virtual_environment() Supported as an API? #3089
Comments
No. Pipenv is intended to only be used as an application, nothing in it is supported as Python API. |
For the general request of re-using Pipenv code, I feel it is out of the scope at the moment. A better approach would be to directly invoke the virtual environment. Virtual environment activation is actually a fairly well-documented and standard behaviour; you can confidently just copy what |
The thing is I'm struggling to find a way of discovering the path the virtual environment ( Can't even get Popen working - which might be a Cpython bug.) |
@rgammans there is no bug in cpython as far as I'm aware, but if you want the path you can set import os
pipfile_path = "/path/to/Pipfile"
os.environ["PIPENV_PIPFILE"] = pipfile_path
start_dir = os.path.abspath(os.curdir)
os.chdir(os.path.dirname(pipfile_path))
from pipenv.project import Project
project = Project(chdir=False)
venv_path = project.virtualenv_location
os.chdir(start_dir) |
So 'import pipenv.core' or 'import pipenv.project' should not throw an exception ? Becuase that was my original problem. |
Issue description
Being able to activate you application virtual environment with just
In you applications start script would be be useful feature, is it was long term supported; or a similiar
api publiccally exposed . Currently it is available but not documented. (as far as I can tell)
Expected result
I'd would expect pipenv.core.inline_activate_virtual_environment to have a non-empty docstring.,
and to silently activate the environment in all cases.
Actual result
Under windows; and when running in a IIS FastCgi module; importing pipenv.core fails to loas
asthe expression to evaluate SESSION_INTERACTIVE fails, as in the case sys.stderr, and sys.stdout have don't support getting the fileno attribute.
$ pipenv --support
Pipenv version:
'2018.10.13'
Pipenv location:
'c:\\python36\\lib\\site-packages\\pipenv'
Python location:
'c:\\python36\\python.exe'
Python installations found:
3.6.6
:C:\Python36\python.exe
PEP 508 Information:
System environment variables:
ALLUSERSPROFILE
APPDATA
CHOCOLATEYINSTALL
CHOCOLATEYLASTPATHUPDATE
COMMONPROGRAMFILES
COMMONPROGRAMFILES(X86)
COMMONPROGRAMW6432
COMPUTERNAME
COMSPEC
HOMEDRIVE
HOMEPATH
LOCALAPPDATA
LOGONSERVER
NUMBER_OF_PROCESSORS
OS
PATH
PATHEXT
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
PROGRAMDATA
PROGRAMFILES
PROGRAMFILES(X86)
PROGRAMW6432
PSMODULEPATH
PUBLIC
SESSIONNAME
SYSTEMDRIVE
SYSTEMROOT
TEMP
TMP
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE
USERNAME
USERPROFILE
WINDIR
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
Pipenvûspecific environment variables:
Debugûspecific environment variables:
PATH
:C:\Python36\Scripts\;C:\Python36\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
Contents of
Pipfile
('C:\Users\Administrator\Documents\website\Pipfile'):Contents of
Pipfile.lock
('C:\Users\Administrator\Documents\website\Pipfile.lock'):The text was updated successfully, but these errors were encountered: