Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importlib-metadata DeprecationWarning #2934

Closed
adamchainz opened this issue Apr 10, 2021 · 3 comments · Fixed by #2947
Closed

importlib-metadata DeprecationWarning #2934

adamchainz opened this issue Apr 10, 2021 · 3 comments · Fixed by #2947
Labels
interop how to play nicely with other packages

Comments

@adamchainz
Copy link
Contributor

Seen on adamchainz/mariadb-dyncol#298

   File "/home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/lib/python3.7/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "/home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/lib/python3.7/site-packages/hypothesis/__init__.py", line 61, in <module>
    run()
  File "/home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/lib/python3.7/site-packages/hypothesis/entry_points.py", line 61, in run
    for entry in get_entry_points():  # pragma: no cover
  File "/home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/lib/python3.7/site-packages/hypothesis/entry_points.py", line 32, in get_entry_points
    yield from importlib_metadata.entry_points().get("hypothesis", [])
  File "/home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 312, in get
    flake8_bypass(self._warn)()
DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
ERROR: InvocationError for command /home/runner/work/mariadb-dyncol/mariadb-dyncol/.tox/py37/bin/python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m pytest (exited with code 1)
@adamchainz
Copy link
Contributor Author

adamchainz commented Apr 10, 2021

changelog

This can be solved by depending on importlib-metadata 3.9.0+ on Python < 3.10 and using the select interface, OR by using backports.entry-points-selectable.

@Zac-HD Zac-HD added the interop how to play nicely with other packages label Apr 11, 2021
@Zac-HD
Copy link
Member

Zac-HD commented Apr 11, 2021

We've written a fair bit of extra code to ensure that our entry-points logic doesn't add a hard dependency; so I think the best option is to use select if it's available in

def get_entry_points():
yield from importlib_metadata.entry_points().get("hypothesis", [])

and fall back to the existing logic on older versions. Thanks for the report 😄

@adamchainz
Copy link
Contributor Author

Why not add a dependency on importlib-metadata? That’s what I’ve done in pytest-randomly to avoid this deprecation warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop how to play nicely with other packages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants