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 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 02/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 03/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 d49c35de78661b19ced7c428ded1a5e33403bc12 Mon Sep 17 00:00:00 2001 From: gzagatti Date: Thu, 2 Aug 2018 11:59:42 -0400 Subject: [PATCH 04/26] Improves message when dependencies could not be resolved. --- pipenv/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index 1f0f4ef4..f16d9a16 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -310,11 +310,13 @@ def actually_resolve_deps( click_echo( "{0}: Your dependencies could not be resolved. You likely have a " "mismatch in your sub-dependencies.\n " - "You can use {1} to bypass this mechanism, then run {2} to inspect " - "the situation.\n " - "Hint: try {3} if it is a pre-release dependency." + "First try clearing your dependency cache with {1} and trying again.\n " + "Alternatively, you can use {2} to bypass this mechanism, then run " + "{3} to inspect the situation.\n " + "Hint: try {4} if it is a pre-release dependency." "".format( crayons.red("Warning", bold=True), + crayons.red("$ pipenv lock --clear"), crayons.red("$ pipenv install --skip-lock"), crayons.red("$ pipenv graph"), crayons.red("$ pipenv lock --pre"), From 9070a6b92d7bc1fdcae8d7ac02d369a2ffacfec1 Mon Sep 17 00:00:00 2001 From: Jeremy Spencer Date: Fri, 3 Aug 2018 11:14:58 -0400 Subject: [PATCH 05/26] Added an example to README.md for installing from git --- README.md | 9 +++++++++ news/2685.doc | 1 + 2 files changed, 10 insertions(+) create mode 100644 news/2685.doc diff --git a/README.md b/README.md index 9c2f00b3..b552925a 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,15 @@ Install packages: To activate this project's virtualenv, run the following: $ pipenv shell +Install from git: + + $ pipenv install -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests + Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests… + ... + Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]... + +You can also change the tag/ref (or exclude to get the latest version) by adding @version-or-tag before #egg=project_name + Install a dev dependency: $ pipenv install pytest --dev diff --git a/news/2685.doc b/news/2685.doc new file mode 100644 index 00000000..6f2a0aff --- /dev/null +++ b/news/2685.doc @@ -0,0 +1 @@ +Added simple example to README.md for installing from git. From 484340b8294fdb9a8a5a39f01832b463281572e7 Mon Sep 17 00:00:00 2001 From: gzagatti Date: Fri, 3 Aug 2018 12:08:57 -0400 Subject: [PATCH 06/26] Fixes grammar. --- pipenv/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index f16d9a16..2187ea68 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -310,7 +310,7 @@ def actually_resolve_deps( click_echo( "{0}: Your dependencies could not be resolved. You likely have a " "mismatch in your sub-dependencies.\n " - "First try clearing your dependency cache with {1} and trying again.\n " + "First try clearing your dependency cache with {1}, then try the original command again.\n " "Alternatively, you can use {2} to bypass this mechanism, then run " "{3} to inspect the situation.\n " "Hint: try {4} if it is a pre-release dependency." 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 0e7ddbccf3beab3bb3c92c55bcbd2ec2ca6f732a Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Sun, 5 Aug 2018 02:49:18 -0400 Subject: [PATCH 10/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 11/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 12/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 13/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 14/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 15/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 16/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 17/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 18/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 19/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 20/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 21/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 22/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. From a3162945be79182d0a4b4a7c140970dc340788fb Mon Sep 17 00:00:00 2001 From: Jeremy Spencer Date: Sun, 12 Aug 2018 16:15:17 -0400 Subject: [PATCH 23/26] mend --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b552925a..b6ef6e56 100644 --- a/README.md +++ b/README.md @@ -216,14 +216,30 @@ Install packages: To activate this project's virtualenv, run the following: $ pipenv shell -Install from git: +Installing from git: - $ pipenv install -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests - Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests… - ... +You can install packages with pipenv from git and other version control systems using URLs formatted according to the following rule: + +``` + +:////@# +``` + +The only optional section is the `@` section. When using git over SSH, you may use the shorthand vcs and scheme alias `git+git@:/@#`. Note that this is translated to `git+ssh://git@` when parsed. + +Valid values for `` include `git`, `bzr`, `svn`, and `hg`. Valid values for `` include `http,`, `https`, `ssh`, and `file`. In specific cases you also have access to other schemes: `svn` may be combined with `svn` as a scheme, and `bzr` can be combined with `sftp` and `lp`. + +Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies. + +Below is an example usage which installs the git repository located at `https://github.com/requests/requests.git` from tag `v2.19.1` as package name `requests`: + +```console + $ pipenv install -e git+https://github.com/requests/requests.git@v2.19#egg=requests + Creating a Pipfile for this project... + Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests... + [...snipped...] Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]... - -You can also change the tag/ref (or exclude to get the latest version) by adding @version-or-tag before #egg=project_name + [...] +``` Install a dev dependency: From 1188a3de34159b54cb747b346b5770e36e44e6d5 Mon Sep 17 00:00:00 2001 From: Jeremy Spencer Date: Mon, 13 Aug 2018 08:51:39 -0400 Subject: [PATCH 24/26] Updated for PR #2702. Added in request from user @uranusjr for pip documentation on vcs support and @slhck request for more consistent formatting of code blocks and more explict instructions for editable mode when installing from vcs --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b6ef6e56..16b72034 100644 --- a/README.md +++ b/README.md @@ -220,26 +220,24 @@ Installing from git: You can install packages with pipenv from git and other version control systems using URLs formatted according to the following rule: -``` +:////@# -``` The only optional section is the `@` section. When using git over SSH, you may use the shorthand vcs and scheme alias `git+git@:/@#`. Note that this is translated to `git+ssh://git@` when parsed. Valid values for `` include `git`, `bzr`, `svn`, and `hg`. Valid values for `` include `http,`, `https`, `ssh`, and `file`. In specific cases you also have access to other schemes: `svn` may be combined with `svn` as a scheme, and `bzr` can be combined with `sftp` and `lp`. -Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies. +Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode, using `pipenv install -e`, in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies. Below is an example usage which installs the git repository located at `https://github.com/requests/requests.git` from tag `v2.19.1` as package name `requests`: -```console $ pipenv install -e git+https://github.com/requests/requests.git@v2.19#egg=requests Creating a Pipfile for this project... Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests... [...snipped...] Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]... [...] -``` + +You can read more about [pip's implementation of vcs support here](https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support). Install a dev dependency: From 438fc6039777e23f4918882d1dbc74ec45f52784 Mon Sep 17 00:00:00 2001 From: Oliver Newman Date: Wed, 15 Aug 2018 16:22:45 -0700 Subject: [PATCH 25/26] Move misformatted comments Black moved a couple comments to some funky places; this moves them back to the lines to which they refer. --- pipenv/progress.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pipenv/progress.py b/pipenv/progress.py index 4cea195c..c126fe73 100644 --- a/pipenv/progress.py +++ b/pipenv/progress.py @@ -113,9 +113,10 @@ class Bar(object): self.etadisp = self.format_time(self.eta) x = int(self.width * progress / self.expected_size) if not self.hide: - if (progress % self.every) == 0 or ( # True every "every" updates - progress == self.expected_size - ): # And when we're done + if ( + progress % self.every == 0 # True every "every" updates + or progress == self.expected_size # And when we're done + ): STREAM.write( BAR_TEMPLATE % ( @@ -208,9 +209,10 @@ def mill(it, label="", hide=None, expected_size=None, every=1): def _show(_i): if not hide: - if (_i % every) == 0 or ( - _i == count - ): # True every "every" updates # And when we're done + if ( + _i % every == 0 # True every "every" updates + or _i == count # And when we're done + ): STREAM.write(MILL_TEMPLATE % (label, _mill_char(_i), _i, count)) STREAM.flush() From a4ad13e52b8f0e4499196d1e8bc17fcd8be9b868 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 17 Aug 2018 16:34:28 -0400 Subject: [PATCH 26/26] Update readme images, port readme add news Signed-off-by: Dan Ryan --- README.md | 6 +++--- docs/basics.rst | 23 ++++++++++++++++++----- news/2696.trivial | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 news/2696.trivial diff --git a/README.md b/README.md index 16b72034..5a5d4ca5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ Pipenv: Python Development Workflow for Humans ============================================== -[![image](https://img.shields.io/pypi/v/pipenv.svg)](https://pypi.python.org/pypi/pipenv) -[![image](https://img.shields.io/pypi/l/pipenv.svg)](https://pypi.python.org/pypi/pipenv) +[![image](https://img.shields.io/pypi/v/pipenv.svg)](https://python.org/pypi/pipenv) +[![image](https://img.shields.io/pypi/l/pipenv.svg)](https://python.org/pypi/pipenv) [![image](https://badge.buildkite.com/79c7eccf056b17c3151f3c4d0e4c4b8b724539d84f1e037b9b.svg?branch=master)](https://code.kennethreitz.org/source/pipenv/) -[![image](https://img.shields.io/pypi/pyversions/pipenv.svg)](https://pypi.python.org/pypi/pipenv) +[![image](https://img.shields.io/pypi/pyversions/pipenv.svg)](https://python.org/pypi/pipenv) [![image](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/kennethreitz) ------------------------------------------------------------------------ diff --git a/docs/basics.rst b/docs/basics.rst index a38d3403..e6afea3f 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -334,17 +334,30 @@ If you experience issues with ``$ pipenv shell``, just check the ``PIPENV_SHELL` ☤ A Note about VCS Dependencies ------------------------------- -Pipenv will resolve the sub–dependencies of VCS dependencies, but only if they are installed in editable mode:: +You can install packages with pipenv from git and other version control systems using URLs formatted according to the following rule:: - $ pipenv install -e git+https://github.com/requests/requests.git#egg=requests + +:////@# + +The only optional section is the ``@`` section. When using git over SSH, you may use the shorthand vcs and scheme alias ``git+git@:/@#``. Note that this is translated to ``git+ssh://git@`` when parsed. + +Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode, using ``pipenv install -e``, in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies. + +Below is an example usage which installs the git repository located at ``https://github.com/requests/requests.git`` from tag ``v2.19.1`` as package name ``requests``:: + + $ pipenv install -e git+https://github.com/requests/requests.git@v2.19#egg=requests + Creating a Pipfile for this project... + Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests... + [...snipped...] + Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]... + [...] $ cat Pipfile [packages] - requests = {git = "https://github.com/requests/requests.git", editable=true} + requests = {git = "https://github.com/requests/requests.git", editable = true, ref = "2.19.1"} -If editable is not true, sub–dependencies will not be resolved. +Valid values for ```` include ``git``, ``bzr``, ``svn``, and ``hg``. Valid values for ```` include ``http``, ``https``, ``ssh``, and ``file``. In specific cases you also have access to other schemes: ``svn`` may be combined with ``svn`` as a scheme, and ``bzr`` can be combined with ``sftp`` and ``lp``. -For more information about other options available when specifying VCS dependencies, please check the `Pipfile spec `__. +You can read more about pip's implementation of VCS support `here `_. For more information about other options available when specifying VCS dependencies, please check the `Pipfile spec `_. ☤ Pipfile.lock Security Features diff --git a/news/2696.trivial b/news/2696.trivial new file mode 100644 index 00000000..dc68eca0 --- /dev/null +++ b/news/2696.trivial @@ -0,0 +1 @@ +Added additional information to error messaging during failed resolution.