Skip to content

Use of pkg_resources is deprecated and throws DeprecationWarning #252

@Metamess

Description

@Metamess

Since setuptools version 67.3.1, the use of pkg_resources.declare_namespace() is deprecated (and in fact the use of pkg_resources in it's entirety, see https://setuptools.pypa.io/en/latest/pkg_resources.html) and will throw a DeprecationWarning on use. This library and function is currently being used in the various __init__.py files in this project.

Environment details

  • OS type and version: Ubuntu 22.04.3 LTS
  • Python version: 3.10.12
  • pip version: 23.3
  • google-cloud-core version: 2.3.3

Steps to reproduce

  1. Have setuptools >= 67.3.1 installed (released 14 Feb 2023, latest version at time of writing is 68.2.2)
  2. import google.cloud in python code (either directly or via a module with a dependency on google.cloud)
  3. run the python code, for example using pytest

Code example

import google.cloud

Stack trace

.venv/lib/python3.10/site-packages/pkg_resources/__init__.py:2804
  /.venv/lib/python3.10/site-packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.cloud')`.
  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
    declare_namespace(pkg)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions