Skip to content

Commit

Permalink
Deprecate legacy install when --no-binary is used
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Apr 3, 2021
1 parent 9a55ff2 commit 6e1f503
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
9 changes: 9 additions & 0 deletions news/9769.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Deprecate legacy setup.py install when --no-binary is used:

- add a new feature flag ``--use-feature=always-install-via-wheel``, that is intended to become the default and only mechanism in the future
- when ``--no-binary`` is used without the feature flag, emit a deprecation warning about the fallback to ``setup.py install``
- when ``--no-binary`` is used with the feature flag, build a wheel from the sdist (via PEP 517 or ``setup.py bdist_wheel``) then install it
- when ``--no-binary`` is used with the feature flag, the wheel that was built locally is cached (unless the cache is disabled)
- since ``--install-option``, ``--build-option`` and ``--global-option`` imply ``--no-binary``, the deprecation warning will be emitted when these options are used without the feature flag
- deprecate ``--install-option``
- allow using ``--build-option`` in the ``install`` command, as well as in ``requirement.txt`` lines, as a transitory mechanism until the ecosystem supports PEP 517 config settings, which are meant to replace both ``--build-options`` and ``--global-options``
12 changes: 12 additions & 0 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,18 @@ def install(
self.install_succeeded = True
return

if self.legacy_install_reason == 9769:
deprecated(
reason=(
"Installing {} using the legacy 'setup.py install' "
"method, due to binaries being disabled for it.".
format(self.name)
),
replacement="--use-feature=always-install-via-wheel",
gone_in=None,
issue=9769,
)

# TODO: Why don't we do this for editable installs?

# Extend the list of global and install options passed on to
Expand Down
5 changes: 1 addition & 4 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ def _should_build(
return True

if not check_binary_allowed(req):
logger.info(
"Using legacy 'setup.py install' for %s, due to binaries "
"being disabled for it.", req.name,
)
req.legacy_install_reason = 9769
return False

if not is_wheel_installed():
Expand Down

0 comments on commit 6e1f503

Please sign in to comment.