From 198e618ebc96c273c64b5eb5dfda2bc2857276c8 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sat, 16 Jun 2018 20:59:32 +0800 Subject: [PATCH 01/23] Implement our own subshell logic To replace Pew's "workon" command. New code built on Shellingham. This also fixes a few additional minor bugs, e.g. Cmder not launching Powershell when it should. --- pipenv/_compat.py | 5 + pipenv/core.py | 128 ++++---------------- pipenv/environments.py | 1 + pipenv/shells.py | 197 ++++++++++++++++++++++++++++++- tests/integration/test_pipenv.py | 11 -- 5 files changed, 221 insertions(+), 121 deletions(-) diff --git a/pipenv/_compat.py b/pipenv/_compat.py index 68d8069d5e..adb705c470 100644 --- a/pipenv/_compat.py +++ b/pipenv/_compat.py @@ -34,6 +34,11 @@ def _infer_return_type(*args): except ImportError: from pathlib2 import Path +# Backport required for earlier versions of Python. +if sys.version_info < (3, 3): + from .vendor.backports.shutil_get_terminal_size import get_terminal_size +else: + from shutil import get_terminal_size try: from weakref import finalize diff --git a/pipenv/core.py b/pipenv/core.py index 6fe230c8a1..67922a956b 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -79,11 +79,6 @@ PIPENV_CACHE_DIR, ) -# Backport required for earlier versions of Python. -if sys.version_info < (3, 3): - from .vendor.backports.shutil_get_terminal_size import get_terminal_size -else: - from shutil import get_terminal_size # Packages that should be ignored later. BAD_PACKAGES = ('setuptools', 'pip', 'wheel', 'packaging', 'distribute') # Are we using the default Python? @@ -1166,29 +1161,6 @@ def do_lock( return lockfile -def activate_virtualenv(source=True): - """Returns the string to activate a virtualenv.""" - # Suffix and source command for other shells. - suffix = '' - command = ' .' if source else '' - # Support for fish shell. - if PIPENV_SHELL and 'fish' in PIPENV_SHELL: - suffix = '.fish' - command = 'source' - # Support for csh shell. - if PIPENV_SHELL and 'csh' in PIPENV_SHELL: - suffix = '.csh' - command = 'source' - # Escape any spaces located within the virtualenv path to allow - # for proper activation. - venv_location = project.virtualenv_location.replace(' ', r'\ ') - if source: - return '{2} {0}/bin/activate{1}'.format(venv_location, suffix, command) - - else: - return '{0}/bin/activate'.format(venv_location) - - def do_purge(bare=False, downloads=False, allow_global=False, verbose=False): """Executes the purge functionality.""" if downloads: @@ -2167,93 +2139,37 @@ def do_uninstall( def do_shell(three=None, python=False, fancy=False, shell_args=None): - from .patched.pew import pew - # Ensure that virtualenv is available. ensure_project(three=three, python=python, validate=False) # Set an environment variable, so we know we're in the environment. os.environ['PIPENV_ACTIVE'] = '1' - compat = (not fancy) # Support shell compatibility mode. if PIPENV_SHELL_FANCY: - compat = False - # Compatibility mode: - if compat: - if PIPENV_SHELL: - shell = os.path.abspath(PIPENV_SHELL) - else: - click.echo( - crayons.red( - 'Please ensure that the {0} environment variable ' - 'is set before activating shell.'.format( - crayons.normal('SHELL', bold=True) - ) - ), - err=True, - ) - sys.exit(1) + fancy = True + + from .shells import choose_shell + shell = choose_shell() + click.echo("Launching subshell in virtual environment…", err=True) + + fork_args = ( + project.virtualenv_location, + project.project_directory, + shell_args, + ) + + if fancy: + shell.fork(*fork_args) + return + + try: + shell.fork_compat(*fork_args) + except (AttributeError, ImportError): click.echo( - crayons.normal( - 'Spawning environment shell ({0}). Use {1} to leave.'.format( - crayons.red(shell), crayons.normal("'exit'", bold=True) - ), - bold=True, - ), + u'Compatibility mode not supported. ' + u'Trying to continue as well-configured shell…', err=True, ) - cmd = "{0} -i'".format(shell) - args = [] - # Standard (properly configured shell) mode: - else: - if project.is_venv_in_project(): - # use .venv as the target virtualenv name - workon_name = '.venv' - else: - workon_name = project.virtualenv_name - cmd = sys.executable - args = ['-m', 'pipenv.pew', 'workon', workon_name] - # Grab current terminal dimensions to replace the hardcoded default - # dimensions of pexpect - terminal_dimensions = get_terminal_size() - try: - with temp_environ(): - if project.is_venv_in_project(): - os.environ['WORKON_HOME'] = project.project_directory - c = pexpect.spawn( - cmd, - args, - dimensions=( - terminal_dimensions.lines, terminal_dimensions.columns - ), - ) - # Windows! - except AttributeError: - # import subprocess - # Tell pew to use the project directory as its workon_home - with temp_environ(): - if project.is_venv_in_project(): - os.environ['WORKON_HOME'] = project.project_directory - pew.workon_cmd([workon_name]) - sys.exit(0) - # Activate the virtualenv if in compatibility mode. - if compat: - c.sendline(activate_virtualenv()) - # Send additional arguments to the subshell. - if shell_args: - c.sendline(' '.join(shell_args)) - - # Handler for terminal resizing events - # Must be defined here to have the shell process in its context, since we - # can't pass it as an argument - def sigwinch_passthrough(sig, data): - terminal_dimensions = get_terminal_size() - c.setwinsize(terminal_dimensions.lines, terminal_dimensions.columns) - - signal.signal(signal.SIGWINCH, sigwinch_passthrough) - # Interact with the new shell. - c.interact(escape_character=None) - c.close() - sys.exit(c.exitstatus) + shell.fork(*fork_args) def inline_activate_virtualenv(): diff --git a/pipenv/environments.py b/pipenv/environments.py index 36fada8c65..3ab5eefc5b 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -76,6 +76,7 @@ SESSION_IS_INTERACTIVE = bool(os.isatty(sys.stdout.fileno())) PIPENV_SHELL_EXPLICIT = os.environ.get('PIPENV_SHELL') PIPENV_SHELL = os.environ.get('SHELL') or os.environ.get('PYENV_SHELL') +PIPENV_EMULATOR = os.environ.get('PIPENV_EMULATOR') PIPENV_CACHE_DIR = os.environ.get('PIPENV_CACHE_DIR', user_cache_dir('pipenv')) # Tells pipenv to override PyPI index urls with a mirror. PIPENV_PYPI_MIRROR = os.environ.get('PIPENV_PYPI_MIRROR') diff --git a/pipenv/shells.py b/pipenv/shells.py index 921c72ce8b..570bcdec41 100644 --- a/pipenv/shells.py +++ b/pipenv/shells.py @@ -1,11 +1,17 @@ +import collections +import contextlib import os +import signal +import subprocess +import sys -from .environments import PIPENV_SHELL_EXPLICIT, PIPENV_SHELL -from .vendor import shellingham +from ._compat import get_terminal_size +from .environments import PIPENV_SHELL_EXPLICIT, PIPENV_SHELL, PIPENV_EMULATOR +from .utils import temp_environ +from .vendor import pathlib2 as pathlib, shellingham -class ShellDetectionFailure(shellingham.ShellDetectionFailure): - pass +ShellDetectionFailure = shellingham.ShellDetectionFailure def _build_info(value): @@ -21,3 +27,186 @@ def detect_info(): if PIPENV_SHELL: return _build_info(PIPENV_SHELL) raise ShellDetectionFailure + + +def _get_activate_script(venv): + """Returns the string to activate a virtualenv. + + This is POSIX-only at the moment since the compat (pexpect-based) shell + does not work elsewhere anyway. + """ + # Suffix and source command for other shells. + # Support for fish shell. + if PIPENV_SHELL and 'fish' in PIPENV_SHELL: + suffix = '.fish' + command = 'source' + # Support for csh shell. + elif PIPENV_SHELL and 'csh' in PIPENV_SHELL: + suffix = '.csh' + command = 'source' + else: + suffix = '' + command = '.' + # Escape any spaces located within the virtualenv path to allow + # for proper activation. + venv_location = str(venv).replace(' ', r'\ ') + # The leading space can make history cleaner in some shells. + return ' {2} {0}/bin/activate{1}'.format(venv_location, suffix, command) + + +def _handover(cmd, args): + args = [cmd] + args + if os.name != 'nt': + os.execvp(cmd, args) + else: + proc = subprocess.run(args, shell=True, universal_newlines=True) + sys.exit(proc.returncode) + + +class Shell(object): + + def __init__(self, cmd): + self.cmd = cmd + self.args = [] + + @contextlib.contextmanager + def inject_path(self, venv): + yield + + def fork(self, venv, cwd, args): + # FIXME: This isn't necessarily the correct prompt. We should read the + # actual prompt by peeking into the activation script. + name = os.path.basename(venv) + os.environ['VIRTUAL_ENV'] = str(venv) + if 'PROMPT' in os.environ: + os.environ['PROMPT'] = '({0}) {1}'.format( + name, os.environ['PROMPT'], + ) + if 'PS1' in os.environ: + os.environ['PS1'] = '({0}) {1}'.format( + name, os.environ['PS1'], + ) + with self.inject_path(venv): + os.chdir(cwd) + _handover(self.cmd, self.args + list(args)) + + def fork_compat(self, venv, cwd, args): + from .vendor import pexpect + + # Grab current terminal dimensions to replace the hardcoded default + # dimensions of pexpect. + dims = get_terminal_size() + with temp_environ(): + c = pexpect.spawn( + self.cmd, ['-i'], dimensions=(dims.lines, dims.columns), + ) + c.sendline(_get_activate_script(venv)) + if args: + c.sendline(' '.join(args)) + + # Handler for terminal resizing events + # Must be defined here to have the shell process in its context, since + # we can't pass it as an argument + def sigwinch_passthrough(sig, data): + dims = get_terminal_size() + c.setwinsize(dims.lines, dims.columns) + + signal.signal(signal.SIGWINCH, sigwinch_passthrough) + + # Interact with the new shell. + c.interact(escape_character=None) + c.close() + sys.exit(c.exitstatus) + + +POSSIBLE_ENV_PYTHON = [ + pathlib.Path('bin', 'python'), + pathlib.Path('Scripts', 'python.exe'), +] + + +def _iter_python(venv): + for path in POSSIBLE_ENV_PYTHON: + full_path = pathlib.Path(venv, path) + if full_path.is_file(): + yield full_path + + +class Bash(Shell): + # The usual PATH injection technique does not work with Bash. + # https://github.com/berdario/pew/issues/58#issuecomment-102182346 + @contextlib.contextmanager + def inject_path(self, venv): + from ._compat import NamedTemporaryFile + bashrc_path = pathlib.Path.home().joinpath('.bashrc') + with NamedTemporaryFile('w+') as rcfile: + if bashrc_path.is_file(): + base_rc_src = 'source "{0}"\n'.format(bashrc_path.as_posix()) + rcfile.write(base_rc_src) + + export_path = 'export PATH="{0}:$PATH"\n'.format(':'.join( + python.parent.as_posix() + for python in _iter_python(venv) + )) + rcfile.write(export_path) + rcfile.flush() + self.args.extend(['--rcfile', rcfile.name]) + yield + + +class CmderEmulatedShell(Shell): + def fork(self, venv, cwd, args): + if cwd: + os.environ['CMDER_START'] = cwd + super(CmderEmulatedShell, self).fork(venv, cwd, args) + + +class CmderCommandPrompt(CmderEmulatedShell): + def fork(self, venv, cwd, args): + rc = os.path.expandvars('%CMDER_ROOT%\\vendor\\init.bat') + if os.path.exists(rc): + self.args.extend(['/k', rc]) + super(CmderCommandPrompt, self).fork(venv, cwd, args) + + +class CmderPowershell(Shell): + def fork(self, venv, cwd, args): + rc = os.path.expandvars('%CMDER_ROOT%\\vendor\\profile.ps1') + if os.path.exists(rc): + self.args.extend([ + '-ExecutionPolicy', 'Bypass', '-NoLogo', '-NoProfile', + '-NoExit', '-Command', + "Invoke-Expression '. ''{0}'''".format(rc), + ]) + super(CmderPowershell, self).fork(venv, cwd, args) + + +# Two dimensional dict. First is the shell type, second is the emulator type. +# Example: SHELL_LOOKUP['powershell']['cmder'] => CmderPowershell. +SHELL_LOOKUP = collections.defaultdict( + lambda: collections.defaultdict(lambda: Shell), + { + 'bash': collections.defaultdict(lambda: Bash), + 'cmd': collections.defaultdict(lambda: Shell, { + 'cmder': CmderCommandPrompt, + }), + 'powershell': collections.defaultdict(lambda: Shell, { + 'cmder': CmderPowershell, + }), + 'pwsh': collections.defaultdict(lambda: Shell, { + 'cmder': CmderPowershell, + }), + }, +) + + +def _detect_emulator(): + if os.environ.get('CMDER_ROOT'): + return 'cmder' + return '' + + +def choose_shell(): + emulator = PIPENV_EMULATOR or _detect_emulator() + type_, command = detect_info() + return SHELL_LOOKUP[type_][emulator](command) diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 82117704dc..f1621c37df 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -2,8 +2,6 @@ XXX: Try our best to reduce tests in this file. """ - -from pipenv.core import activate_virtualenv from pipenv.project import Project from pipenv.vendor import delegator import pytest @@ -20,15 +18,6 @@ def test_code_import_manual(PipenvInstance): assert 'requests' in p.pipfile['packages'] -@pytest.mark.code -@pytest.mark.virtualenv -@pytest.mark.project -def test_activate_virtualenv_no_source(): - command = activate_virtualenv(source=False) - venv = Project().virtualenv_location - assert command == '{0}/bin/activate'.format(venv) - - @pytest.mark.lock @pytest.mark.deploy @pytest.mark.cli From bb7ea4bf4109aab6c9f8acc8e4ea76223aa198e2 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 14 Jun 2018 01:32:08 -0400 Subject: [PATCH 02/23] Try new appveyor config - Auto abort re-built PRs - Better leverage of caching - Better exit handling Signed-off-by: Dan Ryan Fix appveyor config Signed-off-by: Dan Ryan Fix syntax error Signed-off-by: Dan Ryan Try tox with detox Signed-off-by: Dan Ryan Slight tweak? Signed-off-by: Dan Ryan Back to powershell Signed-off-by: Dan Ryan --- appveyor.yml | 99 +++++++++++++++++++++++++++++++++------------------- tox.ini | 16 +++++++++ 2 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 tox.ini diff --git a/appveyor.yml b/appveyor.yml index 281be9157d..2a172f02ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,54 +4,81 @@ version: 1.0.{build} skip_branch_with_pr: true init: +- ps: >- - - git config --global core.sharedRepository true - - git config --global core.longpaths true - - git config --global core.autocrlf input + git config --global core.sharedRepository true + + git config --global core.longpaths true + + git config --global core.autocrlf input + + if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + Write-Host "There are newer queued builds for this pull request, skipping build." + Exit-AppveyorBuild + } + + If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) { + Write-Host "Skipping build, not at a tag." + Exit-AppveyorBuild + } environment: - PYPI_VENDOR_DIR: '.\tests\pypi\' - GIT_ASK_YESNO: 'false' - SHELL: 'windows' - PYTHON_ARCH: '64' - PYTHONIOENCODING: 'utf-8' + PYPI_VENDOR_DIR: .\tests\pypi\ + PYTHONIOENCODING: utf-8 + GIT_ASK_YESNO: false + SHELL: windows + PYTHON_ARCH: 64 + APPVEYOR_SAVE_CACHE_ON_ERROR: true + APPVEYOR_SKIP_FINALIZE_ON_EXIT: true matrix: - - PYTHON: 'C:\Python27-x64' - PYTHON_VERSION: '2.7.x' - TEST_SUITE: 'not install' - - - PYTHON: 'C:\Python27-x64' - PYTHON_VERSION: '2.7.x' - TEST_SUITE: 'install' - PYTEST_ADDOPTS: '--cache-clear' - RUN_INTEGRATION_TESTS: 'True' + - PYTHON: C:\Python27-x64 + PYTHON_VERSION: 2.7.x + PIPENV_PYTHON: 2.7 - - PYTHON: 'C:\Python36-x64' - PYTHON_VERSION: '3.6.x' - TEST_SUITE: 'not install' + - PYTHON: C:\Python36-x64 + PYTHON_VERSION: 3.6.x + PIPENV_PYTHON: 3.6 - - PYTHON: 'C:\Python36-x64' - PYTHON_VERSION: '3.6.x' - TEST_SUITE: 'install' - PYTEST_ADDOPTS: '--cache-clear' - RUN_INTEGRATION_TESTS: 'True' install: - - 'set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%' - - '%PYTHON%\python.exe -m pip install --upgrade pip' - - '%PYTHON%\python.exe -m pip install -e .' - - '%PYTHON%\python.exe -m pipenv run pip install -e .' - - '%PYTHON%\python.exe -m pipenv install --dev' - - '%PYTHON%\python.exe -m pipenv --venv' - - '%PYTHON%\python.exe -m pipenv --py' - - '%PYTHON%\python.exe -m pipenv run python --version' +- ps: >- + + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + Invoke-Expression "$py_exe -m pip install --upgrade pip" + + Invoke-Expression "$py_exe -m pip install -e ." + + Invoke-Expression "$pipenv_exe install --dev" + + Invoke-Expression "$pipenv_exe --venv" + + Invoke-Expression "$pipenv_exe --py" cache: - - '%LocalAppData%\pip\cache' +- '%LocalAppData%\pip\cache' +- '%LocalAppData%\pipenv\cache' test_script: - - 'if "%RUN_INTEGRATION_TESTS%" == "True" (rmdir /s /q %LocalAppData%\pip\cache)' - - '%PYTHON%\python.exe -m pipenv run pytest -v -n 4 -m "%TEST_SUITE%" tests' + +- ps: >- + $script_path = Join-Path -path $env:PYTHON -childpath Scripts + + $py_exe = Join-Path -path $env:PYTHON -childpath python.exe + + $pipenv_exe = Join-Path -path $script_path -childpath pipenv.exe + + $env:PATH = "$py_path;$script_path;$env:PATH" + + Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor tests" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000000..e0f660e0fc --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = 2.7, + 3.6 + +[testenv] +setenv = PYPI_VENDOR_DIR = {toxinidir}/tests/pypi/ + PIPENV_PYTHON = {envname} + PYTHONIOENCODING = utf-8 + PIPENV_IGNORE_VIRTUALENVS = 1 +passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* PIPENV_* PIP_* TEST_SUITE PYTHONIOENCODING GIT_ASK_YESNO SHELL PYTHON_ARCH +deps = -e . + pytest +basepython = python{envname} +commands = python -m pip install -e . + python -m pipenv install --dev + pipenv run pytest {posargs:-v -n 4 --ignore="{toxinidir}/pipenv/patched" --ignore="{toxinidir}/pipenv/vendor" -m "{env:TEST_SUITE}" tests} From 6a15ee24560b37f2a09a26f84b6dc4dbd43d635d Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 26 Jun 2018 18:42:39 -0400 Subject: [PATCH 03/23] Test updates Signed-off-by: Dan Ryan --- appveyor.yml | 62 +++++++++++++++++++++++++++++++++++++++------------- run-tests.sh | 7 ++++++ 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2a172f02ab..f07cea2363 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,36 +13,66 @@ init: git config --global core.autocrlf input if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + Write-Host "There are newer queued builds for this pull request, skipping build." + Exit-AppveyorBuild + } If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) { + Write-Host "Skipping build, not at a tag." + Exit-AppveyorBuild + } + environment: - PYPI_VENDOR_DIR: .\tests\pypi\ - PYTHONIOENCODING: utf-8 - GIT_ASK_YESNO: false - SHELL: windows - PYTHON_ARCH: 64 - APPVEYOR_SAVE_CACHE_ON_ERROR: true - APPVEYOR_SKIP_FINALIZE_ON_EXIT: true + PYPI_VENDOR_DIR: '.\tests\pypi\' + GIT_ASK_YESNO: 'false' + SHELL: 'windows' + PYTHON_ARCH: '64' + PYTHONIOENCODING: 'utf-8' matrix: - - PYTHON: C:\Python27-x64 - PYTHON_VERSION: 2.7.x - PIPENV_PYTHON: 2.7 + - PYTHON: 'C:\Python27-x64' + PYTHON_VERSION: '2.7.x' + TEST_SUITE: 'not install' + + - PYTHON: 'C:\Python27-x64' + PYTHON_VERSION: '2.7.x' + TEST_SUITE: 'install' + PYTEST_ADDOPTS: '--cache-clear' + RUN_INTEGRATION_TESTS: 'True' + + - PYTHON: 'C:\Python36-x64' + PYTHON_VERSION: '3.6.x' + TEST_SUITE: 'not install' + + - PYTHON: 'C:\Python36-x64' + PYTHON_VERSION: '3.6.x' + TEST_SUITE: 'install' + PYTEST_ADDOPTS: '--cache-clear' + RUN_INTEGRATION_TESTS: 'True' + + - PYTHON: 'C:\Python37-x64' + PYTHON_VERSION: '3.7.x' + TEST_SUITE: 'not install' + + - PYTHON: 'C:\Python37-x64' + PYTHON_VERSION: '3.7.x' + TEST_SUITE: 'install' + PYTEST_ADDOPTS: '--cache-clear' + RUN_INTEGRATION_TESTS: 'True' - - PYTHON: C:\Python36-x64 - PYTHON_VERSION: 3.6.x - PIPENV_PYTHON: 3.6 install: @@ -56,7 +86,7 @@ install: $env:PATH = "$py_path;$script_path;$env:PATH" - Invoke-Expression "$py_exe -m pip install --upgrade pip" + Invoke-Expression "$py_exe -m pip install --upgrade pip invoke" Invoke-Expression "$py_exe -m pip install -e ." @@ -81,4 +111,6 @@ test_script: $env:PATH = "$py_path;$script_path;$env:PATH" - Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor tests" + If (($env:RUN_INTEGRATION_TESTS -eq "True") -and ($env:PYTHON_VERSION -eq "3.6.x")) { Invoke-Expression "invoke vendoring.update" } + + Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor -m $env:TEST_SUITE tests" diff --git a/run-tests.sh b/run-tests.sh index a705932209..3f3ca7a06b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -41,8 +41,10 @@ fi echo "Installing dependencies…" PIPENV_PYTHON=2.7 pipenv run pip install -e . --upgrade PIPENV_PYTHON=3.6 pipenv run pip install -e . --upgrade +PIPENV_PYTHON=3.7 pipenv run pip install -e . --upgrade PIPENV_PYTHON=2.7 pipenv install --dev PIPENV_PYTHON=3.6 pipenv install --dev +PIPENV_PYTHON=3.7 pipenv install --dev echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" # PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" | prefix 2.7 & @@ -50,5 +52,10 @@ echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" # Better to run them sequentially. PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" PIPENV_PYTHON=3.6 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" +PIPENV_PYTHON=3.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" + +# test revendoring +pip install --upgrade invoke +inv vendoring.update # Cleanup junk. rm -fr .venv From d2dbbf436323d5370a895997c60bf71a87ff49b2 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 26 Jun 2018 18:46:53 -0400 Subject: [PATCH 04/23] Update vendoring scripts - Update appveyor script to respect PR updates - Add vendoring script to CI - Closes #2428 --- appveyor.yml | 11 ++--------- pipenv/vendor/vendor.txt | 2 +- run-tests.sh | 7 ++----- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f07cea2363..ed18930eea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,5 @@ build: off version: 1.0.{build} - skip_branch_with_pr: true init: @@ -13,23 +12,15 @@ init: git config --global core.autocrlf input if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - Write-Host "There are newer queued builds for this pull request, skipping build." - Exit-AppveyorBuild - } If (($env:SKIP_NOTAG -eq "true") -and ($env:APPVEYOR_REPO_TAG -ne "true")) { - Write-Host "Skipping build, not at a tag." - Exit-AppveyorBuild - } @@ -37,6 +28,8 @@ environment: PYPI_VENDOR_DIR: '.\tests\pypi\' GIT_ASK_YESNO: 'false' + APPVEYOR_SAVE_CACHE_ON_ERROR: 'true' + APPVEYOR_SKIP_FINALIZE_ON_EXIT: 'true' SHELL: 'windows' PYTHON_ARCH: '64' PYTHONIOENCODING: 'utf-8' diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index e95b517840..8ecc6ba5f3 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -34,7 +34,7 @@ requirementslib==1.0.7 pyparsing==2.2.0 pytoml==0.1.16 requirements-parser==0.2.0 -shellingham==1.1.0dev0 +shellingham==1.1.0 six==1.11.0 semver==2.8.0 shutilwhich==1.1.0 diff --git a/run-tests.sh b/run-tests.sh index 3f3ca7a06b..9a6db97f53 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -41,10 +41,8 @@ fi echo "Installing dependencies…" PIPENV_PYTHON=2.7 pipenv run pip install -e . --upgrade PIPENV_PYTHON=3.6 pipenv run pip install -e . --upgrade -PIPENV_PYTHON=3.7 pipenv run pip install -e . --upgrade PIPENV_PYTHON=2.7 pipenv install --dev PIPENV_PYTHON=3.6 pipenv install --dev -PIPENV_PYTHON=3.7 pipenv install --dev echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" # PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" | prefix 2.7 & @@ -52,10 +50,9 @@ echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" # Better to run them sequentially. PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" PIPENV_PYTHON=3.6 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" -PIPENV_PYTHON=3.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" # test revendoring -pip install --upgrade invoke -inv vendoring.update +pip3 install --upgrade invoke requests parver +python3 -m invoke vendoring.update # Cleanup junk. rm -fr .venv From cf838f2824f510b08405cc37f0a15c9f2b1bfc3e Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 00:08:58 -0400 Subject: [PATCH 05/23] Update appveyor script Signed-off-by: Dan Ryan --- appveyor.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ed18930eea..f8cf4f6f44 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,7 +35,6 @@ environment: PYTHONIOENCODING: 'utf-8' matrix: - - PYTHON: 'C:\Python27-x64' PYTHON_VERSION: '2.7.x' TEST_SUITE: 'not install' @@ -66,8 +65,6 @@ environment: PYTEST_ADDOPTS: '--cache-clear' RUN_INTEGRATION_TESTS: 'True' - - install: - ps: >- @@ -104,6 +101,14 @@ test_script: $env:PATH = "$py_path;$script_path;$env:PATH" - If (($env:RUN_INTEGRATION_TESTS -eq "True") -and ($env:PYTHON_VERSION -eq "3.6.x")) { Invoke-Expression "invoke vendoring.update" } + $invoke_path = Join-Path -path $script_path -childpath invoke.exe + + Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor -m `"$env:TEST_SUITE`" tests" + + If ($env:RUN_INTEGRATION_TESTS -and ($env:PYTHON_VERSION -eq "3.6.x")) { + + Invoke-Expression "$py_exe -m pip install invoke" + + Invoke-Expression "$invoke_path vendoring.update" - Invoke-Expression "$pipenv_exe run pytest -v -n 4 --ignore=pipenv\patched --ignore=pipenv\vendor -m $env:TEST_SUITE tests" + } From b0c14186893100e0f2e43c8d9c9b2d45e4016fe5 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 01:33:14 -0400 Subject: [PATCH 06/23] Final tweak I believe. Signed-off-by: Dan Ryan --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f8cf4f6f44..c67a8cfb67 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -107,7 +107,7 @@ test_script: If ($env:RUN_INTEGRATION_TESTS -and ($env:PYTHON_VERSION -eq "3.6.x")) { - Invoke-Expression "$py_exe -m pip install invoke" + Invoke-Expression "$py_exe -m pip install invoke parver" Invoke-Expression "$invoke_path vendoring.update" From 29766fa0ce2053e5bdd8e7257798a192cbfc7468 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 18:14:18 -0400 Subject: [PATCH 07/23] Fix test Signed-off-by: Dan Ryan --- tests/integration/test_pipenv.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 89ee793ebb..22374254ef 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -3,12 +3,13 @@ XXX: Try our best to reduce tests in this file. """ import os -from tempfile import gettempdir, mkdtemp +from tempfile import mkdtemp import mock import pytest from pipenv.core import activate_virtualenv +from pipenv.utils import temp_environ from pipenv.project import Project from pipenv.vendor import delegator from pipenv._compat import Path @@ -103,14 +104,11 @@ def test_proper_names_unamanged_virtualenv(PipenvInstance, pypi): def test_directory_with_leading_dash(PipenvInstance): def mocked_mkdtemp(suffix, prefix, dir): if suffix == '-project': - temp_dir = Path(gettempdir()) / '-dir-with-leading-dash' - temp_dir.mkdir() - return str(temp_dir) - else: - return mkdtemp(suffix, prefix, dir) + prefix = '-dir-with-leading-dash' + return mkdtemp(suffix, prefix, dir) with mock.patch('pipenv._compat.mkdtemp', side_effect=mocked_mkdtemp): - with PipenvInstance(chdir=True) as p: + with temp_environ(), PipenvInstance(chdir=True) as p: # This environment variable is set in the context manager and will # cause pipenv to use virtualenv, not pew. del os.environ['PIPENV_VENV_IN_PROJECT'] From a0f2d7ed5def90745648c90f9acea2792d693d81 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 20:51:15 -0400 Subject: [PATCH 08/23] Remove tox.ini Signed-off-by: Dan Ryan --- tox.ini | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 tox.ini diff --git a/tox.ini b/tox.ini deleted file mode 100644 index e0f660e0fc..0000000000 --- a/tox.ini +++ /dev/null @@ -1,16 +0,0 @@ -[tox] -envlist = 2.7, - 3.6 - -[testenv] -setenv = PYPI_VENDOR_DIR = {toxinidir}/tests/pypi/ - PIPENV_PYTHON = {envname} - PYTHONIOENCODING = utf-8 - PIPENV_IGNORE_VIRTUALENVS = 1 -passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* PIPENV_* PIP_* TEST_SUITE PYTHONIOENCODING GIT_ASK_YESNO SHELL PYTHON_ARCH -deps = -e . - pytest -basepython = python{envname} -commands = python -m pip install -e . - python -m pipenv install --dev - pipenv run pytest {posargs:-v -n 4 --ignore="{toxinidir}/pipenv/patched" --ignore="{toxinidir}/pipenv/vendor" -m "{env:TEST_SUITE}" tests} From 511d0dd2934bb49ab996b6b64bfdaad359f078ca Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 21:17:26 -0400 Subject: [PATCH 09/23] Fix buildkite Signed-off-by: Dan Ryan --- run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index 9a6db97f53..002587c504 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -20,7 +20,7 @@ fi export PATH="~/.local/bin:$PATH" echo "Installing Pipenv…" -pip install -e "$(pwd)" --upgrade +pip install --user -e "$(pwd)" --upgrade pipenv install --deploy --dev # Otherwise, we're on a development machine. From 95e932e66894c8feef89711ceab6fbbefc0df044 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 21:21:37 -0400 Subject: [PATCH 10/23] update buildkite Signed-off-by: Dan Ryan --- run-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index 002587c504..aff35e496d 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -19,8 +19,9 @@ if [[ ! -z "$TEST_SUITE" ]]; then fi export PATH="~/.local/bin:$PATH" +pip uninstall pipenv echo "Installing Pipenv…" -pip install --user -e "$(pwd)" --upgrade +pip install -e "$(pwd)" --upgrade pipenv install --deploy --dev # Otherwise, we're on a development machine. From 52095a9284e628f8266c3383b52bf8512ce25b79 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 28 Jun 2018 22:01:10 -0400 Subject: [PATCH 11/23] Stop importing unused things Signed-off-by: Dan Ryan --- tests/integration/test_pipenv.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 2bdc1fd6cf..1b9b66a552 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -9,7 +9,6 @@ import mock import pytest -from pipenv.core import activate_virtualenv from pipenv.project import Project from pipenv.vendor import delegator from pipenv._compat import Path From c5b2cf6c4f7edd3f01dd4d2f5548105e6eb71f27 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 29 Jun 2018 03:19:35 -0400 Subject: [PATCH 12/23] Fix pathlib fallback imports to use compat file Signed-off-by: Dan Ryan --- pipenv/shells.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pipenv/shells.py b/pipenv/shells.py index 570bcdec41..23ef95086a 100644 --- a/pipenv/shells.py +++ b/pipenv/shells.py @@ -5,10 +5,10 @@ import subprocess import sys -from ._compat import get_terminal_size +from ._compat import get_terminal_size, Path from .environments import PIPENV_SHELL_EXPLICIT, PIPENV_SHELL, PIPENV_EMULATOR from .utils import temp_environ -from .vendor import pathlib2 as pathlib, shellingham +from .vendor import shellingham ShellDetectionFailure = shellingham.ShellDetectionFailure @@ -120,14 +120,14 @@ def sigwinch_passthrough(sig, data): POSSIBLE_ENV_PYTHON = [ - pathlib.Path('bin', 'python'), - pathlib.Path('Scripts', 'python.exe'), + Path('bin', 'python'), + Path('Scripts', 'python.exe'), ] def _iter_python(venv): for path in POSSIBLE_ENV_PYTHON: - full_path = pathlib.Path(venv, path) + full_path = Path(venv, path) if full_path.is_file(): yield full_path @@ -138,7 +138,7 @@ class Bash(Shell): @contextlib.contextmanager def inject_path(self, venv): from ._compat import NamedTemporaryFile - bashrc_path = pathlib.Path.home().joinpath('.bashrc') + bashrc_path = Path.home().joinpath('.bashrc') with NamedTemporaryFile('w+') as rcfile: if bashrc_path.is_file(): base_rc_src = 'source "{0}"\n'.format(bashrc_path.as_posix()) From e2242bca614974f89ab506612f754db20c9d456c Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 29 Jun 2018 03:28:21 -0400 Subject: [PATCH 13/23] Add news entries for shellingham Signed-off-by: Dan Ryan --- news/2371.feature | 1 + news/2371.vendor | 1 + 2 files changed, 2 insertions(+) create mode 100644 news/2371.feature create mode 100644 news/2371.vendor diff --git a/news/2371.feature b/news/2371.feature new file mode 100644 index 0000000000..3d71fe0d2a --- /dev/null +++ b/news/2371.feature @@ -0,0 +1 @@ +All calls to ``pipenv shell`` are now implemented from the ground up using `shellingham `_, a custom library which was purpose built to handle edge cases and shell detection. diff --git a/news/2371.vendor b/news/2371.vendor new file mode 100644 index 0000000000..3d71fe0d2a --- /dev/null +++ b/news/2371.vendor @@ -0,0 +1 @@ +All calls to ``pipenv shell`` are now implemented from the ground up using `shellingham `_, a custom library which was purpose built to handle edge cases and shell detection. From 1525e16d1aa30fad0f646d11985683f00cc68ca0 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 29 Jun 2018 16:23:36 +0800 Subject: [PATCH 14/23] Actually inject path for fancy mode --- pipenv/shells.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pipenv/shells.py b/pipenv/shells.py index 23ef95086a..87692b2560 100644 --- a/pipenv/shells.py +++ b/pipenv/shells.py @@ -71,7 +71,13 @@ def __init__(self, cmd): @contextlib.contextmanager def inject_path(self, venv): - yield + with temp_environ(): + os.environ['PATH'] = '{0}{1}{2}'.format( + os.pathsep.join(str(p.parent) for p in _iter_python(venv)), + os.pathsep, + os.environ['PATH'], + ) + yield def fork(self, venv, cwd, args): # FIXME: This isn't necessarily the correct prompt. We should read the From 9099f533f2ba41877283cc9a8fd0bf39f51f7d2d Mon Sep 17 00:00:00 2001 From: Grey Baker Date: Fri, 29 Jun 2018 09:18:26 -0400 Subject: [PATCH 15/23] Update version map for latest Python releases --- pipenv/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipenv/core.py b/pipenv/core.py index a2396cbc2d..ea8a0698c3 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -475,7 +475,8 @@ def activate_pyenv(): '3.3': '3.3.7', '3.4': '3.4.8', '3.5': '3.5.5', - '3.6': '3.6.5', + '3.6': '3.6.6', + '3.7': '3.7.0', } try: if len(python.split('.')) == 2: From 4b8d9ffd3336ffd7601c16d37d5fa318d975bec8 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 29 Jun 2018 12:45:14 -0400 Subject: [PATCH 16/23] Pass `-y` to pip uninstall for buildkite Signed-off-by: Dan Ryan --- run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index aff35e496d..ce62ea5ad9 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -19,7 +19,7 @@ if [[ ! -z "$TEST_SUITE" ]]; then fi export PATH="~/.local/bin:$PATH" -pip uninstall pipenv +pip uninstall -y pipenv echo "Installing Pipenv…" pip install -e "$(pwd)" --upgrade pipenv install --deploy --dev From 617ef444192f11104ced88a9f8618e708c685b83 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 10:45:40 -0600 Subject: [PATCH 17/23] changed function name so it could be imported --- pipenv/help.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pipenv/help.py b/pipenv/help.py index 0d06680d27..4f853266c7 100644 --- a/pipenv/help.py +++ b/pipenv/help.py @@ -16,8 +16,8 @@ def print_utf(line): print(line.encode('utf-8')) -def main(): - print('
$ python -m pipenv.help output') +def get_pipenv_diagnostics(): + print('
$ pipenv --support') print('') print('Pipenv version: `{0!r}`'.format(__version__)) print('') @@ -93,5 +93,5 @@ def main(): if __name__ == '__main__': - main() + get_pipenv_diagnostics() From fa967853f57b7ba3a7f1b98b8d7c64145cbf0a10 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 10:46:05 -0600 Subject: [PATCH 18/23] added cli option for --support --- pipenv/cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pipenv/cli.py b/pipenv/cli.py index bb41c103a5..16cd76c758 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -152,6 +152,11 @@ def validate_pypi_mirror(ctx, param, value): callback=validate_pypi_mirror, help="Specify a PyPI mirror.", ) +@option( + '--support', + is_flag=True, + help="Output diagnostic information for use in Github issues." +) @version_option( prog_name=crayons.normal('pipenv', bold=True), version=__version__ ) @@ -171,6 +176,7 @@ def cli( man=False, completion=False, pypi_mirror=None, + support=None ): if completion: # Handle this ASAP to make shell startup fast. from . import shells @@ -229,6 +235,10 @@ def cli( elif py: do_py() sys.exit() + elif support: + from .help import get_pipenv_diagnostics + get_pipenv_diagnostics() + sys.exit(0) # --venv was passed... elif venv: # There is no virtualenv yet. From 4cb677ac02ac726ca7517110f21f4f95ee64dbff Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 10:47:49 -0600 Subject: [PATCH 19/23] add news fragment for feature 2477 --- news/2477.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2477.feature diff --git a/news/2477.feature b/news/2477.feature new file mode 100644 index 0000000000..0b433bcec5 --- /dev/null +++ b/news/2477.feature @@ -0,0 +1 @@ +Added new flag `pipenv --support` to replace the diagnostic command `python -m pipenv.help`. \ No newline at end of file From 7048bcb786d8658b8e2996c38150a80772e3aff2 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sat, 30 Jun 2018 01:30:53 +0800 Subject: [PATCH 20/23] Update issue templates --- .github/ISSUE_TEMPLATE.md | 22 +++++--- .github/ISSUE_TEMPLATE/Bug_report.md | 66 +++++++++++++---------- .github/ISSUE_TEMPLATE/Custom.md | 29 +++++++--- .github/ISSUE_TEMPLATE/Feature_request.md | 40 ++++++++------ 4 files changed, 97 insertions(+), 60 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 10506bc01e..b232655538 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,14 +1,10 @@ Be sure to check the existing issues (both open and closed!). -Describe the issue briefly here. - -Please run `$ python -m pipenv.help`, and paste the results here. - -If you're on MacOS, just run the following: +------------ - $ python -m pipenv.help | pbcopy +##### Issue description ------------- +Describe the issue briefly here. ##### Expected result @@ -21,3 +17,15 @@ When possible, provide the verbose output (`--verbose`), especially for locking ##### Steps to replicate Provide the steps to replicate (which usually at least includes the commands and the Pipfile). + +------------- + +Please run `$ pipenv --support`, and paste the results here. Don't put backticks (`` ` ``) around it! The output already contains Markdown formatting. + +If you're on macOS, run the following: + + $ pipenv --support | pbcopy + +If you're on Windows, run the following: + + > pipenv --support | clip diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 03aa41a1b2..c6b478765a 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -1,29 +1,37 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -Be sure to check the existing issues (both open and closed!). - -Describe the issue briefly here. - -Please run `$ python -m pipenv.help`, and paste the results here. - -If you're on MacOS, just run the following: - - $ python -m pipenv.help | pbcopy - ------------- - -##### Expected result - -Describe what you expected. - -##### Actual result - -When possible, provide the verbose output (`--verbose`), especially for locking and dependencies resolving issues. - -##### Steps to replicate - -Provide the steps to replicate (which usually at least includes the commands and the Pipfile). +--- +name: Bug report +about: Create a report to help us improve + +--- + +Be sure to check the existing issues (both open and closed!). + +------------ + +##### Issue description + +Describe the issue briefly here. + +##### Expected result + +Describe what you expected. + +##### Actual result + +When possible, provide the verbose output (`--verbose`), especially for locking and dependencies resolving issues. + +##### Steps to replicate + +Provide the steps to replicate (which usually at least includes the commands and the Pipfile). + +------------- + +Please run `$ pipenv --support`, and paste the results here. Don't put backticks (`` ` ``) around it! The output already contains Markdown formatting. + +If you're on macOS, run the following: + + $ pipenv --support | pbcopy + +If you're on Windows, run the following: + + > pipenv --support | clip diff --git a/.github/ISSUE_TEMPLATE/Custom.md b/.github/ISSUE_TEMPLATE/Custom.md index d31ed75eaf..5166a09e62 100644 --- a/.github/ISSUE_TEMPLATE/Custom.md +++ b/.github/ISSUE_TEMPLATE/Custom.md @@ -1,7 +1,22 @@ ---- -name: Usage / Requests for Help -about: Requests for assistance or general usage guidance. - ---- - -Please refer to our [StackOverflow tag](https://stackoverflow.com/questions/tagged/pipenv) for more information. +--- +name: Usage / Requests for Help +about: Requests for assistance or general usage guidance. + +--- + +Please refer to our [StackOverflow tag](https://stackoverflow.com/questions/tagged/pipenv) for more information. + +If Pipenv is not functioning as you would like it to, consider filing either a bug report, or a feature request instead. + + +------------- + +Please run `$ pipenv --support`, and paste the results here. Don't put backticks (`` ` ``) around it! The output already contains Markdown formatting. + +If you're on macOS, run the following: + + $ pipenv --support | pbcopy + +If you're on Windows, run the following: + + > pipenv --support | clip diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 5384295126..4876c2a899 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,17 +1,23 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. +--- +name: Feature request +about: Suggest an idea for this project + +--- + +Be sure to check the existing issues (both open and closed!). + +##### Is your feature request related to a problem? Please describe. + +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +##### Describe the solution you'd like + +A clear and concise description of what you want to happen. + +##### Describe alternatives you've considered + +A clear and concise description of any alternative solutions or features you've considered. + +##### Additional context + +Add any other context or screenshots about the feature request here. It may be a good idea to mention that platform and Python version you are on. From 58ceb0ccd380d767d0072634ac5dc652b00abb74 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 11:32:51 -0600 Subject: [PATCH 21/23] fix quotes for rst files --- news/2477.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/2477.feature b/news/2477.feature index 0b433bcec5..9276e1cbe2 100644 --- a/news/2477.feature +++ b/news/2477.feature @@ -1 +1 @@ -Added new flag `pipenv --support` to replace the diagnostic command `python -m pipenv.help`. \ No newline at end of file +Added new flag ``pipenv --support`` to replace the diagnostic command ``python -m pipenv.help``. \ No newline at end of file From 48970d901dbcc6b7a17479495bd61cd874dd15f4 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 11:33:37 -0600 Subject: [PATCH 22/23] new test for pipenv --support --- tests/integration/test_cli.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 56ae2210a4..a51095ce73 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -31,6 +31,12 @@ def test_pipenv_py(PipenvInstance): assert os.path.basename(python).startswith('python') +@pytest.mark.cli +def test_pipenv_support(PipenvInstance): + with PipenvInstance() as p: + assert p.pipenv('--support').out + + @pytest.mark.cli def test_pipenv_rm(PipenvInstance): with PipenvInstance() as p: From 1c2a6e229066fc9e3dfed10a3e7624653fd456d9 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Fri, 29 Jun 2018 11:35:54 -0600 Subject: [PATCH 23/23] comment --- pipenv/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pipenv/cli.py b/pipenv/cli.py index 16cd76c758..646cd0ac8c 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -235,6 +235,7 @@ def cli( elif py: do_py() sys.exit() + # --support was passed... elif support: from .help import get_pipenv_diagnostics get_pipenv_diagnostics()