Skip to content

Commit 28c1ba1

Browse files
authored
Improved compatibility with future versions of setuptools (#638)
1 parent 9254a4f commit 28c1ba1

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

docs/news.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Release Notes
22
=============
33

4+
**UNRELEASED**
5+
6+
- Added a redirection from ``wheel.bdist_wheel.bdist_wheel`` to
7+
``setuptools.command.bdist_wheel.bdist_wheel`` to improve compatibility with
8+
``setuptools``' latest fixes.
9+
10+
Projects are still advised to migrate away from the deprecated module and import
11+
the ``setuptools``' implementation explicitly. (PR by @abravalheri)
12+
413
**0.44.0 (2024-08-04)**
514

615
- Canonicalized requirements in METADATA file (PR by Wim Jeantine-Glenn)

src/wheel/bdist_wheel.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1+
from typing import TYPE_CHECKING
12
from warnings import warn
23

3-
from ._bdist_wheel import bdist_wheel as bdist_wheel
4-
54
warn(
65
"The 'wheel' package is no longer the canonical location of the 'bdist_wheel' "
76
"command, and will be removed in a future release. Please update to setuptools "
87
"v70.1 or later which contains an integrated version of this command.",
98
DeprecationWarning,
109
stacklevel=1,
1110
)
11+
12+
if TYPE_CHECKING:
13+
from ._bdist_wheel import bdist_wheel as bdist_wheel
14+
else:
15+
try:
16+
# Better integration/compatibility with setuptools:
17+
# in the case new fixes or PEPs are implemented in setuptools
18+
# there is no need to backport them to the deprecated code base.
19+
# This is useful in the case of old packages in the ecosystem
20+
# that are still used but have low maintenance.
21+
from setuptools.command.bdist_wheel import bdist_wheel
22+
except ImportError:
23+
# Only used in the case of old setuptools versions.
24+
# If the user wants to get the latest fixes/PEPs,
25+
# they are encouraged to address the deprecation warning.
26+
from ._bdist_wheel import bdist_wheel as bdist_wheel

0 commit comments

Comments
 (0)