protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Fix deprecated use of `namespace_packages` in `python/dist/setup.py`

Open tempoz opened this issue 1 year ago • 2 comments

Uses implicit namespaces instead of explicit, as per https://peps.python.org/pep-0420/

Fixes a warning otherwise output during build.

tempoz avatar Sep 11 '24 13:09 tempoz

You will also have to remove the file python/google/__init__.py otherwise it will interfere with Python's namespace logic and Python will not treat it as a namespace package (I think :D ).

urbas avatar Sep 26 '24 13:09 urbas

Can you include the warning you hit without this?

Also you'll need to rebase to run the tests.

zhangskz avatar Oct 17 '24 22:10 zhangskz

Here's the error:

+ python3 setup.py sdist
/home/zoey/.cache/bazel/_bazel_zoey/48c075afba7cdea78ebdc9043475bc88/sandbox/linux-sandbox/7457/execroot/com_google_protobuf/external/pip_deps_setuptools/site-packages/setuptools/dist.py:679: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated.
!!

        ********************************************************************************
        Please replace its usage with implicit namespaces (PEP 420).

        See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages for details.
        ********************************************************************************

!!
  ep.load()(self, ep.name, value)

And I've rebased now, so it should be good to go!

tempoz avatar Nov 15 '24 18:11 tempoz