1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

2969 commits

Author SHA1 Message Date
Tzu-ping Chung 6e3d56897b Always return the installed version 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 01c9b6cf25 Cache results and remove unused implementation 2020-10-13 16:06:00 +08:00
Tzu-ping Chung a270ca5616 Mypy is wrong 2020-10-13 16:06:00 +08:00
Tzu-ping Chung 8326148149 Implement "lazy sequence" to avoid Internet
find_matches() is modified to return a special type that implements
the sequence protocol (instead of a plain list). This special sequence
type tries to use the installed candidate as the first element if
possible, and only access indexes when the installed candidate is
considered unsatisfactory.
2020-10-13 16:06:00 +08:00
Nguyễn Gia Phong cf6ecab627 Bump mypy to 0.790 for Python 3.9 compat
HashError.order is now annotated as an int to allow
HashErrors.errors.sort(key=lambda e: e.order).  Alternatively we can
define a function which assert e is not None but I prefer the more
concise version, since we never raise HashError directly anyway.
2020-10-12 17:37:55 +07:00
Pradyun Gedam 063f2ae74e
Merge pull request #8974 from NoahGorny/fix-new-resolver-upgrades-when-not-needed-to 2020-10-10 20:41:48 +05:30
Pradyun Gedam 95dbf34d6e
Merge pull request #8919 from FFY00/fix-devendored-pip
Revert "Merge pull request #8391 from VikramJayanthi17/error-swallow-…
2020-10-10 18:41:32 +05:30
Noah Gorny 960dca9949 resolvelib: factory: Get installed distributions correctly 2020-10-10 02:23:08 +03:00
Nguyễn Gia Phong b28e2c4928 New resolver: Avoid polluting dest dir
Previously, during dependency resolution for `pip download -d <dir>`
or `pip wheel -w <dir>`, distributions downloaded are always saved
to <dir>, even for those are only used in backtracking and are not
part of the returned requirement set.
2020-10-07 13:42:21 +07:00
Nguyễn Gia Phong 6887b0795b Merge usage of download_dir and wheel_download_dir
In every cases, at least one of them is None.  By doing this,
it is also possible to simplify wrapper codes around download_dir.
2020-10-07 13:42:21 +07:00
Nguyễn Gia Phong 78b294e746 Remove download_dir exist check
Both pip download and wheel call endure_dir on the directory.
2020-10-07 13:42:21 +07:00
Pradyun Gedam 8aab76c63f
Merge pull request #8910 from hugovk/pip-cache-http
Include http subdirectory in 'pip cache info' and 'pip cache purge'
2020-10-02 13:26:00 +05:30
Hugo van Kemenade 0652a2f016 Rename to 'Package index page cache location' 2020-10-02 09:59:38 +03:00
Pradyun Gedam d0f80a44c9
Merge pull request #8804 from McSinyx/fast-deps-check-dl-dir 2020-10-02 03:41:43 +05:30
Nguyễn Gia Phong 2ef8040495 Comment and rework conditionals in download dir check
Co-authored-by: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com>
2020-10-01 22:00:47 +07:00
Tzu-ping Chung c2de8974d4 Resolve user-requested requirements first 2020-09-28 22:23:10 +08:00
Tzu-ping Chung ebc1375612 Make private attribute looks private 2020-09-28 22:19:51 +08:00
Tzu-ping Chung 806c112ed0 Don't crash on 'check' when METADATA is missing 2020-09-28 14:28:53 +08:00
Filipe Laíns b215120b5a
Revert "Merge pull request #8391 from VikramJayanthi17/error-swallow-fix"
This reverts commit 7a60395dbd, reversing
changes made to d3ce025e8d.

It fixes devendored pip. See #8916.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-09-26 14:41:42 +01:00
Tzu-ping Chung 1dd6d56278 Cache PackageFinder.find_all_candidates() 2020-09-26 15:26:05 +08:00
Tzu-ping Chung 1135ac041d Move lru_cache to utils for reuse 2020-09-26 15:26:05 +08:00
Hugo van Kemenade d45ba65c37 Include http directory in 'pip cache info' and 'pip cache purge' 2020-09-24 01:33:56 +03:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Pradyun Gedam faee60baea
Merge pull request #8902 from pradyunsg/linter-updates 2020-09-23 21:44:55 +05:30
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Pradyun Gedam 4c534e65d2
Tweak message when -r is not passed on a requirements.txt 2020-09-23 19:46:36 +05:30
Vipul Kumar 2b07c5d288
End no-color's description with period punctuation
It would be nice, if like description of other options, "--no-color"'s
description also ends with a period.
2020-09-23 04:43:51 +00:00
Pradyun Gedam 7c1e5d3096
Merge pull request #8568 from McSinyx/conf-const
Declare constants in configuration.py as such
2020-09-18 21:43:29 +05:30
Pradyun Gedam 67ab116f00
Merge pull request #8861 from pradyunsg/nicer-output-try-1 2020-09-17 11:00:23 +05:30
Pradyun Gedam e61bb616ef
Merge pull request #8839 from uranusjr/new-resolver-hash-intersect 2020-09-17 10:58:44 +05:30
Nguyễn Gia Phong c947d00882 [fast-deps] Check download directory before making requests 2020-09-17 10:38:27 +07:00
Pradyun Gedam 53efda742b
Merge pull request #8474 from deveshks/remove-items-of-age-cache 2020-09-16 18:54:59 +05:30
Xavier Fernandez 33890bf825
Merge pull request #8722 from McSinyx/late-dl-indent
Dedent late download logs
2020-09-16 14:02:51 +02:00
Nguyễn Gia Phong 8f8a1d65b2 Dedent late download logs 2020-09-13 21:09:57 +07:00
Devesh Kumar Singh 9450f8837a Use format options for abspath 2020-09-11 09:23:51 +05:30
Devesh Kumar Singh 0b3ba87bbf Add option to output full path of cache enty 2020-09-11 09:23:51 +05:30
Pradyun Gedam cc472fd54a
Use a symmetric type and make mypy happy 2020-09-10 17:32:58 +05:30
Pradyun Gedam 3d32960c80
Only Print "Collecting ..." when the requirement changes 2020-09-10 17:21:42 +05:30
Pradyun Gedam 963e390abe
Improve how cached wheels are presented
This is specifically for the case of look ups done in the new resolver.
2020-09-10 17:21:04 +05:30
Pradyun Gedam c07ef581e7
Factor out logger.into into a single call
This makes it easier to conditionally print this information.
2020-09-10 17:15:32 +05:30
Pradyun Gedam 8663855711
Merge pull request #8830 from uranusjr/env-var-req-file
Replace custom URL parsing with url_to_path()
2020-09-08 18:46:33 +05:30
Nguyễn Gia Phong cca500f053 Remove unused definitions 2020-09-04 17:37:43 +07:00
Xavier Fernandez 83f1640827
Merge pull request #8578 from McSinyx/parse-count
Allow verbose/quiet level to be specified via config file and env var
2020-09-03 18:34:53 +02:00
Tzu-ping Chung dfaa111004 Pull in hashes from constraint files 2020-09-03 17:26:52 +08:00
Tzu-ping Chung 700eb7734f Hashes from lines should intersect, not union 2020-09-03 17:19:01 +08:00
Pradyun Gedam 567630b4b8
Merge pull request #8758 from uranusjr/new-resolver-requires-python-when-no-deps 2020-09-02 20:09:32 +05:30
Pradyun Gedam a99190459e
Merge pull request #8817 from sbidoul/improve-git-checkout 2020-09-01 18:40:51 +05:30
Tzu-ping Chung 87d129a801 Replace custom URL parsing with url_to_path() 2020-09-01 15:43:58 +08:00
Stéphane Bidoul 3aa0c2ed91
Git fetch more aggressively
Before we were fetching only revisions starting with refs/.
Now we also fetch revisions that look like commit that we
don't have locally.
2020-08-30 11:52:06 +02:00
Tzu-ping Chung 8b2b92485c Include Requires-Python dep even with --no-deps 2020-08-26 09:49:25 +08:00
Pradyun Gedam 0b18e21cbe
Merge pull request #8752 from sbidoul/imp-8369-deprecation-sbi 2020-08-25 20:40:27 +05:30
Pradyun Gedam b7075b9351
Merge pull request #8778 from hugovk/deprecate-3.5
Deprecate support for Python 3.5
2020-08-25 20:40:01 +05:30
Pradyun Gedam e17f845475
Merge pull request #8522 from NoahGorny/fix-requirements-file-options
install: Update extra-index-url in session from requirements file
2020-08-25 15:08:11 +05:30
Hugo e93257c080 Warn Python 3.5 support is deprecated and will be removed in pip 21.0, Jan 2021 2020-08-18 15:22:16 +03:00
Pradyun Gedam a3fd4246af
Merge pull request #8709 from McSinyx/successfully-downloaded
[2020-resolver] List downloaded distributions before exiting
2020-08-17 17:22:17 +05:30
Stéphane Bidoul 4c348cf3a0
Consider success flag instead of absence of exception 2020-08-13 09:38:56 +02:00
Stéphane Bidoul 9c4a88b0a0
Improve deprecation message for issue 8368 2020-08-12 11:07:36 +02:00
Nguyễn Gia Phong b46576d933 Give batch downloader a separate class 2020-08-12 16:07:27 +07:00
Nguyễn Gia Phong a1aeb4ce01 Check download folder for files to be downloaded in batch 2020-08-12 16:02:28 +07:00
Nguyễn Gia Phong 18c803a413 Check hashes of memoized downloads 2020-08-11 22:40:42 +07:00
Nguyễn Gia Phong 39d296eeb8 Clean up code style and internal interface
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Chris Hunt <chrahunt@gmail.com>
2020-08-11 22:40:39 +07:00
Nguyễn Gia Phong 078e0effb7 Add memoization mechanism for file download
This is intentionally dependent from caching, which relies on cache dir.
2020-08-11 22:39:42 +07:00
Nguyễn Gia Phong e62f16e969 Make Downloader perform the download 2020-08-11 22:36:08 +07:00
Pradyun Gedam 8eea660e03
Merge pull request #8744 from hroncok/keyring_global_nope
When one keyring attempt fails, don't bother with more
2020-08-11 15:41:02 +05:30
Pradyun Gedam 4c7bbdb4e4
Merge pull request #8702 from uranusjr/get-distribution-looks-for-all 2020-08-10 20:30:55 +05:30
Pradyun Gedam e8f52198a9
Merge pull request #8718 from uranusjr/pyvenv-cfg-encoding
Always use UTF-8 to read pyvenv.cfg
2020-08-07 15:11:32 +05:30
Tzu-ping Chung 4683ad02e3 Allow filtering constraints with markers 2020-08-07 13:55:38 +08:00
Noah Gorny aae63795b2 reqfile: Update extra-index-url/index-url in session from requirements file
Also update the relevant tests
2020-08-06 19:25:31 +03:00
Nguyễn Gia Phong 11f7994a66 Revise method fetching metadata using lazy wheels
* Rename it to fit the fact that it no longer handle
  fetching _not_ using lazy wheels
* Use self as the first parameter
* Unnest the checks with additional logs showing reason
  when lazy wheel is not used
2020-08-06 18:43:02 +07:00
Nguyễn Gia Phong 487d00295c Define RequirementPreparer._session 2020-08-06 18:42:59 +07:00
Nguyễn Gia Phong 4f210f3608 [2020-resolver] List downloaded distributions before exiting
This unifies the behavior of pip download for both legacy and new
resolvers.  InstallRequirement.successfully_download is no longer needed
for this task and is thus retired.
2020-08-06 16:52:31 +07:00
Tzu-ping Chung 810385b971 Always use UTF-8 to read pyvenv.cfg 2020-08-06 11:46:46 +08:00
Nguyễn Gia Phong ffd6a38646 Disable caching for range requests 2020-08-05 22:19:49 +07:00
Tzu-ping Chung c04182893a Work around lax semantics in commands.search 2020-08-05 04:56:00 +08:00
Tzu-ping Chung 8491ce7723 Refactor and clarify get_distribution() behavior
The call to get_installed_distributions() now passes all flags
excplicitly so they are more obvious and less likely to be misunderstood
in the future. The behavior also documented in the function docstring.

The search_distribution() helper function is renamed with a leading
underscore to make it clear that it is intended as a helper function to
get_distribution().
2020-08-05 03:07:07 +08:00
Tzu-ping Chung e459763d81 Also look for non-local when searching for dists
This matches the behavior of pkg_resources.get_distribution(), which
this function intends to replace.
2020-08-05 03:07:07 +08:00
Pradyun Gedam ee4371c386
Merge pull request #8685 from chrahunt/use-preparer-for-lazy-wheels 2020-08-04 18:46:56 +05:30
Pradyun Gedam e7357c71cd
Merge pull request #8681 from McSinyx/faster-deps
[fast-deps] Make range requests closer to chunk size
2020-08-04 07:38:48 +05:30
Pradyun Gedam 70768de0a8
Merge pull request #8684 from uranusjr/zipfile-unicode-path-python2 2020-08-04 06:50:38 +05:30
Pradyun Gedam 0c48ec0696
Merge pull request #8679 from pradyunsg/tweak-resolutionimpossible-message 2020-08-04 06:49:10 +05:30
Pradyun Gedam 4fa31d509f
Merge pull request #8678 from uranusjr/new-resolver-no-deps-extras-install-self 2020-08-04 06:48:11 +05:30
Nguyễn Gia Phong d98ff19c27 [fast-deps] Make range requests closer to chunk size 2020-08-03 21:49:58 +07:00
Miro Hrončok ba062c3ed0 When one keyring attempt fails, don't bother with more
This makes https://github.com/pypa/pip/issues/8090 much less painful.
2020-08-03 12:34:26 +02:00
Tzu-ping Chung a12e2f1479 PEP 427 mandates UTF-8, we don't need the fallback 2020-08-03 15:00:58 +08:00
Tzu-ping Chung d4995cb89e Implement heuristics to get non-ASCII ZIP entries 2020-08-03 09:29:19 +08:00
Chris Hunt 8b838ebb89 Prepare lazy wheels more so they are downloaded
This keeps all knowledge about preparation and types of requirements in
`RequirementPreparer`, so there's one place to look when we're ready to
start breaking it apart later.
2020-08-02 19:36:29 -04:00
Chris Hunt c7ade159d4 Pass link to _fetch_metadata instead of req
Removes dependence on `InstallRequirement`.
2020-08-02 19:36:29 -04:00
Chris Hunt 21db4f3096 Log in one common location
Reduces dependence on `InstallRequirement` being passed to
`_fetch_metadata`.
2020-08-02 19:36:29 -04:00
Chris Hunt 6c4d4f3b78 Move _fetch_metadata to RequirementPreparer
The fact that all of this functionality can be put in terms of the
`RequirementPreparer` indicates that, at least at this point, this is
the cleanest place to put this functionality.
2020-08-02 19:36:29 -04:00
Chris Hunt 4e1bff741d Promote Wheel-related assertions to LinkCandidate constructor
These are things we know will be true because of the existing wheel
processing. In the future we may delegate the extraction of these to the
LinkCandidate itself so it doesn't have to be an assertion.
2020-08-02 19:36:28 -04:00
Chris Hunt 9e463916d0 Extract name and version from Wheel link
We happen to know that this is the same treatment that gave us `_name`
and `_version` for Wheels in the first place (in `LinkEvaluator`). It's not
ideal, however the metadata consistency check that occurs in `Candidate`
after creation of a `Distribution` guards us against any deviation in
the name and version during our processing.

Reduces dependence on Candidate.
2020-08-02 19:36:14 -04:00
Chris Hunt defbf82a8f Use link from InstallRequirement
Since when we generate the InstallRequirement we set the link, these
must be the same.

Reduces dependence on Candidate.
2020-08-02 18:40:11 -04:00
Chris Hunt f4603078cf Pass InstallRequirement to _fetch_metadata
Reduces dependence on Candidate.
2020-08-02 18:40:11 -04:00
Chris Hunt f0d4df10eb Propagate lazy_wheel option through RequirementPreparer
Reduces dependence on Candidate (and Resolver (and Factory)).
2020-08-02 18:40:11 -04:00
Chris Hunt e49dcfdc35 Move lazy_wheel warning out of Resolver
This warning just needs to be traced in one place for all commands,
there's no need for the resolver to know about it. Moving the warning
out of the Resolver will make it easier to change how we provide the
option.
2020-08-02 18:40:11 -04:00
Chris Hunt 45ab317610 Move call to _fetch_metadata next to call to RequirementPreparer
Since wheels can't be editable, we can move this into LinkCandidate,
closer to `RequirementPreparer.prepare_linked_requirement` into which we
want to integrate `_fetch_metadata`.
2020-08-02 18:40:11 -04:00
Chris Hunt ec5b6d7b80 Remove extra metadata consistency check
Instead of an early return, we fall through to the existing check at the
end of this function. This aligns our treatment of `_fetch_metadata` and
`_prepare_distribution`.
2020-08-02 18:40:11 -04:00
Chris Hunt a72d04f734 Move common processing out of _fetch_metadata
Returning a `Distribution` makes `_fetch_metadata` look more like
`_prepare_distribution`, in preparation for moving it there next.
2020-08-02 18:40:11 -04:00
Chris Hunt 8c3c0ade78 Move _fetch_metadata into _prepare
Since `_prepare` is called in two places, we preserve the
`if self._dist is not None` protection above the new call to
`_fetch_metadata`. The second `if` in `_prepare` handles the early
return required when processing a lazy wheel.
2020-08-02 18:40:09 -04:00
Chris Hunt 4d94ae4c40 Move non-lazy req fallback outside of _fetch_metadata
No change in behavior, we just want to unify "requirements processing"
and moving this function out is a prereq for moving `_fetch_metadata` in.
2020-08-02 18:39:57 -04:00