Skip to content

Is pipenv.core.inline_activate_virtual_environment() Supported as an API? #3089

@rgammans

Description

@rgammans

Issue description

Being able to activate you application virtual environment with just

import pipenv.core
pipenv.core.inline_activate_virtual_environment()

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.

Traceback (most recent call last):
  File "C:\python36\lib\site-packages\wfastcgi.py", line 791, in main
    env, handler = read_wsgi_handler(response.physical_path)
  File "C:\python36\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
    handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
  File "C:\python36\lib\site-packages\wfastcgi.py", line 600, in get_wsgi_handler
    handler = __import__(module_name, fromlist=[name_list[0][0]])
  File "c:\users\administrator\documents\website\CoolerMovement\CoolerMovement\wsgi2.py", line 4, in <module>
    import pipenv.core
  File "C:\python36\lib\site-packages\pipenv\__init__.py", line 23, in <module>
    from .cli import cli
  File "C:\python36\lib\site-packages\pipenv\cli\__init__.py", line 3, in <module>
    from .command import cli
  File "C:\python36\lib\site-packages\pipenv\cli\command.py", line 18, in <module>
    from .. import environments
  File "C:\python36\lib\site-packages\pipenv\environments.py", line 226, in <module>
    SESSION_IS_INTERACTIVE = bool(os.isatty(sys.stdout.fileno()))
io.UnsupportedOperation: fileno


$ 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:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.6',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.14393',
 'python_full_version': '3.6.6',
 'python_version': '3.6',
 'sys_platform': 'win32'}

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'):

[[source]]
verify_ssl = true
url = "https://pypi.org/simple"
name = "pypi"

[packages]
django = "*"
django-autocomplete-light = "*"
django-rest-auth = "*"
djangorestframework = "*"
django-filter = "*"

[dev-packages]

[requires]
python_version = "3.6"

Contents of Pipfile.lock ('C:\Users\Administrator\Documents\website\Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "f58428e831d95c883bb5a893384aab834ec55c1620e919896a499af9d08d1d56"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.5"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "django": {
            "hashes": [
                "sha256:acdcc1f61fdb0a0c82a1d3bf1879a414e7732ea894a7632af7f6d66ec7ab5bb3",
                "sha256:efbcad7ebb47daafbcead109b38a5bd519a3c3cd92c6ed0f691ff97fcdd16b45"
            ],
            "index": "pypi",
            "version": "==2.1.2"
        },
        "django-autocomplete-light": {
            "hashes": [
                "sha256:996cc62519a6e2e9cd1c26e57ddc5f14541209a93e62e83d7b3df3ba65c1f458"
            ],
            "index": "pypi",
            "version": "==3.3.2"
        },
        "django-filter": {
            "hashes": [
                "sha256:6f4e4bc1a11151178520567b50320e5c32f8edb552139d93ea3e30613b886f56",
                "sha256:86c3925020c27d072cdae7b828aaa5d165c2032a629abbe3c3a1be1edae61c58"
            ],
            "index": "pypi",
            "version": "==2.0.0"
        },
        "django-rest-auth": {
            "hashes": [
                "sha256:ad155a0ed1061b32e3e46c9b25686e397644fd6acfd35d5c03bc6b9d2fc6c82a"
            ],
            "index": "pypi",
            "version": "==0.9.3"
        },
        "djangorestframework": {
            "hashes": [
                "sha256:b6714c3e4b0f8d524f193c91ecf5f5450092c2145439ac2769711f7eba89a9d9",
                "sha256:c375e4f95a3a64fccac412e36fb42ba36881e52313ec021ef410b40f67cddca4"
            ],
            "index": "pypi",
            "version": "==3.8.2"
        },
        "pytz": {
            "hashes": [
                "sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053",
                "sha256:ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277"
            ],
            "version": "==2018.5"
        },
        "six": {
            "hashes": [
                "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
                "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
            ],
            "version": "==1.11.0"
        }
    },
    "develop": {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions