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

DeprecationWarning: pkg_resources is deprecated as an API on python 3.11 #201

Open
CaselIT opened this issue Aug 11, 2023 · 1 comment · May be fixed by #203
Open

DeprecationWarning: pkg_resources is deprecated as an API on python 3.11 #201

CaselIT opened this issue Aug 11, 2023 · 1 comment · May be fixed by #203

Comments

@CaselIT
Copy link

CaselIT commented Aug 11, 2023

Running python -Werror -c 'import flake8_import_order.styles' on python 3.11+ raises the pkg_resource deprecation DeprecationWarning: pkg_resources is deprecated as an API

@CaselIT
Copy link
Author

CaselIT commented Aug 11, 2023

fix seems to be something like

import sys

if sys.version_info >= (3, 10):
    import importlib.metadata as importlib_metadata
else:
    import importlib_metadata


def lookup_entry_point(name):
    try:
        (ep,) = importlib_metadata.entry_points(
            name=name, group="flake8_import_order.styles"
        )
        return ep
    except ValueError:
        raise LookupError("Unknown style {}".format(name))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant