importlib_resources>=6.0 is incompatible with mailman/testing/i18n.py and others.

  File "/private/var/MM/3/master/mailman/src/mailman/__init__.py", line 36, in <module>
    from mailman.testing.i18n import initialize
  File "/private/var/MM/3/master/mailman/src/mailman/testing/i18n.py", line 22, in <module>
    from importlib_resources import open_binary
ImportError: cannot import name 'open_binary' from 'importlib_resources' (/private/var/MM/3/master/mailman/.tox/py38-nocov/lib/python3.8/site-packages/importlib_resources/__init__.py)

importlib_resources 6.0 removed the, deprecated since 5.3, importlib_resources.open_binary() function. This can be replaced as

from importlib_resources import _common
def open_binary(package: Package, resource: Resource) -> BinaryIO:
    """Return a file-like object opened for binary reading of the resource."""
    return (_common.files(package) / _common.normalize_path(resource)).open('rb')

See https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy.

This requires importlib_resources>=1.3.

This affects several modules, not just testing/i18n.py.

Edited by Mark Sapiro