Kozea / pygal

PYthon svg GrAph plotting Library
https://www.pygal.org
GNU Lesser General Public License v3.0
2.62k stars 411 forks source link

Use importlib.metadata (pygal requires 3.8+) #546

Closed akx closed 7 months ago

akx commented 7 months ago

Fixes https://github.com/Kozea/pygal/issues/545#issuecomment-1820314396

importlib_metadata from PyPI is only required for Python < 3.8; importlib.metadata is always available on 3.8+, and the minimum python_requires here is 3.8+ (https://github.com/Kozea/pygal/commit/01649cb5d3295ba2a7e1a47e79f924068f1ebb71).

Regressed in https://github.com/Kozea/pygal/commit/d1d02c69891ddd5367903ea0bb11d260c3cac219

akx commented 7 months ago

cc @gentooboontoo :)

gentooboontoo commented 7 months ago

Thanks @akx. Unfortunately importlib.metadata API changed in Python 3.10.

Unless I am wrong, using importlib_metadata allows to use the latest API with Python < 3.10 (see https://github.com/Kozea/pygal/issues/545#issue-1998441625 and compatibility notes). The dependency will be dropped once support for Python 3.9 is discontinued.

akx commented 7 months ago

@gentooboontoo Shouldn't tests catch that? I'm currently on mobile so I can't see whether CI has run here.

akx commented 7 months ago

(Back from lunch.) Oh, there is no CI that would run here... I can make a PR to fix that first made a PR to fix that: #549.

akx commented 7 months ago

Okay, never mind – until targeting Python 3.10+, using importlib-metadata from PyPI is probably an okay idea.

See https://pypi.org/project/backports.entry-points-selectable/.