google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

deprecation warning related to the `google` namespace package

Open kadeschs opened this issue 5 months ago • 1 comments

Environment details

  • OS type and version: Home Assistant container (Docker on Synology NAS)
  • Python version: 3.13
  • google-api-python-client version: 2.71.0
  • Installed via: pip (inside container)

Problem description

When running Home Assistant on Python 3.13, I encountered a deprecation warning related to the google namespace package: /usr/local/lib/python3.13/site-packages/google/init.py:2: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html.. The pkg_resources package is slated for removal as early as 2025-11-30. import('pkg_resources').declare_namespace(name).

Suggested fix

Consider migrating to pkgutil or importlib for namespace declaration, as pkg_resources is deprecated and scheduled for removal in future Python versions.

Steps to reproduce

  1. Run Home Assistant 2025.8 in a Docker container using Python 3.13.
  2. Observe logs at startup for py.warnings related to pkg_resources.

Code example

import homeassistant.components.cast

Stack trace

/usr/local/lib/python3.13/site-packages/google/init.py:2: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. import('pkg_resources').declare_namespace(name)

kadeschs avatar Aug 11 '25 17:08 kadeschs