The pkg_resources module is used in Crappy at two locations:
in the base __init__.py file of the module for exposing test images
in the camera_config.py tool and its children, to display an error image when no image can be grabbed from the driven Camera
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.
The
pkg_resources
module is used in Crappy at two locations:__init__.py
file of the module for exposing test imagescamera_config.py
tool and its children, to display an error image when no image can be grabbed from the driven CameraHowever, 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 ofpkg_resources
found in Crappy. A migration guide even specifies replacements for porting the common use cases ofpkg_resources
toimportlib.resources
.On the long term,
pkg_resources
should therefore be replaced in Crappy withimportlib.resources
. However, most of the originalimportlib.resources
API was deprecated in Python 3.11, and replaced with features added in Python 3.9. Replacingpkg_resources
withimportlib.resources
in Crappy while still supporting Python 3.8 to 3.12 therefore means implementing both versions of theimportlib.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.