From ef4be482a68af578a48513a68723a584a30b9606 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 30 Oct 2018 01:03:07 -0400 Subject: [PATCH 01/18] conditional builds Signed-off-by: Dan Ryan --- .vsts-ci/linux.yml | 19 +++++++++++++++++++ .vsts-ci/windows.yml | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 7968801c..95c62dc5 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -1,3 +1,22 @@ +name: Pipenv Build Rules +trigger: + batch: true + branches: + include: + - master + paths: + exclude: + - docs/* + - news/* + - README.md + - pipenv/*.txt + - CHANGELOG.rst + - CONTRIBUTING.md + - CODE_OF_CONDUCT.md + - .gitignore + - .gitattributes + - .editorconfig + phases: - template: phases/test.yml parameters: diff --git a/.vsts-ci/windows.yml b/.vsts-ci/windows.yml index a397a23c..e423c3ab 100644 --- a/.vsts-ci/windows.yml +++ b/.vsts-ci/windows.yml @@ -1,3 +1,22 @@ +name: Pipenv Build Rules +trigger: + batch: true + branches: + include: + - master + paths: + exclude: + - docs/* + - news/* + - README.md + - pipenv/*.txt + - CHANGELOG.rst + - CONTRIBUTING.md + - CODE_OF_CONDUCT.md + - .gitignore + - .gitattributes + - .editorconfig + phases: - template: phases/test.yml parameters: From e8231dc756aa85ba019a23fce035032c56e38c2a Mon Sep 17 00:00:00 2001 From: jr7square Date: Thu, 4 Oct 2018 20:40:45 -0400 Subject: [PATCH 02/18] Provide a good message for error described in issue #2846 --- pipenv/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pipenv/core.py b/pipenv/core.py index 59b9a29c..e1243d79 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1775,6 +1775,9 @@ def do_install( # Don't search for requirements.txt files if the user provides one if requirements or package_args or project.pipfile_exists: skip_requirements = True + # Don't attempt to install develop and default packages if Pipfile is missing + if not project.pipfile_exists and not packages and dev: + click.echo("Could not find Pipfile.", err=True) concurrent = not sequential # Ensure that virtualenv is available. ensure_project( From 5caf9ac367b326aa631241e979759fddd061750d Mon Sep 17 00:00:00 2001 From: jr7square Date: Fri, 5 Oct 2018 20:16:23 -0400 Subject: [PATCH 03/18] aborting execution --- pipenv/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pipenv/core.py b/pipenv/core.py index e1243d79..b23534d6 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1778,6 +1778,7 @@ def do_install( # Don't attempt to install develop and default packages if Pipfile is missing if not project.pipfile_exists and not packages and dev: click.echo("Could not find Pipfile.", err=True) + sys.exit(1) concurrent = not sequential # Ensure that virtualenv is available. ensure_project( From 167c417183a3a747965ceb9fb0ff2b1da9b3696a Mon Sep 17 00:00:00 2001 From: Jeremy Carroll Date: Sun, 21 Oct 2018 21:56:15 -0700 Subject: [PATCH 04/18] Documenting how I got the tests to run --- docs/dev/contributing.rst | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index 4cbb9e3f..ac36a0f7 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -67,7 +67,7 @@ Steps for Submitting Code When contributing code, you'll want to follow this checklist: 1. Fork the repository on GitHub. -2. Run the tests to confirm they all pass on your system. If they don't, you'll +2. `Run the tests`_ to confirm they all pass on your system. If they don't, you'll need to investigate why they fail. If you're unable to diagnose this yourself, raise it as a bug report by following the guidelines in this document: :ref:`bug-reports`. @@ -120,3 +120,38 @@ hasn't been reported before. Duplicate bug reports are a huge drain on the time of other contributors, and should be avoided as much as possible. .. _GitHub issues: https://github.com/pypa/pipenv/issues + +Run the tests +------------- + +Three ways of running the tests are as follows: + +1. ``make test`` (which uses ``docker``) +2. ``./run-tests.sh`` +3. Using pipenv:: + + pipenv install --dev + pipenv run py.test + +For the last two, it is important that your environment is setup correctly, and +this may take some work, for example, on a specific Mac installation, the following +steps may be needed:: + + # Make sure the tests can access github + if [ "$SSH_AGENT_PID" = "" ] + then + eval `ssh-agent` + ssh-add + fi + + # Use unix like utilities, installed with brew, + # e.g. brew install coreutils + for d in /usr/local/opt/*/libexec/gnubin /usr/local/opt/python/libexec/bin + do + [[ ":$PATH:" != *":$d:"* ]] && PATH="$d:${PATH}" + done + + export PATH + + # PIP_FIND_LINKS currently broken + unset PIP_FIND_LINKS From cb5e1bd9d5ed4e95b3d954cb8368e5f0dbbb2f80 Mon Sep 17 00:00:00 2001 From: Jeremy Carroll Date: Sun, 21 Oct 2018 21:57:28 -0700 Subject: [PATCH 05/18] Ignore pycharm project --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2cee5455..4809d065 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,9 @@ venv.bak/ .spyderproject .spyproject +# PyCharm project settings +.idea + # Rope project settings .ropeproject From dd8c61addbab7c8f3abc7a7e6ced6e3c80c57099 Mon Sep 17 00:00:00 2001 From: Jeremy Carroll Date: Mon, 22 Oct 2018 07:03:47 -0700 Subject: [PATCH 06/18] More specific comment about PIP_FIND_LINKS --- docs/dev/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index ac36a0f7..effbec1f 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -153,5 +153,5 @@ steps may be needed:: export PATH - # PIP_FIND_LINKS currently broken + # PIP_FIND_LINKS currently breaks test_uninstall.py unset PIP_FIND_LINKS From d923a58ca7d9340703f1856f256e5ba7cb6b4ab9 Mon Sep 17 00:00:00 2001 From: Jeremy Carroll Date: Tue, 23 Oct 2018 21:55:11 -0700 Subject: [PATCH 07/18] Correction from PR comment --- docs/dev/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index effbec1f..42df6782 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -131,7 +131,7 @@ Three ways of running the tests are as follows: 3. Using pipenv:: pipenv install --dev - pipenv run py.test + pipenv run pytest For the last two, it is important that your environment is setup correctly, and this may take some work, for example, on a specific Mac installation, the following From 735119e63bf15a114b6f10ae9f77bd7610205b51 Mon Sep 17 00:00:00 2001 From: Jeremy Carroll Date: Wed, 24 Oct 2018 06:55:45 -0700 Subject: [PATCH 08/18] Added run-tests.bat as alternative to run-tests.sh --- docs/dev/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index 42df6782..db7f14cc 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -127,7 +127,7 @@ Run the tests Three ways of running the tests are as follows: 1. ``make test`` (which uses ``docker``) -2. ``./run-tests.sh`` +2. ``./run-tests.sh`` or ``run-tests.bat`` 3. Using pipenv:: pipenv install --dev From ceebf21b9cddc899c92121201578ffc4a5e71153 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 30 Oct 2018 01:35:43 -0400 Subject: [PATCH 09/18] Add news entry for #3074 Signed-off-by: Dan Ryan --- news/3074.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3074.doc.rst diff --git a/news/3074.doc.rst b/news/3074.doc.rst new file mode 100644 index 00000000..85feefd5 --- /dev/null +++ b/news/3074.doc.rst @@ -0,0 +1 @@ +Expanded development and testing documentation for contributors to get started. From 3381f178a977baecefb96f8d46a95879008e4896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dra=C5=BEen=20Lu=C4=8Danin?= Date: Tue, 23 Oct 2018 10:07:17 +0200 Subject: [PATCH 10/18] pipenv open custom command help --- pipenv/cli/command.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 1ce9fee9..af1282b0 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -533,7 +533,13 @@ def graph(bare=False, json=False, json_tree=False, reverse=False): @argument("module", nargs=1) @pass_state def run_open(state, module, *args, **kwargs): - """View a given module in your editor.""" + """View a given module in your editor. + + This uses the EDITOR environment variable. You can temporarily override it, + for example: + + EDITOR=atom pipenv open requests + """ from ..core import which, ensure_project # Ensure that virtualenv is available. From 1ad684a5ab22439997baa63713425820b0df5d56 Mon Sep 17 00:00:00 2001 From: jacrotts Date: Thu, 18 Oct 2018 22:33:24 -0500 Subject: [PATCH 11/18] Implement some behavior for --bare in sync and clean, and add bare as an option to do_clean in cli.py --- pipenv/cli/command.py | 1 + pipenv/core.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index af1282b0..02bd5dc9 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -596,6 +596,7 @@ def sync( @cli.command(short_help="Uninstalls all packages not specified in Pipfile.lock.") +@option("--bare", is_flag=True, default=False, help="Minimal output.") @option("--dry-run", is_flag=True, default=False, help="Just output unneeded packages.") @verbose_option @three_option diff --git a/pipenv/core.py b/pipenv/core.py index b23534d6..6129dc15 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2582,7 +2582,8 @@ def do_sync( deploy=deploy, system=system, ) - click.echo(crayons.green("All dependencies are now up-to-date!")) + if not bare: + click.echo(crayons.green("All dependencies are now up-to-date!")) def do_clean(ctx, three=None, python=None, dry_run=False, bare=False, pypi_mirror=None): @@ -2611,14 +2612,15 @@ def do_clean(ctx, three=None, python=None, dry_run=False, bare=False, pypi_mirro )] failure = False for apparent_bad_package in installed_package_names: - if dry_run: + if dry_run and not bare: click.echo(apparent_bad_package) else: - click.echo( - crayons.white( - fix_utf8("Uninstalling {0}…".format(repr(apparent_bad_package))), bold=True + if not bare: + click.echo( + crayons.white( + fix_utf8("Uninstalling {0}…".format(repr(apparent_bad_package))), bold=True + ) ) - ) # Uninstall the package. c = delegator.run( "{0} uninstall {1} -y".format(which_pip(), apparent_bad_package) From 64f4b4b04297f18fbd6d1a73864763f584611347 Mon Sep 17 00:00:00 2001 From: jacrotts Date: Thu, 18 Oct 2018 23:24:36 -0500 Subject: [PATCH 12/18] Add news fragment for 3041.feature --- news/3041.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3041.feature diff --git a/news/3041.feature b/news/3041.feature new file mode 100644 index 00000000..edbf7fb0 --- /dev/null +++ b/news/3041.feature @@ -0,0 +1 @@ +--bare now has effect on sync and clean. From ed6e328da0460a8b521de5f53f39daef060a4eaf Mon Sep 17 00:00:00 2001 From: jacrotts Date: Fri, 19 Oct 2018 00:20:04 -0500 Subject: [PATCH 13/18] Change news fragment to better reflect changes to sync --- news/3041.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/3041.feature b/news/3041.feature index edbf7fb0..4a72e216 100644 --- a/news/3041.feature +++ b/news/3041.feature @@ -1 +1 @@ ---bare now has effect on sync and clean. +--bare now has an effect on clean, and use sync's bare option to reduce output. From e7d6f4b901c902f9f80cddb0f4561ce51e9f8a93 Mon Sep 17 00:00:00 2001 From: jacrotts Date: Fri, 19 Oct 2018 00:36:40 -0500 Subject: [PATCH 14/18] Edit a word in news fragment --- news/3041.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/3041.feature b/news/3041.feature index 4a72e216..79a1d5de 100644 --- a/news/3041.feature +++ b/news/3041.feature @@ -1 +1 @@ ---bare now has an effect on clean, and use sync's bare option to reduce output. +--bare now has an effect on clean, and sync's bare option is now used to reduce output. From 9ff61c777bdcdc87053ae827a6f45e15d1016aaf Mon Sep 17 00:00:00 2001 From: jxltom Date: Mon, 8 Oct 2018 11:29:49 +0800 Subject: [PATCH 15/18] Add tests for locking editable packages with ref --- tests/integration/test_lock.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index 7743804d..2b520808 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -369,6 +369,42 @@ requests = {git = "https://github.com/requests/requests.git", ref = "master", ed assert c.return_code == 0 +@pytest.mark.lock +@pytest.mark.vcs +@pytest.mark.needs_internet +def test_lock_editable_vcs_with_ref_in_git(PipenvInstance, pypi): + with PipenvInstance(pypi=pypi, chdir=True) as p: + with open(p.pipfile_path, 'w') as f: + f.write(""" +[packages] +requests = {git = "https://github.com/requests/requests.git@883caaf", editable = true} + """.strip()) + c = p.pipenv('lock') + assert c.return_code == 0 + assert p.lockfile['default']['requests']['git'] == 'https://github.com/requests/requests.git' + assert p.lockfile['default']['requests']['ref'] == '883caaf145fbe93bd0d208a6b864de9146087312' + c = p.pipenv('install') + assert c.return_code == 0 + + +@pytest.mark.lock +@pytest.mark.vcs +@pytest.mark.needs_internet +def test_lock_editable_vcs_with_ref(PipenvInstance, pypi): + with PipenvInstance(pypi=pypi, chdir=True) as p: + with open(p.pipfile_path, 'w') as f: + f.write(""" +[packages] +requests = {git = "https://github.com/requests/requests.git", ref = "883caaf", editable = true} + """.strip()) + c = p.pipenv('lock') + assert c.return_code == 0 + assert p.lockfile['default']['requests']['git'] == 'https://github.com/requests/requests.git' + assert p.lockfile['default']['requests']['ref'] == '883caaf145fbe93bd0d208a6b864de9146087312' + c = p.pipenv('install') + assert c.return_code == 0 + + @pytest.mark.extras @pytest.mark.lock @pytest.mark.vcs From 77f97aa058f428611ab11b68b927130855fdb545 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Wed, 10 Oct 2018 22:54:02 -0500 Subject: [PATCH 16/18] Set PIPENV_ACTIVE when running pipenv run --- news/2996.trivial | 1 + pipenv/core.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 news/2996.trivial diff --git a/news/2996.trivial b/news/2996.trivial new file mode 100644 index 00000000..dbe1006a --- /dev/null +++ b/news/2996.trivial @@ -0,0 +1 @@ +Set `PIPENV_ACTIVE=1` when running `pipenv run`. This is what `pipenv shell` already does. \ No newline at end of file diff --git a/pipenv/core.py b/pipenv/core.py index 6129dc15..1b9c5ade 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2284,6 +2284,8 @@ def do_run(command, args, three=None, python=False, pypi_mirror=None): # Ensure that virtualenv is available. ensure_project(three=three, python=python, validate=False, pypi_mirror=pypi_mirror) + # Set an environment variable, so we know we're in the environment. + os.environ["PIPENV_ACTIVE"] = vistir.misc.fs_str("1") load_dot_env() # Activate virtualenv under the current interpreter's environment inline_activate_virtual_environment() From 3140ee6f0b4237b1b5a7d5b4db4e0173d9f10290 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 30 Oct 2018 01:58:15 -0400 Subject: [PATCH 17/18] Exclude setup_path from pipfile Signed-off-by: Dan Ryan --- pipenv/vendor/requirementslib/__init__.py | 2 +- pipenv/vendor/requirementslib/models/requirements.py | 2 +- pipenv/vendor/vendor.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py index 8ceccd79..bcbff09e 100644 --- a/pipenv/vendor/requirementslib/__init__.py +++ b/pipenv/vendor/requirementslib/__init__.py @@ -1,5 +1,5 @@ # -*- coding=utf-8 -*- -__version__ = '1.2.2' +__version__ = '1.2.3' import logging diff --git a/pipenv/vendor/requirementslib/models/requirements.py b/pipenv/vendor/requirementslib/models/requirements.py index 08eb5618..e92fe8ab 100644 --- a/pipenv/vendor/requirementslib/models/requirements.py +++ b/pipenv/vendor/requirementslib/models/requirements.py @@ -649,7 +649,7 @@ class VCSRequirement(FileRequirement): # Remove potential ref in the end of uri after ref is parsed if "@" in self.link.show_url and "@" in self.uri: uri, ref = self.uri.rsplit("@", 1) - if ref in self.ref: + if self.ref and ref in self.ref: self.uri = uri yield vcsrepo diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt index 18352c2e..2e00af0c 100644 --- a/pipenv/vendor/vendor.txt +++ b/pipenv/vendor/vendor.txt @@ -27,7 +27,7 @@ requests==2.20.0 idna==2.7 urllib3==1.24 certifi==2018.10.15 -requirementslib==1.2.2 +requirementslib==1.2.3 attrs==18.2.0 distlib==0.2.8 packaging==18.0 From 150ec74f398549d87c8dbfcecac4525b40ea844e Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 30 Oct 2018 11:32:05 -0400 Subject: [PATCH 18/18] Fix requirementslib bug Signed-off-by: Dan Ryan --- pipenv/vendor/requirementslib/models/requirements.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipenv/vendor/requirementslib/models/requirements.py b/pipenv/vendor/requirementslib/models/requirements.py index e92fe8ab..28d90799 100644 --- a/pipenv/vendor/requirementslib/models/requirements.py +++ b/pipenv/vendor/requirementslib/models/requirements.py @@ -649,7 +649,8 @@ class VCSRequirement(FileRequirement): # Remove potential ref in the end of uri after ref is parsed if "@" in self.link.show_url and "@" in self.uri: uri, ref = self.uri.rsplit("@", 1) - if self.ref and ref in self.ref: + checkout = self.req.revision + if checkout and ref in checkout: self.uri = uri yield vcsrepo