Skip to content

Commit 269a773

Browse files
committed
Deprecate legacy install when --no-binary is used
1 parent e6b1c93 commit 269a773

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

news/9769.feature.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Deprecate legacy setup.py install when --no-binary is used:
2+
3+
- add a new feature flag ``--use-feature=always-install-via-wheel``, that is intended to become the default and only mechanism in the future
4+
- when ``--no-binary`` is used without the feature flag, emit a deprecation warning about the fallback to ``setup.py install``
5+
- 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
6+
- when ``--no-binary`` is used with the feature flag, the wheel that was built locally is cached (unless the cache is disabled)
7+
- 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
8+
- deprecate ``--install-option``
9+
- 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``

src/pip/_internal/req/req_install.py

+11
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,17 @@ def install(
800800
self.install_succeeded = True
801801
return
802802

803+
if self.legacy_install_reason == 9769:
804+
deprecated(
805+
reason=(
806+
"Installing {} using the legacy 'setup.py install' "
807+
"method, due to binaries being disabled for it.".format(self.name)
808+
),
809+
replacement="--use-feature=always-install-via-wheel",
810+
gone_in=None,
811+
issue=9769,
812+
)
813+
803814
# TODO: Why don't we do this for editable installs?
804815

805816
# Extend the list of global and install options passed on to

src/pip/_internal/wheel_builder.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ def _should_build(
7878
return True
7979

8080
if not check_binary_allowed(req):
81-
logger.info(
82-
"Using legacy 'setup.py install' for %s, due to binaries "
83-
"being disabled for it.", req.name,
84-
)
81+
req.legacy_install_reason = 9769
8582
return False
8683

8784
if not is_wheel_installed():

0 commit comments

Comments
 (0)