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

3.0.0: `pygal` uses deprecated `pkg_resources` #535

Closed kloczek closed 8 months ago

kloczek commented 1 year ago

For example on testing pytest-benchmark latest pytest complains about use pkg_resources

tests/test_storage.py:169: in test_rendering
    sess.display(Namespace(
../../BUILDROOT/python-pytest-benchmark-4.0.0-3.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_benchmark/session.py:231: in display
    results_table.display(tr, self.groups, progress_reporter=progress_reporter)
../../BUILDROOT/python-pytest-benchmark-4.0.0-3.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_benchmark/table.py:135: in display
    from .histogram import make_histogram
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:172: in exec_module
    exec(co, module.__dict__)
../../BUILDROOT/python-pytest-benchmark-4.0.0-3.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_benchmark/histogram.py:9: in <module>
    from pygal.graph.box import Box
/usr/lib/python3.8/site-packages/pygal/__init__.py:32: in <module>
    import pkg_resources
/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:121: in <module>
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
E   DeprecationWarning: pkg_resources is deprecated as an API

Here where pygal uses pkg_resources

[tkloczko@pers-jacek pygal]$ grep pkg_ -r
pygal/__init__.py:import pkg_resources
pygal/__init__.py:for entry in pkg_resources.iter_entry_points('pygal.maps'):
pygal/test/test_maps.py:import pkg_resources
pygal/test/test_maps.py:for entry in pkg_resources.iter_entry_points('pygal.test.test_maps'):
cedk commented 8 months ago

Fixed by fd4f336cffb402fa58fda97bfe702f0ca4f99772

rhpvorderman commented 7 months ago

Can this change be included in a new release? Automated testing on github actions is failing with the following message:

     import pygal  # type: ignore
.tox/testenv/lib/python3.12/site-packages/pygal/__init__.py:32: in <module>
    import pkg_resources
E   ModuleNotFoundError: No module named 'pkg_resources'

This is for python 3.12 on ubuntu-latest.

glepretre commented 7 months ago

@rhpvorderman version 3.0.1 has been released on pypi : https://pypi.org/project/pygal/3.0.1/

rhpvorderman commented 7 months ago

Thank you! Unfortunately I run into issue #545 now. So github automated actions are still failing on 3.12. Thanks for the prompt response. Hopefully the issue can be easily fixed.