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

Tests fail on Python 3.11 due to importlib.resources DeprecationWarning #140

Closed
encukou opened this issue Mar 25, 2022 · 1 comment · Fixed by #144
Closed

Tests fail on Python 3.11 due to importlib.resources DeprecationWarning #140

encukou opened this issue Mar 25, 2022 · 1 comment · Fixed by #144

Comments

@encukou
Copy link
Contributor

encukou commented Mar 25, 2022

Tests fail on Python 3.11:

pep517/in_process/__init__.py:14: in _in_proc_script_path
    return resources.path(__package__, '_in_process.py')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = ('pep517.in_process', '_in_process.py'), kwargs = {}

    @functools.wraps(func)
    def wrapper(*args, **kwargs):
>       warnings.warn(
            f"{func.__name__} is deprecated. Use files() instead. "
            "Refer to https://importlib-resources.readthedocs.io"
            "/en/latest/using.html#migrating-from-legacy for migration advice.",
            DeprecationWarning,
            stacklevel=2,
        )
E       DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.

/usr/lib64/python3.11/importlib/resources/_legacy.py:18: DeprecationWarning
@encukou
Copy link
Contributor Author

encukou commented Mar 25, 2022

The page mentioned in the error message is not helpful, and the current docs don't quite explain a non-deprecated way to get a file using importlib.resources (the Traversable API is not yet documented).

The code suggests a workaround of not using importlib.resources, however: the except clause works:

https://github.com/pypa/pep517/blob/a942316305395f8f757f210e2b16f738af73f8b8/pep517/in_process/__init__.py#L10-L18

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