LaboratoireMecaniqueLille / crappy

Command and Real-time Acquisition Parallelized in Python
https://crappy.readthedocs.io/en/stable/
GNU General Public License v2.0
78 stars 16 forks source link

The `pkg_resources` module is deprecated #75

Open WeisLeDocto opened 9 months ago

WeisLeDocto commented 9 months ago

The pkg_resources module is used in Crappy at two locations:

However, this module is deprecated and should be removed in future releases of Python. The replacement importlib.resources module was introduced in Python 3.7 as part of the standard library, and covers at least the use cases of pkg_resources found in Crappy. A migration guide even specifies replacements for porting the common use cases of pkg_resources to importlib.resources.

On the long term, pkg_resources should therefore be replaced in Crappy with importlib.resources. However, most of the original importlib.resources API was deprecated in Python 3.11, and replaced with features added in Python 3.9. Replacing pkg_resources with importlib.resources in Crappy while still supporting Python 3.8 to 3.12 therefore means implementing both versions of the importlib.resources API, with a check on the current Python version to determine which one to use.

This action has a low priority since pkg_resources still works on Python 3.8 to 3.12. It will become more urgent in case support for this module is dropped in Python 3.13.