From c794e7e566290fc1d3c14de20069ca2a6354cb2f Mon Sep 17 00:00:00 2001 From: Rohan Talip Date: Mon, 17 Dec 2018 15:22:36 -0800 Subject: [PATCH 01/10] Replaced double hyphens with a single hyphen --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 740f11d5..c3a46889 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ Pipenv: Python Development Workflow for Humans **Pipenv** is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. -*Windows is a first--class citizen, in our world.* +*Windows is a first-class citizen, in our world.* It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your `Pipfile` as you -install/uninstall packages. It also generates the ever--important +install/uninstall packages. It also generates the ever-important `Pipfile.lock`, which is used to produce deterministic builds. ![image](http://media.kennethreitz.com.s3.amazonaws.com/pipenv.gif) From 976c04cb2a3e7603245c4881cf6dd67021d3a8a1 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 29 Dec 2018 21:06:21 -0500 Subject: [PATCH 02/10] Remove Python 2.6 dependencies from setup.py Support for Python 2.6 was removed in (or before) 47604c644bf18bbbb39800833fcf0dd96526f1eb. Therefore, no need to include these dependencies. --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 6583cff1..069a5252 100644 --- a/setup.py +++ b/setup.py @@ -27,8 +27,6 @@ required = [ "setuptools>=36.2.1", "virtualenv-clone>=0.2.5", "virtualenv", - 'requests[security];python_version<"2.7"', - 'ordereddict;python_version<"2.7"', 'enum34; python_version<"3"', 'typing; python_version<"3.5"' ] From 37c79915dfc6a86627133a47ef2491dca32edf39 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 4 Jan 2019 21:44:11 +0800 Subject: [PATCH 03/10] Remove typing dep --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6583cff1..dd73dafd 100644 --- a/setup.py +++ b/setup.py @@ -29,8 +29,7 @@ required = [ "virtualenv", 'requests[security];python_version<"2.7"', 'ordereddict;python_version<"2.7"', - 'enum34; python_version<"3"', - 'typing; python_version<"3.5"' + 'enum34; python_version<"3"' ] From ba9f5057b8505c2d7e5d842bfad0117cb0f04613 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Wed, 9 Jan 2019 10:07:26 +0800 Subject: [PATCH 04/10] Populate source when getting lockfile --- news/3427.bugfix.rst | 1 + pipenv/project.py | 2 +- tests/integration/test_lock.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 news/3427.bugfix.rst diff --git a/news/3427.bugfix.rst b/news/3427.bugfix.rst new file mode 100644 index 00000000..42f659f0 --- /dev/null +++ b/news/3427.bugfix.rst @@ -0,0 +1 @@ +Fix a bug that ``ValidationError`` is thrown when some fields are missing in source section. diff --git a/pipenv/project.py b/pipenv/project.py index e8550a04..edbcff87 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -780,7 +780,7 @@ class Project(object): return { "hash": {"sha256": self.calculate_pipfile_hash()}, "pipfile-spec": PIPFILE_SPEC_CURRENT, - "sources": sources, + "sources": [self.populate_source(s) for s in sources], "requires": self.parsed_pipfile.get("requires", {}) } diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index ab5178a0..75095ac0 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -491,6 +491,7 @@ def test_lockfile_with_empty_dict(PipenvInstance): @pytest.mark.lock +@pytest.mark.skip_lock @pytest.mark.install def test_lock_with_incomplete_source(PipenvInstance, pypi): with PipenvInstance(pypi=pypi, chdir=True) as p: @@ -502,6 +503,8 @@ url = "https://test.pypi.org/simple" [packages] requests = "*" """) + c = p.pipenv('install --skip-lock') + assert c.return_code == 0 c = p.pipenv('install') assert c.return_code == 0 assert p.lockfile['_meta']['sources'] From 32981ac83b4f9167fca5438cd2d5bf63873de27a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 10 Jan 2019 13:10:32 -0500 Subject: [PATCH 05/10] Create PEEP-003.md --- peeps/PEEP-003.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 peeps/PEEP-003.md diff --git a/peeps/PEEP-003.md b/peeps/PEEP-003.md new file mode 100644 index 00000000..d0493eaa --- /dev/null +++ b/peeps/PEEP-003.md @@ -0,0 +1,9 @@ +# PEEP-003: Revocation of Power of BDFL + +**ACCEPTED** + +Pipenv will be governed by a board of maintainers (trusted collaborators to the project on GitHub), not a BDFL. + +The BDFL retains his title, however, revokes himself of his powers. + +PEEP approval will be determined by available members of the board of maintainers, in private or public channels. From 18fe121d506c45e61a582b8c95280b632c811ae6 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Sun, 13 Jan 2019 20:11:46 -0800 Subject: [PATCH 06/10] core: nonexistent virtualenv warning msg: add missing space --- pipenv/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/core.py b/pipenv/core.py index 4fb7939e..b49ae1e9 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2491,7 +2491,7 @@ def do_graph(bare=False, json=False, json_tree=False, reverse=False): if not project.virtualenv_exists: click.echo( u"{0}: No virtualenv has been created for this project yet! Consider " - u"running {1} first to automatically generate one for you or see" + u"running {1} first to automatically generate one for you or see " u"{2} for further instructions.".format( crayons.red("Warning", bold=True), crayons.green("`pipenv install`"), From bd1bebb9578351645fec0def3fb3d4eefa72320b Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 17 Jan 2019 09:41:35 +0800 Subject: [PATCH 07/10] Fix order of hashes --- news/3446.trivial.rst | 1 + pipenv/core.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 news/3446.trivial.rst diff --git a/news/3446.trivial.rst b/news/3446.trivial.rst new file mode 100644 index 00000000..1eb98bbb --- /dev/null +++ b/news/3446.trivial.rst @@ -0,0 +1 @@ +Fix the wrong order of old and new hashes in message. diff --git a/pipenv/core.py b/pipenv/core.py index b49ae1e9..0cbb956b 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1186,9 +1186,9 @@ def do_init( ) else: if old_hash: - msg = fix_utf8("Pipfile.lock ({1}) out of date, updating to ({0})…") + msg = fix_utf8("Pipfile.lock ({0}) out of date, updating to ({1})…") else: - msg = fix_utf8("Pipfile.lock is corrupted, replaced with ({0})…") + msg = fix_utf8("Pipfile.lock is corrupted, replaced with ({1})…") click.echo( crayons.red(msg.format(old_hash[-6:], new_hash[-6:]), bold=True), err=True, From b60439db370e1f40f0a0ff3b03547c877b938c75 Mon Sep 17 00:00:00 2001 From: Adam Goldschmidt Date: Wed, 16 Jan 2019 20:21:03 +0200 Subject: [PATCH 08/10] handle non-URL sources - raise PipenvUsageError --- news/2373.bugfix.rst | 1 + pipenv/utils.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 news/2373.bugfix.rst diff --git a/news/2373.bugfix.rst b/news/2373.bugfix.rst new file mode 100644 index 00000000..2cc1c251 --- /dev/null +++ b/news/2373.bugfix.rst @@ -0,0 +1 @@ +Raise `PipenvUsageError` when [[source]] does not contain url field. \ No newline at end of file diff --git a/pipenv/utils.py b/pipenv/utils.py index 08847e59..87f36d1b 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -31,6 +31,7 @@ import crayons import parse from . import environments +from .exceptions import PipenvUsageError from .pep508checker import lookup @@ -203,20 +204,23 @@ def prepare_pip_source_args(sources, pip_args=None): pip_args = [] if sources: # Add the source to notpip. - pip_args.extend(["-i", sources[0]["url"]]) + package_url = sources[0].get("url") + if not package_url: + raise PipenvUsageError("Please provide a source URL.") + pip_args.extend(["-i", package_url]) # Trust the host if it's not verified. if not sources[0].get("verify_ssl", True): pip_args.extend( - ["--trusted-host", urllib3_util.parse_url(sources[0]["url"]).host] + ["--trusted-host", urllib3_util.parse_url(package_url).host] ) # Add additional sources as extra indexes. if len(sources) > 1: for source in sources[1:]: - pip_args.extend(["--extra-index-url", source["url"]]) + pip_args.extend(["--extra-index-url", source.get("url")]) # Trust the host if it's not verified. if not source.get("verify_ssl", True): pip_args.extend( - ["--trusted-host", urllib3_util.parse_url(source["url"]).host] + ["--trusted-host", urllib3_util.parse_url(source.get("url")).host] ) return pip_args From 3b4c592f30140f63ecef6121973eddae07552632 Mon Sep 17 00:00:00 2001 From: Adam Goldschmidt Date: Wed, 16 Jan 2019 20:29:19 +0200 Subject: [PATCH 09/10] add test to invalid prepare_pip_source_args and change error to be more descriptive. (+1 squashed commit) Squashed commits: [b00fb5ba] fixed test getting empty URL in source --- pipenv/utils.py | 9 ++++++--- tests/unit/test_utils.py | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pipenv/utils.py b/pipenv/utils.py index 87f36d1b..5ed21264 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -206,7 +206,7 @@ def prepare_pip_source_args(sources, pip_args=None): # Add the source to notpip. package_url = sources[0].get("url") if not package_url: - raise PipenvUsageError("Please provide a source URL.") + raise PipenvUsageError("[[source]] section does not contain a URL.") pip_args.extend(["-i", package_url]) # Trust the host if it's not verified. if not sources[0].get("verify_ssl", True): @@ -216,11 +216,14 @@ def prepare_pip_source_args(sources, pip_args=None): # Add additional sources as extra indexes. if len(sources) > 1: for source in sources[1:]: - pip_args.extend(["--extra-index-url", source.get("url")]) + url = source.get("url") + if not url: # not harmless, just don't continue + continue + pip_args.extend(["--extra-index-url", url]) # Trust the host if it's not verified. if not source.get("verify_ssl", True): pip_args.extend( - ["--trusted-host", urllib3_util.parse_url(source.get("url")).host] + ["--trusted-host", urllib3_util.parse_url(url).host] ) return pip_args diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index aeaf3ed3..ac5eb29b 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -8,6 +8,7 @@ from mock import Mock, patch import pipenv.utils import pythonfinder.utils +from pipenv.exceptions import PipenvUsageError # Pipfile format <-> requirements.txt format. @@ -374,6 +375,11 @@ twine = "*" == expected_args ) + def test_invalid_prepare_pip_source_args(self): + sources = [{}] + with pytest.raises(PipenvUsageError): + pipenv.utils.prepare_pip_source_args(sources, pip_args=None) + @pytest.mark.utils def test_parse_python_version(self): ver = pipenv.utils.parse_python_version("Python 3.6.5\n") From c3e3cfb0152bb0dbf789db5499488cbd867f12a8 Mon Sep 17 00:00:00 2001 From: Adam Goldschmidt Date: Wed, 16 Jan 2019 21:26:38 +0200 Subject: [PATCH 10/10] add .news file to describe the fix --- news/2373.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/2373.bugfix.rst b/news/2373.bugfix.rst index 2cc1c251..9b42add1 100644 --- a/news/2373.bugfix.rst +++ b/news/2373.bugfix.rst @@ -1 +1 @@ -Raise `PipenvUsageError` when [[source]] does not contain url field. \ No newline at end of file +Raise `PipenvUsageError` when [[source]] does not contain url field.