Skip to content

Remove dependency on deprecated distutils #507

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

Closed
noirbee opened this issue Jun 13, 2023 · 1 comment · Fixed by #541
Closed

Remove dependency on deprecated distutils #507

noirbee opened this issue Jun 13, 2023 · 1 comment · Fixed by #541
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@noirbee
Copy link

noirbee commented Jun 13, 2023

The distutils module has been deprecated and will be removed in Python3.12: https://docs.python.org/3.11/library/distutils.html

setuptools also discourages using its vendored version: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html#prefer-setuptools

The explicit distutils dependency / import in abstract_operations_client.py is only needed for one call to distutils.util.strtobool():

util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"))

We encountered this under Python3.10 due to the way we build / run our code under Docker. This can be easily circumvented in our case by installing the python3-distutils Debian package, but the dependency should probably be removed from this package.

Environment details

  • OS type and version: Linux 218300304P 6.1.0-9-amd64 [CHANGE ME] Re-generated to pick up changes in the API or client library generator. #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64 GNU/Linux
  • Python version: Python 3.12.0b2
  • pip version: pip 23.1.2 from /tmp/venv/lib/python3.12/site-packages/pip (python 3.12)
  • google-api-core version: Name: google-api-core Version: 2.11.0 Summary: Google API client core library Home-page: https://github.com/googleapis/python-api-core Author: Google LLC Author-email: [email protected] License: Apache 2.0 Location: /tmp/venv/lib/python3.12/site-packages Requires: google-auth, googleapis-common-protos, protobuf, requests Required-by:

Steps to reproduce

  1. python3.12 -m venv /tmp/venv
  2. /tmp/venv/bin/pip install google-api-core

Code example

from google.api_core.operations_v1.abstract_operations_client import AbstractOperationsClient

Stack trace

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python3.12/site-packages/google/api_core/operations_v1/__init__.py", line 17, in <module>
    from google.api_core.operations_v1.abstract_operations_client import AbstractOperationsClient
  File "/tmp/venv/lib/python3.12/site-packages/google/api_core/operations_v1/abstract_operations_client.py", line 17, in <module>
    from distutils import util
ModuleNotFoundError: No module named 'distutils'
@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jun 13, 2023
@MarkDaoust
Copy link
Contributor

With python 3.12 out now (Early Oct 2023) this is blocking people from upgrading, can we raise the priority on this and #540?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants