Commit Graph

2896 Commits

Author SHA1 Message Date
Tzu-ping Chung 01e0700e68 Skip installing if the version matches locally
This check only applies to explicit requirements since we avoid
downloading the dist from finder altogether when there is a matching
installation (although the check wouldn’t change the behaviour in that
case anyway).

We can do this when we build the `ExplicitRequirement` instead, like how
we did for `SpecifierRequirement`, but that would require us to resolve
the direct requirement’s version eagerly, which I don’t want to.

The implemented approach checks the version only after resolution, at
which point the distribution is already built anyway and the operation
is cheap.
2020-07-06 11:06:14 +08:00
Christopher Hunt 4ba51d2e9c
Merge pull request #8501 from uranusjr/refactor-create-link-collector
Tidy up link collector constructor imports
2020-07-05 21:44:31 -04:00
Chris Hunt 5e4c1a96a2 Remove unused argument 2020-07-05 20:16:36 -04:00
Stéphane Bidoul df79ae4233
Enable strict typing in req_file.py 2020-07-05 19:11:41 +02:00
Stéphane Bidoul caad983734
Fix docstring typo 2020-07-05 19:11:41 +02:00
Christopher Hunt 1f8a4dde26
Merge pull request #8541 from chrahunt/refactor/compile-file-next-steps
Byte-compile files after installation
2020-07-05 12:56:39 -04:00
Stéphane Bidoul c2350444e1
Merge pull request #8322 from deveshks/mypy-internal-ops
Complete type annotations in "pip._internal.operations.{check,freeze}" and "pip._internal.utils.subprocess"
2020-07-05 16:51:16 +02:00
Chris Hunt 452e683eda Move byte-compilation after installing wheel files
There are a few changes here:

1. The byte-compilation now occurs after we copy the root-scheme files
   and files from any wheel data dirs
1. Instead of iterating over the files in the unpacked wheel directory,
   we iterate over the installed files as they exist in the installation
   path
2. In addition to asserting that pyc files were created, we also add
   them to the list of installed files, so they will be included in RECORD

By compiling after installation, we no longer depend on a separate
temporary directory - this brings us closer to installing directly from
wheel files.

By compiling with source files as they exist in the installation output
directory, we no longer generate pyc files with an embedded randomized
temp directory - this means that wheel installs can be deterministic.
2020-07-05 09:38:35 -04:00
Chris Hunt 2ece73cc86 Confirm that pyc files are written during installation
In order to add generated pyc files to the RECORD file for our package,
we need to know their path! To raise confidence that we're doing this
correctly, we assert the existence of the expected 'pyc' files while
still using the old installation logic.

Some valid reasons why pyc files may not be generated:

1. Syntax error in the installed Python files
2. There is already a pyc file in-place that isn't writable by the
   current user

We don't fail installation in those cases today, and we wouldn't want to
change our behavior here, so we only assert that the pyc file was
created if `compileall.compile_file` indicates success.
2020-07-05 09:38:07 -04:00
Chris Hunt 4cb6f729ab Filter to files actually processed by compileall.compile_file
`compileall.compile_file` returns a success parameter, but can return
"successful" without actually generating a pyc file if the input file
was filtered out and compilation was not attempted.

In our file processing we mirror that logic, to ensure that a truthy
success returned by `compileall.compile_file` actually indicates a file
was written.
2020-07-05 09:37:47 -04:00
Chris Hunt 0a3a558e38 Use compileall.compile_file instead of compileall.compile_dir
We want to move towards having more control over the generation of pyc
files, which will allow us to provide deterministic installs and
generate pyc files without relying on an already-extracted wheel.

To that end, here we are stripping away one layer of abstraction,
`compileall.compile_dir`. `compileall.compile_dir` essentially recurses
through the provided directories and passes the files and args verbatim
to `compileall.compile_file`, so removing that layer means that we
directly call `compileall.compile_file`.

We make the assumption that we can successfully walk over the
source file tree, since we just wrote it, and omit the per-directory
traversal error handling done by `compileall.compile_dir`.
2020-07-05 09:37:45 -04:00
Pradyun Gedam 8db4fc8224
Merge pull request #8530 from pradyunsg/rollout-flags 2020-07-05 01:50:25 +05:30
Pradyun Gedam 107ec292c2
Merge pull request #8539 from pradyunsg/warn-on-unsupported-use-of-constraints 2020-07-05 01:48:54 +05:30
Pradyun Gedam 6437bec269
Warn on to-be-removed forms of constraints 2020-07-04 18:01:38 +05:30
Pradyun Gedam 20431888cb
Move check_invalid_constraint_type to req_install.py 2020-07-04 18:01:28 +05:30
Pradyun Gedam ace5485836
Change reject_invalid_constraint_types to be reusable 2020-07-04 17:50:42 +05:30
Christopher Hunt feb2a24f14
Merge pull request #8537 from chrahunt/refactor/read-record-from-wheel
Read RECORD from wheel file directly during install
2020-07-03 22:00:34 -04:00
Christopher Hunt 196f5487f9
Merge pull request #8535 from chrahunt/refactor/extract-console-script-spec-source
Extract console script spec calculation from install_unpacked_wheel
2020-07-03 21:58:57 -04:00
Chris Hunt d7b5a776b3 Move record_path closer to first use 2020-07-03 20:53:56 -04:00
Chris Hunt d441f9518b Get wheel RECORD directly from wheel file
This reduces our dependence on disk files, and removes some complexity
around Python 2/3 compatibility with the csv module.
2020-07-03 20:49:16 -04:00
Chris Hunt 0433200135 Move dest_info_dir construction closer to first use
Reducing the scope of variables makes it easier to refactor, since
we can extract whole contiguous chunks of code later.
2020-07-03 19:46:45 -04:00
Chris Hunt 3930e4b063 Drop unused argument 2020-07-03 19:46:45 -04:00
Chris Hunt 479154b4ae Get Wheel entrypoints from Distribution instead of file
Since the Distribution pulls its data directly from the Wheel file,
without extracting intermediate files to disk, this brings us closer to
installing from Wheels without extracting everything.
2020-07-03 19:46:45 -04:00
Chris Hunt d49d97f19f Pass Wheel distribution to install.wheel.get_entrypoints
Right now we're just wiring up the arguments. Next we will actually use
them.
2020-07-03 19:46:45 -04:00
Pradyun Gedam 0acdbf8943
Merge pull request #8504 from McSinyx/list-speed-up-nw
Parallelize pip list --outdated and --uptodate
2020-07-04 03:31:26 +05:30
Chris Hunt 94421cfb1a Extract console script spec calculation from install_wheel
This big chunk of code was independent of the rest of our wheel
installation process. Moving it out enforces that there are no
dependencies between it and the original function, and makes it easier
to read the original function.
2020-07-03 17:43:33 -04:00
Chris Hunt dcd5cadcfd Expect a plain list in get_csv_rows_for_installed
This makes get_csv_rows_for_installed simpler, because it is not
modifying its arguments. We can also more easily refactor RECORD file
reading since it is now decoupled from getting the installed RECORD file
rows.
2020-07-03 12:25:12 -04:00
Christopher Hunt ea7ee7d8e0
Merge pull request #8526 from chrahunt/reduce-dependence-on-files
Reduce dependence on disk files during Wheel installation
2020-07-03 11:32:38 -04:00
Christopher Hunt e3ba8d9a49
Merge pull request #8529 from chrahunt/optimize-wheel-subdir-getter
Simplify and optimize getting zip subdirs
2020-07-03 11:30:46 -04:00
Pradyun Gedam a8eaf11d7f
Use the correct flag name
Co-authored-by: Stéphane Bidoul <stephane.bidoul@acsone.eu>
2020-07-03 19:20:58 +05:30
Pradyun Gedam 26e29aa70e
Disallow --unstable-feature, pointing to --use-feature instead 2020-07-03 18:49:57 +05:30
Pradyun Gedam 79de2c8911
Switch to --use-feature for determining which resolver to use
Also changes all invocations in the tests, to the new flag.
2020-07-03 18:49:56 +05:30
Pradyun Gedam cd95531951
Add --use-feature and --deprecated-feature flags 2020-07-03 18:49:51 +05:30
Christopher Hunt cba5f11057
Merge pull request #8524 from chrahunt/remove-always-applicable-comments
Remove encouraging comments
2020-07-03 09:17:53 -04:00
Christopher Hunt 8097de5364
Merge pull request #8528 from chrahunt/simplify-get-entrypoints
Remove redundant entrypoint text normalization
2020-07-03 09:10:10 -04:00
Chris Hunt 8259528ed9 Simplify and optimize getting zip subdirs
Since we only care about the first path part, we can stop at 1 split. We
do not need a list, so the unnecessary conversion has been dropped.
2020-07-03 09:02:30 -04:00
Chris Hunt abed1d6d39 Set `data_dirs` closer to first use
Reducing the scope of variables reduces possible dependencies between
parts of this function, and will make it easier to extract this section
into its own function.
2020-07-03 09:00:07 -04:00
Chris Hunt 01e0d8befb Get data directories directly from zip
This reduces our dependence on the files being extracted to the
filesystem.

Compare the name extraction to the similar code in
`utils.wheel.wheel_dist_info_dir`.

We don't need to give `.data` directories the same strict
treatment (yet) because it isn't inconvenient if there happen
to be multiple of them in a single Wheel file.
2020-07-03 08:59:36 -04:00
Chris Hunt d93b8b3e53 Do not shadow outer variable in loop
`source` is provided as an argument to this function. Shadowing it can
lead to type errors if the intermediate types change.
2020-07-03 08:59:12 -04:00
Devesh Kumar Singh 245bcd0456 Check should_ignore in if condition and remove function creation 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh d3295265e1 Assert spinner instead of if condition check 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh da2448ca13 Assert proc.stdin and proc.stdout 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh 59e19ea743 Update type of local_only and user_only to bool 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh 7e05571117 Type annotations in pip._internal.utils.subprocess 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh 940107d5ed Type annotations for pip._internal.operations.freeze 2020-07-03 12:27:13 +05:30
Devesh Kumar Singh 65e55e2540 Type annotations for pip._internal.operations.check 2020-07-03 12:27:13 +05:30
Chris Hunt 541ce8748a Remove redundant entrypoint text normalization
Currently we do processing in `get_entrypoints` so incoming text is more compatible
with `pkg_resources`. It turns out that `pkg_resources` is already doing the same normalization,
so we can omit it.

This simplifies `get_entrypoints`, opening the way for us to pass it a plain string instead
of a file path.
2020-07-02 21:50:11 -04:00
Chris Hunt 7c2fa59cd3 Add early return in fix_script
No behavior change, just making this function easier to refactor.
2020-07-02 20:57:51 -04:00
Chris Hunt 09d75b8a58 Remove encouraging comments
These comments are relevant to this function, since it is long
overdue for refactoring. This code isn't special in that regard, and we
should feel free to consider any piece of code eligible to be broken up
or put into a class. So we remove these comments in fairness to the rest
of the code, and to remove a distraction during upcoming code reviews.
2020-07-02 20:40:02 -04:00
Xavier Fernandez 09f9b0030d
Merge pull request #8096 from deveshks/list-config-files
Add option to list config files with pip config
2020-07-02 15:01:35 +02:00
Pradyun Gedam e774eccf46
Merge pull request #8343 from uranusjr/entrypoint-unicode 2020-06-30 14:33:24 +00:00
Pradyun Gedam 0b23b772d5
Merge pull request #8411 from McSinyx/refactor-prepare-linked-req 2020-06-30 13:41:11 +00:00
Pradyun Gedam 18431be48f
Merge pull request #8467 from McSinyx/lazy-wheel 2020-06-30 13:39:04 +00:00
Pradyun Gedam 93b0683d65
Merge pull request #8470 from deveshks/remove-always-unzip 2020-06-30 13:33:30 +00:00
Nguyễn Gia Phong da9c7c7f69 Lint src/pip/_vendor/README.rst 2020-06-30 13:20:32 +07:00
Pradyun Gedam 17608c43d1
Merge pull request #8465 from deveshks/collector-debug-to-warn 2020-06-29 18:28:10 +00:00
Pradyun Gedam 9e7087645a
Merge pull request #8332 from McSinyx/vendor-license-compat 2020-06-29 18:27:25 +00:00
Devesh Kumar Singh 6c899ed0c8 Update warning message to specify HTTP request 2020-06-29 22:20:11 +05:30
Pradyun Gedam ecda6650ff
Apply suggestions from code review
Co-authored-by: Xavier Fernandez <xav.fernandez@gmail.com>
2020-06-29 16:31:52 +00:00
Nguyễn Gia Phong dd3a3b5eb7 Parallelize network operations in pip list 2020-06-29 15:48:41 +07:00
Pradyun Gedam 3a22663ab2
Merge pull request #8320 from McSinyx/pools 2020-06-29 07:54:14 +00:00
Devesh Kumar Singh 46790a4f3c Improve warning message for invalid vcs schemes 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh 51f4c03221 Warn if package url is a vcs or an archive url with invalid scheme 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh 6e62481568 Add unit tests for pip config debug 2020-06-28 16:22:01 +05:30
Devesh Kumar Singh f0f692e8e9 Add env and env var values 2020-06-28 16:22:00 +05:30
Devesh Kumar Singh 2fcad8ffa7 Rename subcommand from list-files to debug 2020-06-28 16:22:00 +05:30
Devesh Kumar Singh b9d19a64d7 List values per configuration file 2020-06-28 16:22:00 +05:30
Devesh Kumar Singh 7a8f374c39 Add option to list config files with pip config 2020-06-28 16:22:00 +05:30
Stéphane Bidoul 69a811cec6
Merge pull request #8337 from deveshks/mypy/pip/internal
Complete type annotations in "pip._internal.wheel_builder"
2020-06-27 10:55:59 +02:00
Xavier Fernandez 9a3c082070
Merge pull request #8182 from deveshks/no-input-tests
Enable --no-input option by adding docs and tests
2020-06-26 21:29:19 +02:00
Tzu-ping Chung ec7324fba0 Tidy up link collector constructor imports
make_link_collector() was in self_outdated_check, a module responsible
for checking whether the currently-running pip is outdated, but is
imported by things that has nothing to do with this outdated check. Move
the function to be a class method in LinkCollector so the module
hierarchy makes more sense.
2020-06-26 17:31:28 +08:00
Nguyễn Gia Phong e1438d06b5 Rename and wrap LazyZipOverHTTP 2020-06-26 15:15:28 +07:00
Nguyễn Gia Phong 3eb85a0619 Draft lazy zip over HTTP 2020-06-26 15:15:28 +07:00
Devesh Kumar Singh a833914387 Add help text to --no-input option 2020-06-26 07:21:56 +05:30
Devesh Kumar Singh 9a8bcf3f34 Add type: ignore to requirements loop 2020-06-25 23:27:50 +05:30
Devesh Kumar Singh be75ed8566 Type annotations for pip._internal.wheel_builder 2020-06-25 20:52:33 +05:30
Nguyễn Gia Phong cef064dc4b Require vendored libraries to be MIT-compatibly licensed 2020-06-25 22:01:48 +07:00
Nguyễn Gia Phong 0a3b20f9b8 Drop parallel map for Python 2 and the non-lazy variant
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2020-06-25 21:10:49 +07:00
Nguyễn Gia Phong 13539d00f8 Wrap lazy map as well 2020-06-25 21:10:49 +07:00
Nguyễn Gia Phong 134ae32a16 Add utilities for paralleliztion 2020-06-25 21:10:49 +07:00
Paul Moore f162236360 Fix deletion of temp dir when exception occurs 2020-06-25 13:00:11 +01:00
Devesh Kumar Singh 3e0b8f18cc Remove --always-unzip option from command-line 2020-06-25 16:52:15 +05:30
Devesh Kumar Singh 17b1c76ff5 Remove --always-unzip usage in source code 2020-06-25 16:52:15 +05:30
Pradyun Gedam 439e16f106
Merge pull request #8445 from uranusjr/hash-error-message
Set the requirement context on hash error
2020-06-24 18:41:03 +05:30
Pradyun Gedam fb68794188
Merge pull request #8026 from sbidoul/requested-sbi 2020-06-24 18:24:30 +05:30
Stéphane Bidoul acab2ee54e Deprecate --build-dir 2020-06-21 19:05:55 +02:00
Paul Moore 809eb3cad3 Fix a merge issue that didn't get caught by Brown Truck 2020-06-18 14:01:49 +01:00
Paul Moore d287033599
Merge pull request #8394 from pfmoore/nr_conflict_message
Improve the message for "Resolution Conflict" errors
2020-06-18 13:45:51 +01:00
Pradyun Gedam 343f863785
Apply suggestions from code review 2020-06-17 23:20:55 +05:30
Nguyễn Gia Phong 8b5ff72a13 Make linked req hashes an independant method 2020-06-17 23:11:46 +07:00
Paul Moore 868ba81a74 Next iteration of message 2020-06-17 17:11:32 +01:00
Nguyễn Gia Phong eb2deab2f6 Move req.source_dir ensure out 2020-06-17 23:07:29 +07:00
Nguyễn Gia Phong 6bb0d289f8 Move link log from prepare_linked_requirement 2020-06-17 23:03:08 +07:00
Paul Moore a42ed23adc Fix format_for_error for remote URL candidates 2020-06-17 16:47:07 +01:00
Paul Moore 2795742b31 Add handling of inconsistent root requirements 2020-06-17 16:47:04 +01:00
Paul Moore 09d311594e Move error handling to factory.get_installation_error() 2020-06-17 16:44:53 +01:00
Paul Moore c827f2964c Revised ResolutionImpossible message 2020-06-17 16:44:53 +01:00
Paul Moore 27521ac1f2 Remove duplicates from the list of conflicts in ResolutionImpossible reporting 2020-06-17 16:44:53 +01:00
Tzu-ping Chung 78db0ba40b Set the requirement context on hash error
This improves the message shown by the hash error to include the
requirement that caused it.
2020-06-16 14:54:04 +08:00
Tzu-ping Chung 439da2f902 Implement yanked link warning in the new resolver 2020-06-15 16:38:10 +08:00
Tzu-ping Chung f81fd19a7b Ensure entry points are read as UTF-8
Like the wheel metadata, this is, strictly speaking, unspecified. But
UTF-8 is the de-facto standard, and we should support that.
2020-06-10 20:58:20 +08:00
Tzu-ping Chung ebb90c6411 Reject incompatibile direct wheel link
This mirrors the behavior in the legacy resolver. In the future we may
want to backtrack in this situation instead, but I haven't found a clean
way to do this. We may need to introduce an "empty" requirement class.

The `PackageFinder.target_python` interface is also not the most clean.
Maybe we should expose the target Python object instead. Not sure yet.
2020-06-10 20:57:23 +08:00
Paul Moore 57b39a85bc
Merge pull request #8397 from uranusjr/new-resolver-fix-candidate-ordering
New resolver fix candidate ordering
2020-06-10 12:24:37 +01:00
Devesh Kumar Singh 8f1d808deb Add noqa B010 for setattr 2020-06-10 00:39:50 +05:30
Devesh Kumar Singh 76257e4b65 Use module.__file__ 2020-06-10 00:36:03 +05:30
Devesh Kumar Singh 021eddcb70 Remove try/catch and use next 2020-06-10 00:36:03 +05:30
Devesh Kumar Singh d3f012cb3b Fix argument type for ca_bundle_info 2020-06-10 00:36:03 +05:30
Devesh Kumar Singh 76a130105c Fix src/pip with flake8-bugbear 2020-06-10 00:36:03 +05:30
Paul Moore 7bf78f05df
Merge pull request #8283 from uranusjr/pre-existing-build-directory-fix
Pre-existing build directory fix
2020-06-09 16:47:53 +01:00
Pradyun Gedam 19e739c346
Merge pull request #7908 from NoahGorny/extract-supported-req-file-option-docs
Extract supported req file option docs
2020-06-06 15:30:29 +05:30
Devesh Kumar Singh ae2f9c645a Remove unused cached_property 2020-06-05 22:11:15 +05:30
Tzu-ping Chung e647b12540 Yield installed candidate at the correct position 2020-06-05 08:17:28 +08:00
Pradyun Gedam 7a60395dbd
Merge pull request #8391 from VikramJayanthi17/error-swallow-fix
Re-think error swallowing for de-vendored packages #5354
2020-06-05 00:08:46 +05:30
Paul Moore d3ce025e8d
Merge pull request #8378 from uranusjr/direct-url-fix
Fix direct URL by always passing the template’s URL values into candidate
2020-06-04 17:31:45 +01:00
Tzu-ping Chung 09a7f271c7 Only attach UUID to build dir for spec candidates
These are the only cases where backtracking can happen. This approach
also accounts for VCS requirements relying on the same ensure function
to do cloning :/
2020-06-04 23:26:19 +08:00
Pradyun Gedam 85ce4dfd2c
Merge pull request #8374 from uranusjr/unsupported-link-with-marker
Correctly apply marker matching logic to all requirements
2020-06-04 11:34:31 +05:30
Pradyun Gedam cdeb377a36
Merge pull request #7388 from xmunoz/slots
Restrict dynamic attribute creation with slots
2020-06-04 02:02:51 +05:30
Stéphane Bidoul ebd331fb45
Merge pull request #8375 from deveshks/use-bitwise-and
Update mechanism to set permissions for files with execute permissions while extracting sdists.
2020-06-03 22:17:37 +02:00
Greg Ward dd3672fe34 Fix grammar in Python 2 warning message 2020-06-03 22:00:32 +02:00
Cristina Muñoz 030e2b8c0e Return not implmented if class differs 2020-06-03 09:52:56 -07:00
Tzu-ping Chung 4ca684f3b8 Fix for source directory reuse 2020-06-04 00:32:57 +08:00
Vikram - Google 8ef2191a09 Fixed Error Swallowing outlined in issue 5354 2020-06-02 16:45:48 -07:00
Tzu-ping Chung e4f870ba25 Raise proper exceptions on metadata mismatch 2020-06-03 03:52:07 +08:00
Cristina Muñoz 92ca536279 Don't raise exception for false 2020-06-02 10:45:16 -07:00
Cristina Muñoz 9583642d87 Remove superfluous operator import 2020-06-02 10:05:07 -07:00
Cristina Muñoz 8f4c4c9eb4 Fix whitespace 2020-06-02 09:58:39 -07:00
Cristina 5f0f2f0218
Update src/pip/_internal/models/format_control.py
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2020-06-02 09:50:16 -07:00
Tzu-ping Chung a0d12df489 Copy link values from template to candidate's ireq
We need to set the original link so the value is accessible in later
code, when we return the ireq backing the candidate. This is needed for
some parts of the post processing like PEP 610 support, which needs to
record the original, remote URL, not the potentially hit cache link.
2020-06-02 19:12:42 +08:00
Tzu-ping Chung a90fe9bd94 Remove outdated TODO comment 2020-06-02 19:07:12 +08:00
Devesh Kumar Singh a8e20e36b2 Rename function 2020-06-02 15:56:38 +05:30
Devesh Kumar Singh cc86b7f179 Use bitwise AND to set file permissions 2020-06-02 13:54:01 +05:30
Tzu-ping Chung 1719fc3dcc Merge spec->req constructors
Since both functions now return Optional[Requirement], we can just use
the same implementation.
2020-06-02 12:02:52 +08:00
Tzu-ping Chung d5204dd0ba Move markers check into the ireq->req constructor
This makes the check apply to ALL requirement constructions, no
exceptions.
2020-06-02 12:02:52 +08:00
Tzu-ping Chung 258bd7945e Allow Candidate.iter_dependencies() to yield None 2020-06-02 11:53:08 +08:00
Noah Gorny afb4e6f5ba cli: cmdoptions: Mark always_unzip as depreceated 2020-06-01 21:56:59 +03:00
Stéphane Bidoul 69a4cb3eed
Merge pull request #8296 from deveshks/mypy-pip-internal
Complete type annotations in "pip._internal.{build_env,self_outdated_check,exceptions}"
2020-05-31 18:46:31 +02:00
Stéphane Bidoul 21bf4f51f8
Uniform use of user supplied vocabulary 2020-05-31 18:33:51 +02:00
Stéphane Bidoul aa0c167498
Make sure user_supplied is propagated where needed 2020-05-31 18:33:51 +02:00
Stéphane Bidoul b9a19f6be0
Rename is_direct to user_supplied 2020-05-31 18:33:51 +02:00
Stéphane Bidoul a226f65cf5
A constraint is not a top level requirement 2020-05-31 18:33:51 +02:00
Stéphane Bidoul c9a445762c
Mark top level requirements as REQUESTED 2020-05-31 18:33:51 +02:00
Stéphane Bidoul 21df86f197
Add REQUESTED support to install_wheel 2020-05-31 18:33:50 +02:00
Pradyun Gedam d01bfcfaa1
Merge pull request #8278 from tiran/py3_celementtree 2020-05-30 17:07:10 +05:30
Devesh Kumar Singh 5c24a1eaee Remove redundant variable annotations 2020-05-30 15:53:19 +05:30
Stéphane Bidoul 7ed5e12ae8
Merge pull request #8336 from deveshks/remove-isinstance-fixme
Remove isinstance FIXME from pip._internal.commands
2020-05-30 10:34:56 +02:00
Pradyun Gedam c348c4215b
Merge pull request #8287 from sbidoul/ref-install_given_reqs-sbi 2020-05-30 13:24:28 +05:30
Devesh Kumar Singh b01eb958d0 Fix run type annotation in base_command and configuration 2020-05-30 10:57:40 +05:30
Devesh Kumar Singh cb25f93a20 Assert that status is int 2020-05-28 22:31:00 +05:30
Devesh Kumar Singh 4b5f723480 Don't return SUCCESS at end of run method 2020-05-28 22:31:00 +05:30
Devesh Kumar Singh 2bcbc52b2c Remove isinstance check for status 2020-05-28 22:31:00 +05:30
Pradyun Gedam b5a5bcf13b
Rename parent to template 2020-05-28 18:50:09 +05:30
Tzu-ping Chung 9ee19a1190 Always use frozenset 2020-05-27 23:10:56 +08:00
Tzu-ping Chung b8404fde99 Always read extras from InstallRequirement.extras 2020-05-27 23:10:56 +08:00
Tzu-ping Chung 6c6b6a7765 Implement new Provider.find_matches() 2020-05-27 23:10:56 +08:00
Tzu-ping Chung 46f433615e Update vendored ResolveLib to 0.4.0 2020-05-27 23:08:28 +08:00
Tzu-ping Chung 80f3b3e6e0 This is correct! 2020-05-27 20:19:38 +08:00
Tzu-ping Chung 48c3d0c8ec Typo in docstring
Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2020-05-27 20:19:38 +08:00
Tzu-ping Chung bc9b288b1e Implement wheel cache lookup in the new resolver 2020-05-27 20:19:37 +08:00
Tzu-ping Chung dab7b94ade Derive Requirement name from ireq is possible
This is useful when resolving the wheel cache.
2020-05-27 20:19:37 +08:00
Cristina Muñoz 330323bf8b Remove unneeded MYPY_CHECK_RUNNING import 2020-05-26 11:12:57 -07:00
Cristina Muñoz 732bf44f91 Remove Base class 2020-05-26 10:19:48 -07:00
Cristina Muñoz d4dd94aa4f fix lint 2020-05-25 16:18:38 -07:00
Tzu-ping Chung 5f2bc2b47c DO NOT sort the returned matches by version
A higher version is not always preferred over the lower; the user may
be explicitly preferring lower versions by specifying --prefer-binary
or similar flags.

PackageFinder already takes these into account for these and orders
the matches. Don't break it.
2020-05-25 14:12:36 +08:00
Pradyun Gedam f84f91af27
Merge pull request #7969 from deveshks/fix-svn-version-check 2020-05-23 21:47:38 +05:30
Pradyun Gedam f9b1a54009
Apply suggestion from review comments 2020-05-23 19:32:27 +05:30
Devesh Kumar Singh 99660b8d86 Fix pip cache docstring to render correctly in docs 2020-05-23 19:27:32 +05:30
Devesh Kumar Singh e9f738a3da Bubble up SubProcessError to basecommand._main 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh ab3ee7191c Remove on_returncode parameter from call_subprocess 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh 94882fd1ed Remove show_stdout from run_command args 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh 8adbc216a6 Create call_subprocess just for vcs commands 2020-05-23 19:13:13 +05:30
Devesh Kumar Singh 1471897b84 Improve check for svn version string 2020-05-23 19:13:13 +05:30
Pradyun Gedam 0a1df7b11c
Apply suggestions from code review 2020-05-23 18:43:31 +05:30
Pradyun Gedam 642fb07337
Merge pull request #8062 from cjc7373/issue_7625 2020-05-23 18:25:53 +05:30
Pradyun Gedam c3203aa282
Merge pull request #8292 from deveshks/add-mypy-req-constructors 2020-05-23 17:13:17 +05:30
Pradyun Gedam 94cb8f582c
Merge pull request #8277 from deveshks/types-auth-encoding-unpacking 2020-05-23 17:13:03 +05:30
Pradyun Gedam d5265e24b7
Merge pull request #8083 from deveshks/warn-on-unexpected-content-type 2020-05-23 17:12:08 +05:30
Pradyun Gedam 75b2800dec
Merge pull request #8073 from deveshks/pip-config-docstring-fix 2020-05-23 17:11:46 +05:30
Pradyun Gedam 403310e9b5
Merge pull request #7996 from deveshks/add-prefer-binary-to-req-file 2020-05-23 17:11:36 +05:30
gutsytechster b82516c9ca fix(_internal/commands): Define a default add_option to child commands 2020-05-23 14:55:37 +05:30
gutsytechster 72a42197a4 refactor(commands): Add method add_options and remove __init__
This removes the __init__ method of child classes and defines
explicit method for adding command options.
2020-05-23 14:50:57 +05:30
Devesh Kumar Singh 4fbe61af3a Update message type to configparser.Error 2020-05-23 14:29:26 +05:30
Stéphane Bidoul db75ac5587
Merge pull request #8265 from deveshks/add-mypy-download-freeze-search
Complete type annotations in "pip._internal.commands.{freeze,download,search}"
2020-05-23 10:43:07 +02:00
Devesh Kumar Singh 71c0fb0581 Update build_env.install_requirements message type to str 2020-05-23 09:15:25 +05:30
Paul Moore 48334aeb80 New resolver not raising DistributionNotFound 2020-05-22 15:36:10 +01:00
Devesh Kumar Singh e8b842389c Always return SUCCESS from download.run 2020-05-22 19:44:29 +05:30
Devesh Kumar Singh e8aa5e73c5 Fix return type annotation for handle_401 2020-05-22 19:30:08 +05:30
Pradyun Gedam 5d6234172f
Merge pull request #8053 from gutsytechster/update_filesystem_comment 2020-05-22 17:07:43 +05:30
cjc7373 a9c8dc5468 fix normalize path for Windows 2020-05-22 17:29:51 +08:00
Devesh Kumar Singh 3c1ad45370 Type annotations for pip._internal.exceptions 2020-05-22 10:47:16 +05:30
Cristina Muñoz bcc5ac404c Conditionally import List for Python 2 compatibility 2020-05-21 19:04:12 -07:00
Cristina Muñoz 0527f80531 Clean up lint errors 2020-05-21 19:04:12 -07:00
Cristina Muñoz f6bf9a0065 Restrict dynamic attribute creation with slots
Fixes #7313.
2020-05-21 19:04:12 -07:00
Devesh Kumar Singh ac39efa537 Update parse_editable to return Set[str] 2020-05-22 04:21:14 +05:30
Devesh Kumar Singh 2c5cab492c Pass empty set if parts.extras is None 2020-05-22 04:20:32 +05:30
Devesh Kumar Singh cd1e8cd604 Type annotations for pip._internal.self_outdated_check 2020-05-22 03:05:22 +05:30
Devesh Kumar Singh 2d22608809 Type annotations for pip._internal.build_env 2020-05-22 03:00:55 +05:30
Devesh Kumar Singh 4812f77503 Add mypy annotations to pip._internal.req.req_tracker 2020-05-22 02:01:33 +05:30
Devesh Kumar Singh 311eb48ca5 Add mypy annotations to pip._internal.req.req_set 2020-05-22 02:01:15 +05:30
Devesh Kumar Singh ea3aa04987 Add mypy annotations to pip._internal.req.constructors 2020-05-22 01:56:59 +05:30
Pradyun Gedam a731989b0f
Document the html5lib modification in Vendoring docs 2020-05-22 00:43:08 +05:30
Devesh Kumar Singh 5e33373a07 Remove req.name check 2020-05-22 00:42:37 +05:30
Devesh Kumar Singh 716a067335 Return int status code from download.run 2020-05-22 00:32:37 +05:30
Devesh Kumar Singh 197bbceed1 Add news file and convert TransformedHit type to TypedDict 2020-05-21 23:54:18 +05:30
Devesh Kumar Singh 50cbd6a032 Assert not None instead of if check 2020-05-21 22:46:56 +05:30
Pradyun Gedam 24e4cf7118
Update comments and documentation 2020-05-21 21:47:42 +05:30
Pradyun Gedam 901898c84f
Make mypy happy 2020-05-21 21:47:42 +05:30
Pradyun Gedam 9506a28114
ExtrasCandidate depends on exact base, before optional dependencies 2020-05-21 21:47:42 +05:30
Pradyun Gedam 95347df102
Directly require BaseCandidate in ExtrasCandidate 2020-05-21 21:47:42 +05:30
Pradyun Gedam 775f9ff6ca
Add a helper for making ExplicitRequirement objects 2020-05-21 21:47:38 +05:30
Pradyun Gedam 76b865155e
Merge pull request #8145 from sbidoul/simplfy-should_cache-sbi 2020-05-21 21:30:40 +05:30
Paul Moore 278ac2d67f
Merge pull request #8286 from uranusjr/read-root-extras-correctly
Always read InstallRequirement.extras
2020-05-21 16:05:35 +01:00
Paul Moore 90168f0b24
Merge pull request #8230 from uranusjr/markers-in-deps
Only include dependencies if the markers match
2020-05-21 15:26:38 +01:00
Devesh Kumar Singh 0d48186d1b Allow --prefer-binary option in requirements file 2020-05-21 19:37:45 +05:30
Devesh Kumar Singh 64c78b19b9 Reword warning for invalid content-type 2020-05-21 19:37:03 +05:30
Devesh Kumar Singh 1bc7f535ca Warn if package index gets unexpected Content-Type 2020-05-21 19:37:03 +05:30
Stéphane Bidoul 5cc4f2e390
Pass explicit arguments to install_given_req. 2020-05-21 15:35:39 +02:00
Tzu-ping Chung d848ee934d Always read InstallRequirement.extras 2020-05-21 20:33:06 +08:00
Tzu-ping Chung de63eae0c3 Match logging 2020-05-21 18:09:35 +08:00
Paul Moore 374a12bc5a Bump for development 2020-05-21 09:33:44 +01:00
Paul Moore 96225c9124 Bump for release 2020-05-21 09:33:43 +01:00
Tzu-ping Chung e6352bc468 Return package dependencies only if markers match 2020-05-21 16:14:26 +08:00
Tzu-ping Chung 5ebf22248c Ignore root dependencies with non-matching markers 2020-05-21 15:53:03 +08:00
Tzu-ping Chung c3ac76f66c Turn Candidate.get_dependencies() into iterable
This makes it easier to exclude dependencies when markers don't match.
2020-05-21 15:39:16 +08:00
Christian Heimes bf31e536b3 Don't use cElementTree on Python 3
It's been deprecated and will be removed in 3.9 or 3.10. 3.9.0b1 doesn't
have cElementTree. I'd like to bring it back with a deprecation warning
to drop in 3.10.

See: https://github.com/python/cpython/pull/19921
Signed-off-by: Christian Heimes <christian@python.org>
2020-05-21 00:21:01 +02:00
Devesh Kumar Singh d84c14013a Type annotations for pip._internal.utils.unpacking 2020-05-20 23:13:00 +05:30
Devesh Kumar Singh e9901982bf Type annotations for pip._internal.utils.encoding 2020-05-20 23:12:49 +05:30
Devesh Kumar Singh c469e11d47 Type annotations for pip._internal.network.auth 2020-05-20 23:12:23 +05:30
Tzu-ping Chung 418d9051b8 Set max_rounds to an incredibly large number
We really don't want to raise ResolutionTooDeep yet since the metric is
not very useful. Try to avoid this until we come up with a better method
to count.
2020-05-20 21:15:09 +08:00
Stéphane Bidoul 803a6f2017
Merge pull request #8271 from deveshks/add-mypy-cache-xmlrpc-form_contr
Add mypy type annotations to cache, xmlrpc in network and format_control in models module
2020-05-20 10:19:30 +02:00
Devesh Kumar Singh 65a6152f02 Remove Optional type from xmlrpc bool parameters 2020-05-20 12:40:05 +05:30
Devesh Kumar Singh fdc062475e Type annotations for pip._internal.network.xmlrpc 2020-05-19 22:13:44 +05:30
Devesh Kumar Singh e572d9e0c9 Type annotations for pip._internal.network.cache 2020-05-19 22:13:44 +05:30
Devesh Kumar Singh 1bd8903815 Type annotations for pip._internal.models.format_control 2020-05-19 22:13:32 +05:30
Tzu-ping Chung 0a31845007 Explode the record row for readability 2020-05-19 16:03:51 +08:00
Tzu-ping Chung dd50a03f10 Use unicode for filesystem stuff on Python 2 2020-05-19 16:03:51 +08:00
Tzu-ping Chung 1056681686 Non-ASCII names are not weird 2020-05-19 16:03:51 +08:00
Tzu-ping Chung dc4171c213 Python 2 works but not tested 2020-05-19 16:03:51 +08:00
Tzu-ping Chung 7a54132b16 Can drop the strict-optional marker now 2020-05-19 16:03:51 +08:00
Tzu-ping Chung 2339a7a859 Fix installation of wheel with non-ASCII entries
This mainly deals with correctly recording the wheel content in the
RECORD metadata. This metadata file must be written in UTF-8, but the
actual files need to be installed to the filesystem, the encoding of
which is not (always) UTF-8. So we need to carefully handle file name
encoding/decoding when comparing RECORD entries to the actual file.

The fix here makes sure we always use the correct encoding by adding
strict type hints. The entries in RECORD is decoded/encoded with UTF-8
on the read/write boundaries to make sure we always deal with text
types. A type-hint-only type RecordPath is introduced to make sure this
is enforced (because Python 2 "helpfully" coerces str to unicode with
the wrong encoding).
2020-05-19 16:03:51 +08:00
Devesh Kumar Singh 4f98df6e3e Type annotations for pip._internal.commands.search 2020-05-19 12:45:22 +05:30
Devesh Kumar Singh 2da7a2b077 Type annotations for pip._internal.commands.download 2020-05-19 12:45:22 +05:30
Devesh Kumar Singh f7cd93a5de Type annotations for pip._internal.commands.freeze 2020-05-19 12:45:22 +05:30
Pradyun Gedam e7dd02c723
Merge pull request #8027 from gutsytechster/pip/7998 2020-05-19 12:14:59 +05:30
Devesh Kumar Singh 60f00b837a Upgrade flake8 to 3.8.1
Co-Authored-By: Anthony Sottile <asottile@umich.edu>
2020-05-18 21:58:26 +05:30
Pradyun Gedam d0ab9bd8bd
Merge pull request #8235 from deveshks/remove-pretty-arg-from-mypy 2020-05-18 19:40:22 +05:30
Tzu-ping Chung f39134699b Avoid the horrendous line break for type hints 2020-05-18 17:15:06 +08:00
Tzu-ping Chung ec86cb1970 Use OrderedDict to prefer links found *later* 2020-05-18 16:35:09 +08:00
Devesh Kumar Singh 4d208b02b4 Cast record file to typing.IO[str] to appease mypy for python 2 2020-05-18 12:27:26 +05:30
Pradyun Gedam 301f65fad8
Merge pull request #8016 from deveshks/add-mypy-annotations-commands 2020-05-17 23:14:46 +05:30
Pradyun Gedam 04f63ca377
Merge pull request #8018 from deveshks/add-mypy-annotations-hash-show-wheel 2020-05-17 23:13:23 +05:30