Skip to content

Commit

Permalink
Improved compatibility with future versions of setuptools (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Oct 25, 2024
1 parent 9254a4f commit 28c1ba1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Release Notes
=============

**UNRELEASED**

- Added a redirection from ``wheel.bdist_wheel.bdist_wheel`` to
``setuptools.command.bdist_wheel.bdist_wheel`` to improve compatibility with
``setuptools``' latest fixes.

Projects are still advised to migrate away from the deprecated module and import
the ``setuptools``' implementation explicitly. (PR by @abravalheri)

**0.44.0 (2024-08-04)**

- Canonicalized requirements in METADATA file (PR by Wim Jeantine-Glenn)
Expand Down
19 changes: 17 additions & 2 deletions src/wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
from typing import TYPE_CHECKING
from warnings import warn

from ._bdist_wheel import bdist_wheel as bdist_wheel

warn(
"The 'wheel' package is no longer the canonical location of the 'bdist_wheel' "
"command, and will be removed in a future release. Please update to setuptools "
"v70.1 or later which contains an integrated version of this command.",
DeprecationWarning,
stacklevel=1,
)

if TYPE_CHECKING:
from ._bdist_wheel import bdist_wheel as bdist_wheel
else:
try:
# Better integration/compatibility with setuptools:
# in the case new fixes or PEPs are implemented in setuptools
# there is no need to backport them to the deprecated code base.
# This is useful in the case of old packages in the ecosystem
# that are still used but have low maintenance.
from setuptools.command.bdist_wheel import bdist_wheel
except ImportError:
# Only used in the case of old setuptools versions.
# If the user wants to get the latest fixes/PEPs,
# they are encouraged to address the deprecation warning.
from ._bdist_wheel import bdist_wheel as bdist_wheel

0 comments on commit 28c1ba1

Please sign in to comment.