From e42929dcf64fccbea0d93a0bfaf965e20c569e39 Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Sat, 21 Mar 2020 12:49:15 +0530 Subject: [PATCH 01/15] Rephrases documentation --- docs/html/development/getting-started.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index 6fa4f9edc..025435f65 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -49,19 +49,19 @@ pip's tests are written using the :pypi:`pytest` test framework, :pypi:`mock` and :pypi:`pretend`. :pypi:`tox` is used to automate the setup and execution of pip's tests. +It is preferable to run the tests in **parallel** for better user experience during development, +as the test suite is very extensive. WIthout the `-n auto` your tests would be running sequentially, +causing more time to finish. To run tests locally, run: - -.. code-block:: console - - $ tox -e py36 - -Generally, it can take a long time to run pip's test suite. To run tests in parallel, -which is faster, run: - .. code-block:: console $ tox -e py36 -- -n auto +For running tests sequentially remove the `-n` flag. +.. code-block:: console + + $ tox -e py36 + The example above runs tests against Python 3.6. You can also use other versions like ``py27`` and ``pypy3``. From c387d8e7663584914112b328b50fba53a83a775a Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Sat, 21 Mar 2020 12:52:06 +0530 Subject: [PATCH 02/15] Adds news --- news/7683.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/7683.doc diff --git a/news/7683.doc b/news/7683.doc new file mode 100644 index 000000000..67680eef8 --- /dev/null +++ b/news/7683.doc @@ -0,0 +1 @@ +Rephrases test execution command \ No newline at end of file From 3cadfd2e80456656332f738c3e1abd0f95a38228 Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Sat, 21 Mar 2020 13:30:26 +0530 Subject: [PATCH 03/15] Addresses PR comments --- docs/html/development/getting-started.rst | 2 +- news/7683.doc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index 025435f65..59b7370ce 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -50,7 +50,7 @@ and :pypi:`pretend`. :pypi:`tox` is used to automate the setup and execution of pip's tests. It is preferable to run the tests in **parallel** for better user experience during development, -as the test suite is very extensive. WIthout the `-n auto` your tests would be running sequentially, +as the test suite is very extensive. Without the `-n auto` your tests would be running sequentially, causing more time to finish. To run tests locally, run: .. code-block:: console diff --git a/news/7683.doc b/news/7683.doc index 67680eef8..921a80933 100644 --- a/news/7683.doc +++ b/news/7683.doc @@ -1 +1 @@ -Rephrases test execution command \ No newline at end of file +Rephrases test execution command From adf3dc8572ee06d1ee5526b14440eb5fc3cfe8d1 Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Sat, 21 Mar 2020 13:43:54 +0530 Subject: [PATCH 04/15] Fixes linting checks --- docs/html/development/getting-started.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index 59b7370ce..f8db70811 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -50,14 +50,14 @@ and :pypi:`pretend`. :pypi:`tox` is used to automate the setup and execution of pip's tests. It is preferable to run the tests in **parallel** for better user experience during development, -as the test suite is very extensive. Without the `-n auto` your tests would be running sequentially, +as the test suite is very extensive. Without the ``-n auto`` your tests would be running sequentially, causing more time to finish. To run tests locally, run: .. code-block:: console $ tox -e py36 -- -n auto -For running tests sequentially remove the `-n` flag. +For running tests sequentially remove the ``-n`` flag. .. code-block:: console $ tox -e py36 From 4d6a982976135fcc09a54edb2f5ddcefe8ba24bc Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Sat, 21 Mar 2020 14:28:34 +0530 Subject: [PATCH 05/15] Addresses PR comments --- docs/html/development/getting-started.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index f8db70811..fe081c54f 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -49,9 +49,8 @@ pip's tests are written using the :pypi:`pytest` test framework, :pypi:`mock` and :pypi:`pretend`. :pypi:`tox` is used to automate the setup and execution of pip's tests. -It is preferable to run the tests in **parallel** for better user experience during development, -as the test suite is very extensive. Without the ``-n auto`` your tests would be running sequentially, -causing more time to finish. +It is preferable to run the tests in parallel for better experience during development, +since the tests can take a long time to finish when run sequentially. To run tests locally, run: .. code-block:: console From ff35f7f26a33f558ed7b20a8c7ac09c7ce883fc5 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 23 Mar 2020 17:15:55 +0800 Subject: [PATCH 06/15] Remove stale TODO comment --- src/pip/_internal/resolution/resolvelib/requirements.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/pip/_internal/resolution/resolvelib/requirements.py b/src/pip/_internal/resolution/resolvelib/requirements.py index 4adc8a09a..74c464d59 100644 --- a/src/pip/_internal/resolution/resolvelib/requirements.py +++ b/src/pip/_internal/resolution/resolvelib/requirements.py @@ -57,9 +57,6 @@ class ExplicitRequirement(Requirement): def is_satisfied_by(self, candidate): # type: (Candidate) -> bool - # TODO: Typing - Candidate doesn't have a link attribute - # But I think the following would be better... - # return candidate.link == self.candidate.link return candidate == self.candidate @@ -104,7 +101,6 @@ class SpecifierRequirement(Requirement): def is_satisfied_by(self, candidate): # type: (Candidate) -> bool - assert candidate.name == self.name, \ "Internal issue: Candidate is not for this requirement " \ " {} vs {}".format(candidate.name, self.name) From 5af542ccac7a4e6cc8988c93d793c54279e70869 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 24 Mar 2020 01:57:26 +0800 Subject: [PATCH 07/15] Use named arguments for clarity --- src/pip/_internal/resolution/resolvelib/resolver.py | 6 +++--- tests/unit/resolution_resolvelib/conftest.py | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py index cb40ab70b..1dc408c98 100644 --- a/src/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/pip/_internal/resolution/resolvelib/resolver.py @@ -43,9 +43,9 @@ class Resolver(BaseResolver): def resolve(self, root_reqs, check_supported_wheels): # type: (List[InstallRequirement], bool) -> RequirementSet provider = PipProvider( - self.finder, - self.preparer, - self.make_install_req, + finder=self.finder, + preparer=self.preparer, + make_install_req=self.make_install_req, ) reporter = BaseReporter() resolver = RLResolver(provider, reporter) diff --git a/tests/unit/resolution_resolvelib/conftest.py b/tests/unit/resolution_resolvelib/conftest.py index 6ddc6422a..e0892d771 100644 --- a/tests/unit/resolution_resolvelib/conftest.py +++ b/tests/unit/resolution_resolvelib/conftest.py @@ -55,4 +55,8 @@ def provider(finder, preparer): wheel_cache=None, use_pep517=None, ) - yield PipProvider(finder, preparer, make_install_req) + yield PipProvider( + finder=finder, + preparer=preparer, + make_install_req=make_install_req, + ) From 3cb7a08f0d0ffa8d4c058ab4a81a253736cfe467 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 24 Mar 2020 02:02:36 +0800 Subject: [PATCH 08/15] Implement ignore_dependencies in new resolver If this flag is set, simply report every candidate has no dependencies. --- src/pip/_internal/resolution/resolvelib/provider.py | 4 ++++ src/pip/_internal/resolution/resolvelib/resolver.py | 2 ++ tests/unit/resolution_resolvelib/conftest.py | 1 + 3 files changed, 7 insertions(+) diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 981646ea9..f57fcaf78 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -20,11 +20,13 @@ class PipProvider(AbstractProvider): self, finder, # type: PackageFinder preparer, # type: RequirementPreparer + ignore_dependencies, # type: bool make_install_req # type: InstallRequirementProvider ): # type: (...) -> None self._finder = finder self._preparer = preparer + self._ignore_dependencies = ignore_dependencies self._make_install_req = make_install_req def make_requirement(self, ireq): @@ -72,6 +74,8 @@ class PipProvider(AbstractProvider): def get_dependencies(self, candidate): # type: (Candidate) -> Sequence[Requirement] + if self._ignore_dependencies: + return [] return [ make_requirement( r, diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py index 1dc408c98..f14bdaecf 100644 --- a/src/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/pip/_internal/resolution/resolvelib/resolver.py @@ -37,6 +37,7 @@ class Resolver(BaseResolver): super(Resolver, self).__init__() self.finder = finder self.preparer = preparer + self.ignore_dependencies = ignore_dependencies self.make_install_req = make_install_req self._result = None # type: Optional[Result] @@ -45,6 +46,7 @@ class Resolver(BaseResolver): provider = PipProvider( finder=self.finder, preparer=self.preparer, + ignore_dependencies=self.ignore_dependencies, make_install_req=self.make_install_req, ) reporter = BaseReporter() diff --git a/tests/unit/resolution_resolvelib/conftest.py b/tests/unit/resolution_resolvelib/conftest.py index e0892d771..f4b979d15 100644 --- a/tests/unit/resolution_resolvelib/conftest.py +++ b/tests/unit/resolution_resolvelib/conftest.py @@ -58,5 +58,6 @@ def provider(finder, preparer): yield PipProvider( finder=finder, preparer=preparer, + ignore_dependencies=False, make_install_req=make_install_req, ) From d43699b111499cf16e6f7090b05b7c31d0b32d83 Mon Sep 17 00:00:00 2001 From: Xavier Fernandez Date: Wed, 26 Feb 2020 16:16:20 +0100 Subject: [PATCH 09/15] Move darwin special config dir to pip wrapper --- src/pip/_internal/utils/appdirs.py | 7 ++++++- src/pip/_vendor/appdirs.py | 4 ---- .../vendoring/patches/appdirs.patch | 21 +++++-------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/pip/_internal/utils/appdirs.py b/src/pip/_internal/utils/appdirs.py index f80e4af45..3989ed31c 100644 --- a/src/pip/_internal/utils/appdirs.py +++ b/src/pip/_internal/utils/appdirs.py @@ -25,7 +25,12 @@ def user_cache_dir(appname): def user_config_dir(appname, roaming=True): # type: (str, bool) -> str - return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) + path = _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) + if _appdirs.system == "darwin" and not os.path.isdir(path): + path = os.path.expanduser('~/.config/') + if appname: + path = os.path.join(path, appname) + return path # for the discussion regarding site_config_dir locations diff --git a/src/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py index cf37f9820..8bd9c9ca0 100644 --- a/src/pip/_vendor/appdirs.py +++ b/src/pip/_vendor/appdirs.py @@ -92,10 +92,6 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): path = os.path.expanduser('~/Library/Application Support/') if appname: path = os.path.join(path, appname) - if not os.path.isdir(path): - path = os.path.expanduser('~/.config/') - if appname: - path = os.path.join(path, appname) else: path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share")) if appname: diff --git a/tools/automation/vendoring/patches/appdirs.patch b/tools/automation/vendoring/patches/appdirs.patch index fd3c200ac..69afd3e86 100644 --- a/tools/automation/vendoring/patches/appdirs.patch +++ b/tools/automation/vendoring/patches/appdirs.patch @@ -22,18 +22,7 @@ index ae67001a..3a52b758 100644 Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ -@@ -88,6 +92,10 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): - path = os.path.expanduser('~/Library/Application Support/') - if appname: - path = os.path.join(path, appname) -+ if not os.path.isdir(path): -+ path = os.path.expanduser('~/.config/') -+ if appname: -+ path = os.path.join(path, appname) - else: - path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share")) - if appname: -@@ -150,7 +158,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): +@@ -150,7 +154,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): if appname: if version: appname = os.path.join(appname, version) @@ -42,7 +31,7 @@ index ae67001a..3a52b758 100644 if multipath: path = os.pathsep.join(pathlist) -@@ -203,6 +211,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): +@@ -203,6 +203,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): return path @@ -51,7 +40,7 @@ index ae67001a..3a52b758 100644 def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. -@@ -238,14 +248,15 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False) +@@ -238,14 +244,15 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False) if appname and version: path = os.path.join(path, version) else: @@ -71,7 +60,7 @@ index ae67001a..3a52b758 100644 if multipath: path = os.pathsep.join(pathlist) -@@ -291,6 +304,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): +@@ -291,6 +300,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): if appauthor is None: appauthor = appname path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA")) @@ -82,7 +71,7 @@ index ae67001a..3a52b758 100644 if appname: if appauthor is not False: path = os.path.join(path, appauthor, appname) -@@ -557,18 +574,32 @@ def _get_win_folder_with_jna(csidl_name): +@@ -557,18 +570,32 @@ def _get_win_folder_with_jna(csidl_name): if system == "win32": try: From 145c189a4998b52121c09ea669f7463dad03e154 Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Sat, 21 Mar 2020 16:22:32 +0530 Subject: [PATCH 10/15] Add a What Next page in getting started --- docs/html/development/getting-started.rst | 14 ++++++++++++++ news/533EA005-0471-4D5D-A81B-B6904A844EEE.trivial | 0 2 files changed, 14 insertions(+) create mode 100644 news/533EA005-0471-4D5D-A81B-B6904A844EEE.trivial diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index 6fa4f9edc..5c699cd61 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -123,8 +123,22 @@ To build it locally, run: The built documentation can be found in the ``docs/build`` folder. +What Next? +========== + +The following pages may be helpful for new contributors on where to look next +in order to start contributing. + +* Some `good first issues`_ on GitHub for new contributors +* A deep dive into `pip's architecture`_ +* A guide on `triaging issues`_ for issue tracker + + .. _`open an issue`: https://github.com/pypa/pip/issues/new?title=Trouble+with+pip+development+environment .. _`install Python`: https://realpython.com/installing-python/ .. _`PEP 484 type-comments`: https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code .. _`rich CLI`: https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests .. _`GitHub`: https://github.com/pypa/pip +.. _`good first issues`: https://github.com/pypa/pip/labels/good%20first%20issue +.. _`pip's architecture`: https://pip.pypa.io/en/latest/development/architecture/ +.. _`triaging issues`: https://pip.pypa.io/en/latest/development/issue-triage/ diff --git a/news/533EA005-0471-4D5D-A81B-B6904A844EEE.trivial b/news/533EA005-0471-4D5D-A81B-B6904A844EEE.trivial new file mode 100644 index 000000000..e69de29bb From 88e4abd66ff6fe065c6aad408e636a0e22526f60 Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Tue, 24 Mar 2020 19:27:44 +0530 Subject: [PATCH 11/15] Removed news file --- news/7683.doc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 news/7683.doc diff --git a/news/7683.doc b/news/7683.doc deleted file mode 100644 index 921a80933..000000000 --- a/news/7683.doc +++ /dev/null @@ -1 +0,0 @@ -Rephrases test execution command From 4d0a55ee6f7d7458a4f8e5688782f3a907c76057 Mon Sep 17 00:00:00 2001 From: onlinejudge95 Date: Tue, 24 Mar 2020 19:32:37 +0530 Subject: [PATCH 12/15] Address minor comments --- docs/html/development/getting-started.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/html/development/getting-started.rst b/docs/html/development/getting-started.rst index fe081c54f..db34a0c54 100644 --- a/docs/html/development/getting-started.rst +++ b/docs/html/development/getting-started.rst @@ -51,12 +51,13 @@ pip's tests. It is preferable to run the tests in parallel for better experience during development, since the tests can take a long time to finish when run sequentially. -To run tests locally, run: + +To run tests: .. code-block:: console $ tox -e py36 -- -n auto -For running tests sequentially remove the ``-n`` flag. +To run tests without parallelization, run: .. code-block:: console $ tox -e py36 From 1a210d1c62877a60a9308272c1dab39e95ed7125 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 26 Mar 2020 01:47:22 +0800 Subject: [PATCH 13/15] Improve utility to test installed env Make assert_installed actually check the provided entries against the pip --list output. Add assert_not_installed to check for the reverse. --- tests/functional/test_new_resolver.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py index cd7443dd6..4e8c0f041 100644 --- a/tests/functional/test_new_resolver.py +++ b/tests/functional/test_new_resolver.py @@ -9,7 +9,15 @@ def assert_installed(script, **kwargs): (val['name'], val['version']) for val in json.loads(ret.stdout) ) - assert set(kwargs.items()) <= installed + assert all(item in installed for item in kwargs.items()), \ + "{!r} not all in {!r}".format(kwargs, installed) + + +def assert_not_installed(script, *args): + ret = script.pip("list", "--format=json") + installed = set(val["name"] for val in json.loads(ret.stdout)) + assert all(a not in installed for a in args), \ + "{!r} contained in {!r}".format(args, installed) def test_new_resolver_can_install(script): From 6d3a89c9924d324a6c262d18d4b935963fab8d79 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 26 Mar 2020 01:48:47 +0800 Subject: [PATCH 14/15] Add --no-deps test for the new resolver --- tests/functional/test_new_resolver.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py index 4e8c0f041..ed91a60f2 100644 --- a/tests/functional/test_new_resolver.py +++ b/tests/functional/test_new_resolver.py @@ -89,3 +89,25 @@ def test_new_resolver_installs_dependencies(script): "base" ) assert_installed(script, base="0.1.0", dep="0.1.0") + + +def test_new_resolver_ignore_dependencies(script): + create_basic_wheel_for_package( + script, + "base", + "0.1.0", + depends=["dep"], + ) + create_basic_wheel_for_package( + script, + "dep", + "0.1.0", + ) + script.pip( + "install", "--unstable-feature=resolver", + "--no-cache-dir", "--no-index", "--no-deps", + "--find-links", script.scratch_path, + "base" + ) + assert_installed(script, base="0.1.0") + assert_not_installed(script, "dep") From c42b5d37162b828013e9dde6f022c85a56bd3b90 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Wed, 25 Mar 2020 23:53:31 -0400 Subject: [PATCH 15/15] Change docs link from PEP 301 to PEP 503 --- docs/html/reference/pip_install.rst | 2 +- news/2808D551-576D-4239-BBB4-F5B9DB5E36A2.trivial | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 news/2808D551-576D-4239-BBB4-F5B9DB5E36A2.trivial diff --git a/docs/html/reference/pip_install.rst b/docs/html/reference/pip_install.rst index c81e43ba4..bd61151d7 100644 --- a/docs/html/reference/pip_install.rst +++ b/docs/html/reference/pip_install.rst @@ -506,7 +506,7 @@ Finding Packages pip searches for packages on `PyPI`_ using the `HTTP simple interface `_, which is documented `here `_ -and `there `_. +and `there `_. pip offers a number of package index options for modifying how packages are found. diff --git a/news/2808D551-576D-4239-BBB4-F5B9DB5E36A2.trivial b/news/2808D551-576D-4239-BBB4-F5B9DB5E36A2.trivial new file mode 100644 index 000000000..e69de29bb