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

zodburi import raises a warning with setuptools 67.3+ #31

Open
azmeuk opened this issue Feb 15, 2023 · 2 comments
Open

zodburi import raises a warning with setuptools 67.3+ #31

azmeuk opened this issue Feb 15, 2023 · 2 comments

Comments

@azmeuk
Copy link
Member

azmeuk commented Feb 15, 2023

setuptools has just been released: https://setuptools.pypa.io/en/latest/history.html#v67-3-0

On a clean virtualenv, install zodburi, setuptools==67.3.1 and pytest, and run a dummy test:

def test_foobar():
    import zodburi

This will raise this warning:

________________________________________________________ test_foobar _________________________________________________________

    def test_foobar():
>       import zodburi

test_foobar.py:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/zodburi/__init__.py:2: in <module>
    from pkg_resources import iter_entry_points
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3257: in <module>
    def _initialize_master_working_set():
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3231: in _call_aside
    f(*args, **kwargs)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3282: in _initialize_master_working_set
    tuple(dist.activate(replace=False) for dist in working_set)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3282: in <genexpr>
    tuple(dist.activate(replace=False) for dist in working_set)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:2803: in activate
    declare_namespace(pkg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

packageName = 'zc'

    def declare_namespace(packageName):
        """Declare that package 'packageName' is a namespace package"""

        msg = (
            "Implementing implicit namespace packages (as specified in PEP 420) "
            "is preferred to `pkg_resources.declare_namespace`. "
            "See https://setuptools.pypa.io/en/latest/references/"
            "keywords.html#keyword-namespace-packages"
        )
>       warnings.warn(msg, DeprecationWarning, stacklevel=2)
E       DeprecationWarning: Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

The warning is not raised with setuptools 66

@azmeuk azmeuk changed the title zodburi import raise a warning with setuptools 67+ zodburi import raises a warning with setuptools 67+ Feb 15, 2023
@azmeuk azmeuk changed the title zodburi import raises a warning with setuptools 67+ zodburi import raises a warning with setuptools 67.3+ Feb 15, 2023
@azmeuk
Copy link
Member Author

azmeuk commented May 17, 2023

Also pkg_resources is being deprecated in the future. Python3.7 support stops on 27 Jun 2023 and then we should probably use importlib and importlib_metadata instead of pkg_resources.

@tseaver
Copy link
Member

tseaver commented May 4, 2024

PR #34 should resolve the pkg_resources API deprecations.

I believe that the namespace deprecation you observed is likely coming from the zc.lockfile package. The whinge there for the long-standing practice of having __init__.py in a namespace package directory isn't anything we can address in zodburi.

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

No branches or pull requests

2 participants