Replace pkg_resources.iter_entry_points with importlib.metadata.entry_points
pkg_resources package has some performance deficiencies when it comes to handling entry_points. The newer
importlib.metadata package, built on top of the new importlib infrastructure in Python 3, performs better and is recommended for future use. While it has been integrated into the standard library with Python 3.8, a sufficiently recent version is only integrated from Python 3.10 onwards. In the meantime, we rely on the third-party package
importlib_metadata with an import guard to make the functionality available.