Skip to content

Commit 8411993

Browse files
authored
DEPS: use importlib for backend discovery #41815 (#42410)
1 parent 2ed97c0 commit 8411993

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

doc/source/getting_started/install.rst

-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ Visualization
262262
========================= ================== =============================================================
263263
Dependency Minimum Version Notes
264264
========================= ================== =============================================================
265-
setuptools 38.6.0 Utils for entry points of plotting backend
266265
matplotlib 3.3.2 Plotting library
267266
Jinja2 2.11 Conditional formatting with DataFrame.style
268267
tabulate 0.8.7 Printing in Markdown-friendly format (see `tabulate`_)

doc/source/whatsnew/v1.4.0.rst

-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ If installed, we now require:
8383
+-----------------+-----------------+----------+---------+
8484
| mypy (dev) | 0.910 | | X |
8585
+-----------------+-----------------+----------+---------+
86-
| setuptools | 38.6.0 | | |
87-
+-----------------+-----------------+----------+---------+
8886

8987
For `optional libraries <https://pandas.pydata.org/docs/getting_started/install.html>`_ the general recommendation is to use the latest version.
9088
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.

pandas/plotting/_core.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ def _load_backend(backend: str) -> types.ModuleType:
17431743
types.ModuleType
17441744
The imported backend.
17451745
"""
1746-
import pkg_resources
1746+
from importlib.metadata import entry_points
17471747

17481748
if backend == "matplotlib":
17491749
# Because matplotlib is an optional dependency and first-party backend,
@@ -1759,11 +1759,13 @@ def _load_backend(backend: str) -> types.ModuleType:
17591759

17601760
found_backend = False
17611761

1762-
for entry_point in pkg_resources.iter_entry_points("pandas_plotting_backends"):
1763-
found_backend = entry_point.name == backend
1764-
if found_backend:
1765-
module = entry_point.load()
1766-
break
1762+
eps = entry_points()
1763+
if "pandas_plotting_backends" in eps:
1764+
for entry_point in eps["pandas_plotting_backends"]:
1765+
found_backend = entry_point.name == backend
1766+
if found_backend:
1767+
module = entry_point.load()
1768+
break
17671769

17681770
if not found_backend:
17691771
# Fall back to unregistered, module name approach.

0 commit comments

Comments
 (0)