From 9cb8e546c2d798aa912e3471cece87c8dad6182a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B6=E4=BB=B6?= Date: Sun, 29 Jul 2018 21:23:40 +0800 Subject: [PATCH 01/26] Update basics.rst with `$SHELL` State the role of `$SHELL` in `pipenv shell` command. --- docs/basics.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/basics.rst b/docs/basics.rst index 9c222eb4..f9bf0b80 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -326,6 +326,7 @@ You should do this for your shell too, in your ``~/.profile`` or ``~/.bashrc`` o .. note:: The shell launched in interactive mode. This means that if your shell reads its configuration from a specific file for interactive mode (e.g. bash by default looks for a ``~/.bashrc`` configuration file for interactive mode), then you'll need to modify (or create) this file. +Also ``pipenv shell`` use ``$SHELL`` environment variable to get the name of shell you are running, if something wrong, just check it. ☤ A Note about VCS Dependencies ------------------------------- From 1a7d72fe6ebee100fda2a3d40dda1bcf14b29971 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 30 Jul 2018 14:35:28 +1000 Subject: [PATCH 02/26] Add link to PEP-440 for version specifiers --- docs/basics.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/basics.rst b/docs/basics.rst index 9c222eb4..8a9460e7 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -188,6 +188,7 @@ To tell pipenv to install a specific version of a library, the usage is simple:: This will update your ``Pipfile`` to reflect this requirement, automatically. +For other version specifiers, see `PEP-440 <(https://www.python.org/dev/peps/pep-0440/#version-specifiers>`. ☤ Specifying Versions of Python ------------------------------- From 587125c279a0e0abee3059083ea39d64c3e222e5 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 30 Jul 2018 14:38:53 +1000 Subject: [PATCH 03/26] Fix syntax of link --- docs/basics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basics.rst b/docs/basics.rst index 8a9460e7..3db70519 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -188,7 +188,7 @@ To tell pipenv to install a specific version of a library, the usage is simple:: This will update your ``Pipfile`` to reflect this requirement, automatically. -For other version specifiers, see `PEP-440 <(https://www.python.org/dev/peps/pep-0440/#version-specifiers>`. +For other version specifiers, see `PEP-440 `. ☤ Specifying Versions of Python ------------------------------- From 0f30bcbcdbdb584d74d08dc284a0de32f3e31357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B6=E4=BB=B6?= Date: Wed, 1 Aug 2018 22:34:33 +0800 Subject: [PATCH 04/26] Update basics.rst Add the description of `PIPENV_SHELL` --- docs/basics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basics.rst b/docs/basics.rst index f9bf0b80..0dadd02f 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -326,7 +326,7 @@ You should do this for your shell too, in your ``~/.profile`` or ``~/.bashrc`` o .. note:: The shell launched in interactive mode. This means that if your shell reads its configuration from a specific file for interactive mode (e.g. bash by default looks for a ``~/.bashrc`` configuration file for interactive mode), then you'll need to modify (or create) this file. -Also ``pipenv shell`` use ``$SHELL`` environment variable to get the name of shell you are running, if something wrong, just check it. +If you get something wrong with ``$ pipenv shell``, just check ``PIPENV_SHELL`` environment variable, ``$ pipenv shell`` will use it if available. For detail, see `Configuration With Environment Variables `_. ☤ A Note about VCS Dependencies ------------------------------- From 81a189dbc524977882d7bd520a86ac95b594ed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B6=E4=BB=B6?= Date: Thu, 2 Aug 2018 16:31:58 +0800 Subject: [PATCH 05/26] Update basics.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update link with Sphinx’s reference syntax. --- docs/basics.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/basics.rst b/docs/basics.rst index 0dadd02f..8d7ff825 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -326,7 +326,7 @@ You should do this for your shell too, in your ``~/.profile`` or ``~/.bashrc`` o .. note:: The shell launched in interactive mode. This means that if your shell reads its configuration from a specific file for interactive mode (e.g. bash by default looks for a ``~/.bashrc`` configuration file for interactive mode), then you'll need to modify (or create) this file. -If you get something wrong with ``$ pipenv shell``, just check ``PIPENV_SHELL`` environment variable, ``$ pipenv shell`` will use it if available. For detail, see `Configuration With Environment Variables `_. +If you get something wrong with ``$ pipenv shell``, just check ``PIPENV_SHELL`` environment variable, ``$ pipenv shell`` will use it if available. For detail, see :ref:`configuration-with-environment-variables`. ☤ A Note about VCS Dependencies ------------------------------- @@ -363,3 +363,4 @@ production environments for reproducible builds. This will include all hashes, however (which is great!). To get a ``requirements.txt`` without hashes, use ``$ pipenv run pip freeze``. +.. _configuration-with-environment-variables:https://docs.pipenv.org/advanced/#configuration-with-environment-variables From f65c0dfd63192b638bea040ad7f51ad97afb7f92 Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Wed, 18 Jul 2018 17:10:41 -0400 Subject: [PATCH 06/26] Adding some git+git and git+ssh tests as examples --- tests/integration/test_install_uri.py | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 24f7996f..4a73c1c7 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -25,6 +25,38 @@ def test_basic_vcs_install(PipenvInstance, pip_src_dir, pypi): assert "gitdb2" in p.lockfile["default"] +@pytest.mark.vcs +@pytest.mark.install +@pytest.mark.needs_internet +@flaky +def test_git_vcs_install(PipenvInstance, pip_src_dir, pypi): + with PipenvInstance(pypi=pypi, chdir=True) as p: + c = p.pipenv("install git+git://github.com/benjaminp/six.git@1.11.0#egg=six") + assert c.return_code == 0 + assert "six" in p.pipfile["packages"] + assert "git" in p.pipfile["packages"]["six"] + assert p.lockfile["default"]["six"] == { + "git": "git://github.com/benjaminp/six.git", + "ref": "15e31431af97e5e64b80af0a3f598d382bcdd49a", + } + + +@pytest.mark.vcs +@pytest.mark.install +@pytest.mark.needs_internet +@flaky +def test_ssh_vcs_install(PipenvInstance, pip_src_dir, pypi): + with PipenvInstance(pypi=pypi, chdir=True) as p: + c = p.pipenv("install git+ssh://git@github.com/benjaminp/six.git@1.11.0#egg=six") + assert c.return_code == 0 + assert "six" in p.pipfile["packages"] + assert "git" in p.pipfile["packages"]["six"] + assert p.lockfile["default"]["six"] == { + "git": "ssh://git@github.com/benjaminp/six.git", + "ref": "15e31431af97e5e64b80af0a3f598d382bcdd49a", + } + + @pytest.mark.files @pytest.mark.urls @pytest.mark.needs_internet From 83ca4fbbb3bdf26eafa72c433e3e8d1ae50be8ab Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Thu, 19 Jul 2018 14:10:20 -0400 Subject: [PATCH 07/26] Add test for setup.py::dependency-link field --- tests/integration/test_install_twists.py | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index d2cdd9aa..f6d8706e 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -57,6 +57,48 @@ zip_safe=False assert "six" in p.lockfile["default"] +@pytest.mark.install +@pytest.mark.local +@pytest.mark.needs_internet +@flaky +def test_local_dependency_links_install(PipenvInstance, pypi): + """Ensure dependency_links are parsed and installed (needed for private repo dependencies). + """ + def make_setup(pipenv_instance, deplink): + setup_py = os.path.join(pipenv_instance.path, "setup.py") + with open(setup_py, "w") as fh: + contents = """ +from setuptools import setup + +setup( + name='testdeplinks', + version='0.1', + packages=[], + install_requires=[ + 'test-private-dependency' + ], + dependency_links=[ + '{0}' + ] +) + """.strip().format(deplink) + fh.write(contents) + + def test_deplink(pipenv_instance, deplink): + make_setup(pipenv_instance, deplink) + c = pipenv_instance.pipenv("install -e .") + assert c.return_code == 0 + assert "test-private-dependency" in pipenv_instance.lockfile["default"] + assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] + assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] + + with PipenvInstance(pypi=pypi, chdir=True) as p: + test_deplink(p, 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + + with PipenvInstance(pypi=pypi, chdir=True) as p: + test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + + @pytest.mark.e @pytest.mark.install @pytest.mark.skip(reason="this doesn't work on windows") From e47fd53f9538528914fc273e6a9056b529baba4d Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Fri, 3 Aug 2018 13:04:16 -0700 Subject: [PATCH 08/26] [fixup] skip the git+ssh deplink test if the git+https test works on Build Kite --- tests/integration/test_install_twists.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index f6d8706e..7c06696d 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -95,8 +95,8 @@ setup( with PipenvInstance(pypi=pypi, chdir=True) as p: test_deplink(p, 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') - with PipenvInstance(pypi=pypi, chdir=True) as p: - test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + # with PipenvInstance(pypi=pypi, chdir=True) as p: + # test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') @pytest.mark.e From f1cb2287ab17d340e7214ef939e4f1713a57b20c Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Fri, 3 Aug 2018 13:27:51 -0700 Subject: [PATCH 09/26] Add -v flag to get better insight when it fails --- tests/integration/test_install_twists.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 7c06696d..636d10ee 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -86,7 +86,7 @@ setup( def test_deplink(pipenv_instance, deplink): make_setup(pipenv_instance, deplink) - c = pipenv_instance.pipenv("install -e .") + c = pipenv_instance.pipenv("install -v -e .") assert c.return_code == 0 assert "test-private-dependency" in pipenv_instance.lockfile["default"] assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] From 8f1d99256c71fe4fe2f5500e30be9f74d2b54d51 Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Fri, 3 Aug 2018 12:56:27 -0700 Subject: [PATCH 10/26] Skip git+ssh test until we configure BildKite to have an SSH key-pair --- tests/integration/test_install_uri.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 4a73c1c7..4973b3cb 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -43,8 +43,10 @@ def test_git_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.vcs @pytest.mark.install +@pytest.mark.needs_ssh_keys @pytest.mark.needs_internet @flaky +@pytest.mark.skip(reason="must set valid SSH keys in testing environment") def test_ssh_vcs_install(PipenvInstance, pip_src_dir, pypi): with PipenvInstance(pypi=pypi, chdir=True) as p: c = p.pipenv("install git+ssh://git@github.com/benjaminp/six.git@1.11.0#egg=six") From 0081918e63a2e00d05d470b21c4e3dc7aaee4348 Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Fri, 3 Aug 2018 15:48:21 -0700 Subject: [PATCH 11/26] Skip some tests if we have not set-up SSH keys for GitHub --- tests/integration/conftest.py | 25 +++++++++++++++++++++++++ tests/integration/test_install_uri.py | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 8a8aebe6..9cb4b7b1 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -28,7 +28,30 @@ def check_internet(): return True +def check_github_ssh(): + res = False + try: + # `ssh -T git@github.com` will return successfully with return_code==1 + # and message 'Hi ! You've successfully authenticated, but + # GitHub does not provide shell access.' if ssh keys are available and + # registered with GitHub. Otherwise, the command will fail with + # return_code=255 and say 'Permission denied (publickey).' + c = delegator.run('ssh -T git@github.com') + res = True if c.return_code == 1 else False + except Exception: + pass + if not res: + warnings.warn( + 'Cannot connect to GitHub via SSH', ResourceWarning + ) + warnings.warn( + 'Will skip tests requiring SSH access to GitHub', ResourceWarning + ) + return res + + WE_HAVE_INTERNET = check_internet() +WE_HAVE_GITHUB_SSH_KEYS = check_github_ssh() TESTS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PYPI_VENDOR_DIR = os.path.join(TESTS_ROOT, 'pypi') @@ -38,6 +61,8 @@ prepare_pypi_packages(PYPI_VENDOR_DIR) def pytest_runtest_setup(item): if item.get_marker('needs_internet') is not None and not WE_HAVE_INTERNET: pytest.skip('requires internet') + if item.get_marker('needs_github_ssh') is not None and not WE_HAVE_GITHUB_SSH_KEYS: + pytest.skip('requires github ssh') class _PipenvInstance(object): diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 4973b3cb..c51db6ad 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -43,10 +43,9 @@ def test_git_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.vcs @pytest.mark.install -@pytest.mark.needs_ssh_keys +@pytest.mark.needs_github_ssh @pytest.mark.needs_internet @flaky -@pytest.mark.skip(reason="must set valid SSH keys in testing environment") def test_ssh_vcs_install(PipenvInstance, pip_src_dir, pypi): with PipenvInstance(pypi=pypi, chdir=True) as p: c = p.pipenv("install git+ssh://git@github.com/benjaminp/six.git@1.11.0#egg=six") From 4bfa219985d2338854e3cea31ddd2072c5d47fad Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Sat, 4 Aug 2018 18:16:35 -0400 Subject: [PATCH 12/26] Use proper syntax for rst links Fix link syntax for pep440 links in documentation --- docs/basics.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/basics.rst b/docs/basics.rst index 3db70519..bcd1f89f 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -188,7 +188,9 @@ To tell pipenv to install a specific version of a library, the usage is simple:: This will update your ``Pipfile`` to reflect this requirement, automatically. -For other version specifiers, see `PEP-440 `. +For other version specifiers, see `the relevant section of PEP-440`_. + +.. _`the relevant section of PEP-440`: https://www.python.org/dev/peps/pep-0440/#version-specifiers> ☤ Specifying Versions of Python ------------------------------- From 797ce40bb29fa50cec307240fc4ac2965fa7a047 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Sun, 5 Aug 2018 02:39:00 -0400 Subject: [PATCH 13/26] Add news entry for pr #2674 Signed-off-by: Dan Ryan --- news/2674.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2674.doc diff --git a/news/2674.doc b/news/2674.doc new file mode 100644 index 00000000..33fbd49e --- /dev/null +++ b/news/2674.doc @@ -0,0 +1 @@ +Added a link to ``PEP-440`` version specifiers in the documentation for additional detail. From 0e7ddbccf3beab3bb3c92c55bcbd2ec2ca6f732a Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Sun, 5 Aug 2018 02:49:18 -0400 Subject: [PATCH 14/26] Enable dependency link processing - Use `PIP_PROCESS_DEPENDENCY_LINKS` to toggle the processing of dependency links --- tests/integration/test_install_twists.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 636d10ee..d357805f 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -92,7 +92,8 @@ setup( assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] - with PipenvInstance(pypi=pypi, chdir=True) as p: + with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' test_deplink(p, 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') # with PipenvInstance(pypi=pypi, chdir=True) as p: From 2c39cdb4042fc36fe70fd33d81a0fc2dbc9c54af Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Mon, 6 Aug 2018 10:24:37 -0400 Subject: [PATCH 15/26] Fix typo --- pipenv/environments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/environments.py b/pipenv/environments.py index 0e21ca3b..b6633f39 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -95,7 +95,7 @@ PIPENV_MAX_RETRIES = int(os.environ.get( )) """Specify how many retries Pipenv should attempt for network requests. -Default is 0. Aautomatically set to 1 on CI environments for robust testing. +Default is 0. Automatically set to 1 on CI environments for robust testing. """ PIPENV_MAX_ROUNDS = int(os.environ.get("PIPENV_MAX_ROUNDS", "16")) From 210a9d46fb4fcebe66783e2dfddeec6f0df15a6e Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Mon, 6 Aug 2018 10:04:16 -0700 Subject: [PATCH 16/26] Add back git+ssh version of dep-links test See if it fails n build Kite --- tests/integration/test_install_twists.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index d357805f..ab41906a 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -96,8 +96,9 @@ setup( os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' test_deplink(p, 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') - # with PipenvInstance(pypi=pypi, chdir=True) as p: - # test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' + test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') @pytest.mark.e From 3cc02ebd5d2e2795670853316807607c2b8841cc Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Mon, 6 Aug 2018 10:30:04 -0700 Subject: [PATCH 17/26] Break dependency-links test into two separate tests Use helper functions to reduce code duplication since these two tests are quasi-identical --- tests/integration/test_install_twists.py | 61 +++++++++++++++--------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index ab41906a..5de15a2a 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -57,17 +57,10 @@ zip_safe=False assert "six" in p.lockfile["default"] -@pytest.mark.install -@pytest.mark.local -@pytest.mark.needs_internet -@flaky -def test_local_dependency_links_install(PipenvInstance, pypi): - """Ensure dependency_links are parsed and installed (needed for private repo dependencies). - """ - def make_setup(pipenv_instance, deplink): - setup_py = os.path.join(pipenv_instance.path, "setup.py") - with open(setup_py, "w") as fh: - contents = """ +def helper_dependency_links_install_make_setup(pipenv_instance, deplink): + setup_py = os.path.join(pipenv_instance.path, "setup.py") + with open(setup_py, "w") as fh: + contents = """ from setuptools import setup setup( @@ -81,24 +74,48 @@ setup( '{0}' ] ) - """.strip().format(deplink) - fh.write(contents) + """.strip().format(deplink) + fh.write(contents) - def test_deplink(pipenv_instance, deplink): - make_setup(pipenv_instance, deplink) - c = pipenv_instance.pipenv("install -v -e .") - assert c.return_code == 0 - assert "test-private-dependency" in pipenv_instance.lockfile["default"] - assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] - assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] +def helper_dependency_links_install_test(pipenv_instance, deplink): + helper_dependency_links_install_make_setup(pipenv_instance, deplink) + c = pipenv_instance.pipenv("install -v -e .") + assert c.return_code == 0 + assert "test-private-dependency" in pipenv_instance.lockfile["default"] + assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] + assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] + + +@pytest.mark.install +@pytest.mark.local +@pytest.mark.needs_internet +@flaky +def test_https_dependency_links_install(PipenvInstance, pypi): + """Ensure dependency_links are parsed and installed (needed for private repo dependencies). + """ with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' - test_deplink(p, 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + helper_dependency_links_install_test( + p, + 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' + ) + +@pytest.mark.install +@pytest.mark.local +@pytest.mark.needs_internet +@pytest.mark.needs_github_ssh +@flaky +def test_ssh_dependency_links_install(PipenvInstance, pypi): + """Ensure dependency_links are parsed and installed (needed for private repo dependencies). + """ with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' - test_deplink(p, 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1') + helper_dependency_links_install_test( + p, + 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' + ) @pytest.mark.e From dd3b2108628ed8409524e0b9f76861f6a0d372d1 Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Mon, 6 Aug 2018 10:41:16 -0700 Subject: [PATCH 18/26] Wrap two tests and helpers in a class --- tests/integration/test_install_twists.py | 89 ++++++++++++------------ 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index 5de15a2a..d9e571e1 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -57,10 +57,17 @@ zip_safe=False assert "six" in p.lockfile["default"] -def helper_dependency_links_install_make_setup(pipenv_instance, deplink): - setup_py = os.path.join(pipenv_instance.path, "setup.py") - with open(setup_py, "w") as fh: - contents = """ +class TestDependencyLinks(object): + """Ensure dependency_links are parsed and installed. + + This is needed for private repo dependencies. + """ + + @staticmethod + def helper_dependency_links_install_make_setup(pipenv_instance, deplink): + setup_py = os.path.join(pipenv_instance.path, "setup.py") + with open(setup_py, "w") as fh: + contents = """ from setuptools import setup setup( @@ -74,48 +81,44 @@ setup( '{0}' ] ) - """.strip().format(deplink) - fh.write(contents) + """.strip().format(deplink) + fh.write(contents) + @staticmethod + def helper_dependency_links_install_test(pipenv_instance, deplink): + TestDependencyLinks.helper_dependency_links_install_make_setup(pipenv_instance, deplink) + c = pipenv_instance.pipenv("install -v -e .") + assert c.return_code == 0 + assert "test-private-dependency" in pipenv_instance.lockfile["default"] + assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] + assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] -def helper_dependency_links_install_test(pipenv_instance, deplink): - helper_dependency_links_install_make_setup(pipenv_instance, deplink) - c = pipenv_instance.pipenv("install -v -e .") - assert c.return_code == 0 - assert "test-private-dependency" in pipenv_instance.lockfile["default"] - assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] - assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] + @pytest.mark.install + @pytest.mark.local + @pytest.mark.needs_internet + @flaky + def test_https_dependency_links_install(self, PipenvInstance, pypi): + """Ensure dependency_links are parsed and installed (needed for private repo dependencies). + """ + with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' + TestDependencyLinks.helper_dependency_links_install_test( + p, + 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' + ) - -@pytest.mark.install -@pytest.mark.local -@pytest.mark.needs_internet -@flaky -def test_https_dependency_links_install(PipenvInstance, pypi): - """Ensure dependency_links are parsed and installed (needed for private repo dependencies). - """ - with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: - os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' - helper_dependency_links_install_test( - p, - 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' - ) - - -@pytest.mark.install -@pytest.mark.local -@pytest.mark.needs_internet -@pytest.mark.needs_github_ssh -@flaky -def test_ssh_dependency_links_install(PipenvInstance, pypi): - """Ensure dependency_links are parsed and installed (needed for private repo dependencies). - """ - with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: - os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' - helper_dependency_links_install_test( - p, - 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' - ) + @pytest.mark.install + @pytest.mark.local + @pytest.mark.needs_internet + @pytest.mark.needs_github_ssh + @flaky + def test_ssh_dependency_links_install(self, PipenvInstance, pypi): + with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' + TestDependencyLinks.helper_dependency_links_install_test( + p, + 'git+ssh://git@github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' + ) @pytest.mark.e From 86bbec18d9a6dbd58be5e15bf5c47bbd74c8d69b Mon Sep 17 00:00:00 2001 From: Alexandros Tzannes Date: Mon, 6 Aug 2018 10:44:10 -0700 Subject: [PATCH 19/26] Factor-out decorators for class tests --- tests/integration/test_install_twists.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index d9e571e1..8653e2c0 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -57,6 +57,10 @@ zip_safe=False assert "six" in p.lockfile["default"] +@pytest.mark.install +@pytest.mark.local +@pytest.mark.needs_internet +@flaky class TestDependencyLinks(object): """Ensure dependency_links are parsed and installed. @@ -93,10 +97,6 @@ setup( assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] - @pytest.mark.install - @pytest.mark.local - @pytest.mark.needs_internet - @flaky def test_https_dependency_links_install(self, PipenvInstance, pypi): """Ensure dependency_links are parsed and installed (needed for private repo dependencies). """ @@ -107,11 +107,7 @@ setup( 'git+https://github.com/atzannes/test-private-dependency@v0.1#egg=test-private-dependency-v0.1' ) - @pytest.mark.install - @pytest.mark.local - @pytest.mark.needs_internet @pytest.mark.needs_github_ssh - @flaky def test_ssh_dependency_links_install(self, PipenvInstance, pypi): with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' From c6742a84305ed5dae6c0d3b95eba0404e85cd5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B6=E4=BB=B6?= Date: Tue, 7 Aug 2018 09:33:21 +0800 Subject: [PATCH 20/26] Minor tense changes with basics.rst --- docs/basics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basics.rst b/docs/basics.rst index 8d7ff825..678f58a4 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -326,7 +326,7 @@ You should do this for your shell too, in your ``~/.profile`` or ``~/.bashrc`` o .. note:: The shell launched in interactive mode. This means that if your shell reads its configuration from a specific file for interactive mode (e.g. bash by default looks for a ``~/.bashrc`` configuration file for interactive mode), then you'll need to modify (or create) this file. -If you get something wrong with ``$ pipenv shell``, just check ``PIPENV_SHELL`` environment variable, ``$ pipenv shell`` will use it if available. For detail, see :ref:`configuration-with-environment-variables`. +If you experience issues with ``$ pipenv shell``, just check the ``PIPENV_SHELL`` environment variable, which ``$ pipenv shell`` will use if available. For detail, see :ref:`configuration-with-environment-variables`. ☤ A Note about VCS Dependencies ------------------------------- From f9471d8e7e533bc71e00ca622609c15f4ffb2eab Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 7 Aug 2018 12:13:14 +0800 Subject: [PATCH 21/26] Fix Jinja2 mismatching --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 92110aa5..71c58644 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -7,7 +7,7 @@ docutils==0.14 first==2.0.1 idna==2.6 imagesize==0.7.1 -Jinja2==2.9.6 +Jinja2==2.10 MarkupSafe==1.0 pbr==3.1.1 pip-tools==1.9.0 From 1a5133c6f8457576a64b593c8ac577aba9771970 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 7 Aug 2018 12:14:35 +0800 Subject: [PATCH 22/26] Fix spaces in the warning message --- pipenv/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index db60ee94..e84bafd5 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -550,8 +550,8 @@ def ensure_project( ): click.echo( "{0}: Your Pipfile requires {1} {2}, " - "but you are using {3} ({4}). Running" - "{5} and rebuilding the virtual environment" + "but you are using {3} ({4}). Running " + "{5} and rebuilding the virtual environment " "may resolve the issue".format( crayons.red("Warning", bold=True), crayons.normal("python_version", bold=True), From 908ad9d1bcb49eed20f6e439fd24f9c3a26db3c9 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 7 Aug 2018 12:21:49 +0800 Subject: [PATCH 23/26] Split the message into multiple lines --- pipenv/core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index e84bafd5..31adf699 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -550,15 +550,19 @@ def ensure_project( ): click.echo( "{0}: Your Pipfile requires {1} {2}, " - "but you are using {3} ({4}). Running " - "{5} and rebuilding the virtual environment " - "may resolve the issue".format( + "but you are using {3} ({4}).".format( crayons.red("Warning", bold=True), crayons.normal("python_version", bold=True), crayons.blue(project.required_python_version), crayons.blue(python_version(path_to_python)), crayons.green(shorten_path(path_to_python)), - crayons.green("`pipenv --rm`"), + ), + err=True, + ) + click.echo( + " {0} and rebuilding the virtual environment " + "may resolve the issue.".format( + crayons.green("$ pipenv --rm"), ), err=True, ) From 92caefcb96a0d29c6e76db0b0e03484f0847bfa8 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 10 Aug 2018 04:41:12 -0400 Subject: [PATCH 24/26] Add news entry for #2671 --- news/2671.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2671.doc diff --git a/news/2671.doc b/news/2671.doc new file mode 100644 index 00000000..859cc377 --- /dev/null +++ b/news/2671.doc @@ -0,0 +1 @@ +Added additional information about troubleshooting ``pipenv shell`` by using the the ``$PIPENV_SHELL`` environment variable. From a646b836bf791c54221049ce03111d9d5905e687 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sun, 12 Aug 2018 04:27:22 +0800 Subject: [PATCH 25/26] Correctly pass verbosity to resolver --- pipenv/resolver.py | 13 ++++++++++--- pipenv/utils.py | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pipenv/resolver.py b/pipenv/resolver.py index e4c9b09b..6526d990 100644 --- a/pipenv/resolver.py +++ b/pipenv/resolver.py @@ -22,6 +22,7 @@ def which(*args, **kwargs): def main(): do_pre = "--pre" in " ".join(sys.argv) do_clear = "--clear" in " ".join(sys.argv) + is_verbose = "--verbose" in " ".join(sys.argv) is_debug = "--debug" in " ".join(sys.argv) system = "--system" in " ".join(sys.argv) new_sys_argv = [] @@ -35,11 +36,17 @@ def main(): os.environ["PIP_PYTHON_VERSION"] = ".".join([str(s) for s in sys.version_info[:3]]) os.environ["PIP_PYTHON_PATH"] = sys.executable - if int(os.environ.get("PIPENV_VERBOSITY", 0)) > 0: - logging.getLogger("notpip").setLevel(logging.INFO) + + verbosity = int(os.environ.get("PIPENV_VERBOSITY", 0)) if is_debug: - # Shit's getting real at this point. + verbosity = max(verbosity, 2) + elif is_verbose: + verbosity = max(verbosity, 1) + if verbosity > 1: # Shit's getting real at this point. logging.getLogger("notpip").setLevel(logging.DEBUG) + elif verbosity > 0: + logging.getLogger("notpip").setLevel(logging.INFO) + if "PIPENV_PACKAGES" in os.environ: packages = os.environ["PIPENV_PACKAGES"].strip().split("\n") else: diff --git a/pipenv/utils.py b/pipenv/utils.py index 1f0f4ef4..9d0427b7 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -352,11 +352,10 @@ def venv_resolve_deps( if not deps: return [] resolver = escape_grouped_arguments(resolver.__file__.rstrip("co")) - cmd = "{0} {1} {2} {3} {4} {5}".format( + cmd = "{0} {1} {2} {3} {4}".format( escape_grouped_arguments(which("python", allow_global=allow_global)), resolver, "--pre" if pre else "", - "--verbose" if (environments.is_verbose()) else "", "--clear" if clear else "", "--system" if allow_global else "", ) @@ -364,6 +363,7 @@ def venv_resolve_deps( os.environ["PIPENV_PACKAGES"] = "\n".join(deps) if pypi_mirror: os.environ["PIPENV_PYPI_MIRROR"] = str(pypi_mirror) + os.environ["PIPENV_VERBOSITY"] = str(environments.PIPENV_VERBOSITY) c = delegator.run(cmd, block=True) try: assert c.return_code == 0 From f4f8f10f2ededf0d8ffbb0a7e138ee4ab9738975 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sun, 12 Aug 2018 04:36:46 +0800 Subject: [PATCH 26/26] News --- news/2732.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2732.bugfix diff --git a/news/2732.bugfix b/news/2732.bugfix new file mode 100644 index 00000000..d1cf591b --- /dev/null +++ b/news/2732.bugfix @@ -0,0 +1 @@ +Correctly pass `verbose` and `debug` flags to the resolver subprocess so it generates appropriate output. This also resolves a bug introduced by the fix to #2527.