Commit Graph

93 Commits

Author SHA1 Message Date
Damian Shaw 68529081c2
Enforce f-strings via Ruff (#12393) 2023-11-07 09:14:56 +00:00
Stéphane Bidoul 8a1a8d7915 Always use pep 517 when the 'wheel' package is absent 2023-03-27 11:55:20 +01:00
Stéphane Bidoul 5189a6e0f4 --no-binary does not imply setup.py install anymore 2023-03-12 17:18:53 +01:00
Stéphane Bidoul 857df9059d
Add maintenance comment 2022-09-18 10:05:59 +02:00
Stéphane Bidoul f39d38668a
Deprecate --no-binary implying setup.py install 2022-09-17 15:37:04 +02:00
Stéphane Bidoul d8e2d6605a
Rename BinaryAllowedPredicate
It really is a BdistWheelAllowedPredicate and
this will make it easier to reason when --no-binary
does not imply setup.py install anymore.
2022-08-12 13:51:45 +02:00
Stéphane Bidoul df8a5011b6
Simplify should_build 2022-08-12 13:51:45 +02:00
Stéphane Bidoul ae802e3e66
Deprecate setup.py install fallback when wheel package is absent 2022-08-06 19:33:30 +02:00
Stéphane Bidoul e7449498d3
Record origin url in wheel cache 2022-05-22 22:46:35 +02:00
Pradyun Gedam 531c991ef9
Require every `call_subprocess` call-site to pass `command_desc`
This serves as additional context that can be presented in error
messages.
2022-01-25 01:38:22 +00:00
Stéphane Bidoul ae512892eb
Prepare legacy editable metadata in isolated env
When there is a pyproject.toml, metadata preparation must be
done in the isolated build environment for legacy editable installs too
(fixes a regression).

Also detect earlier if an editable install must go through the
legacy install path, to be sure to run it in an environment
with the correct build requirements.
2021-10-18 14:34:50 +02:00
Stéphane Bidoul e5be3f796e
Add PEP 660 support (build_editable) 2021-09-28 23:04:51 +02:00
Tzu-ping Chung 135faabfd6
Remove direct pkg_resource usages from resolver and preparer 2021-08-23 02:07:33 +08:00
Pradyun Gedam 585037a80a
Cleanup implicit string concatenation 2021-08-20 13:37:52 +01:00
Pradyun Gedam 94999255d5
Reformat the codebase, with black 2021-08-20 13:37:49 +01:00
Jon Dufresne 6a6561c2cb Move many type comments to annotations
Use the tool com2ann to automatically convert most type comments to type
annotations. Some type comments continue to exist where any work beyond
the automatic conversion was required (for example, additional
formatting or circular references).

For additional information on the com2ann tool, see:
https://github.com/ilevkivskyi/com2ann
2021-08-10 07:12:32 -07:00
Stéphane Bidoul 7c6ee48b04 PEP 517 build in presence of --global-option emits a warning
So these are not ignored silently.
2021-04-04 16:08:49 +02:00
Stéphane Bidoul 69dee6286d PEP 517 + --build-option is now a warning
We warn instead of erroring out when --build-option is present
when doing a PEP 517 build. There is no strong reason to error
out, and this will avoid backward compatibility issues when we
support build options in requirement files and installation.
2021-04-04 16:08:49 +02:00
Andrey Bienkowski cd7b50277e Use f-strings for formatting 2021-03-29 10:37:24 +03:00
Tzu-ping Chung 56a8f3d8bd Typing fixes 2021-03-10 16:40:58 +08:00
Jon Dufresne 0945809afc Remove typing.TYPE_CHECKING guards
The typing module has been available since Python 3.5. Guarding the
import has been unnecessary since dropping Python 2.

Some guards remain to either:

- Avoid circular imports
- Importing objects that are also guarded by typing.TYPE_CHECKING
- Avoid mypy_extensions dependency
2021-02-19 18:34:21 -08:00
Jon Dufresne a6392bd62e Replace pip._internal.utils.typing with stdlib typing
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.

By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
2021-02-18 19:09:13 -08:00
Tzu-ping Chung d16a5036de Remove direct pkg_resources usage in wheel_builder 2021-02-04 12:10:28 +08:00
Pradyun Gedam c7419b2aac
Merge pull request #9320 from uranusjr/wheel-check-valid
Verify built wheel contains valid metadata
2021-01-05 21:47:53 +00:00
Stéphane Bidoul 06f1eff024
Simplify check_binary_allowed
check_binary_allowed is only used to check
if a wheel needs to be built in 'pip install' mode.
It mixed format control and pep517 mode check.

We change it so it checks allowed formats only,
which leads to better readability of _should_build().
2020-12-31 13:17:44 +01:00
Tzu-ping Chung 6902269d4c Verify built wheel contains valid metadata 2020-12-27 20:13:34 +08:00
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Stéphane Bidoul fe5682627a
Quote 'setup.py install' when calling it legacy
We want to make it clear that it is the setup.py install command we consider
legacy, not setup.py itself.
2020-07-18 13:46:19 +02:00
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
Devesh Kumar Singh 76a130105c Fix src/pip with flake8-bugbear 2020-06-10 00:36:03 +05:30
Pradyun Gedam 76b865155e
Merge pull request #8145 from sbidoul/simplfy-should_cache-sbi 2020-05-21 21:30:40 +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
Stéphane Bidoul d8c14d4006
Clarify message when wheel is not installed 2020-05-01 09:57:16 +02:00
Stéphane Bidoul c20f778899
Do not unncessarily warn about wheel being absent
Do not warn about the wheel package being absent
if wheel building would have been skipped for another reason.
2020-05-01 09:57:15 +02:00
Stéphane Bidoul 88da3441ce
Simplify _should_cache
The condition "never cache if pip install would not have built"
can be simplified to "do not cache editable requirements".
This is easier to read, and avoid a double warning if the 'wheel'
package is not installed.
2020-04-26 11:31:02 +02:00
Tzu-ping Chung 510aa46580 Space after comma 2020-04-17 22:39:35 +08:00
Anudit Nagar e6ed38dbce
Add info log when wheel building is skipped (#7768) 2020-02-23 22:56:36 +01:00
Stéphane Bidoul (ACSONE) 0e1e0ef566 _should_cache does not depend on check_binary_allowed
_should_cache is only called by _get_cache_dir.

In pip install mode, _get_cache_dir is never called when
check_binary_allowed returns False because in that case
should_build_for_install_command has returned False before
and the build was skipped.

In pip wheel mode, check_binary_allowed always returns True
(because it is not passed to the build function).

So _should_cache can use _always_true for check_binary_allowed.

*Alternative*

Alternatively, we could have passed check_binary_allowed
to build in pip wheel mode. The only difference is that wheels built
locally from *legacy* packages would then not be cached,
when pip wheel is used with --no-binary.
2020-01-20 10:41:48 +01:00
Stéphane Bidoul (ACSONE) 5aa3b3d2f0
Remove unused build() argument 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) 66e010980a
Remove WheelBuilder
build is now a function
2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) 9729273ca8
Make should_build and should_cache "private" 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) c0aca12123
Clarify should_cache a bit 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) 25521f29b5
should_build always returns a boolean 2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE) 6e7d0e5a05
_collect_buildset becomes _get_cache_dir
The only purpose of _collect_buildset is now
to compute the cache directory to use
for a given requirements. This is better
computed one by one in the build loop.
2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE) 870106b9bb
Simplify _collect_buildset
Since filtering of what to build has been
done beforehand, there is no need to filter
again here anymore.
2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE) 8ca8e9bf61
Extend should_build scope wrt legacy requirements
We don't build legacy requirements
when wheel is not installed because
we'll fallback to a legacy install in such case.
2020-01-05 23:52:40 +01:00
Stéphane Bidoul (ACSONE) 3de4765ec7
Add should_build function for wheel and install commands 2020-01-05 23:52:40 +01:00
Chris Hunt a94fb53dad Don't unpack wheel files after building for install
Actual installation has been using the wheel file directly for some
time. The last piece that required an unpacked wheel was metadata. Now
that it uses the wheel file directly, we can remove the unpacking after
build.
2020-01-05 10:57:15 -05:00
Stéphane Bidoul (ACSONE) 8d1d20de8c
Do not attempt setup.py clean for failed pep517 builds
Fixes #6642
2020-01-02 12:14:03 +01:00