Use stdlib importlib.resources on python >= 3.12

Review Request #13997 — Created June 25, 2024 and updated




Our Python maintenance team is against packaging importlib-resources for Fedora1, as we already ship a recent enough version of Python and don't need a compatibility layer.

The unsatisfiable dependency currently blocks update to 5.0 so I'm planning to apply this patch to the package.

rbt setup-completion works correctly on Fedora 40 (Python 3.12) and on EL9 (Python 3.9)

Checks run (2 succeeded)
flake8 passed.
JSHint passed.
  1. Hey, thanks for the change!

    There are reasons we're still universally using the backport modules for now. They tend to receive updates and fixes that may not be present in the Python versions. This is the same for typing_extensions.

    For example, importlib_resources has bug fixes for opening package-provided file streams that aren't present in at least my version of Python 3.12's. There are also fixes for working with Zip-based packages, which may not be an issue on RBTools, but would be for some Review Board users.

    importlib_metadata is more similar from an implementation standpoint, but differs from a Python type hint standpoint, which impacts the development when running type checkers against 3.12. Admittedly a minor issue, just a difference between implementations.

    These might not impact users for the usage in RBTools, but it's worth showing how one package is not always a drop-in replacement for the other in all cases.