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

Package writes to "apiclient" directory when installed

Open kruton opened this issue 1 year ago • 3 comments

Environment details

  • OS type and version: Linux
  • Python version: 3.12.5
  • pip version: 24.2
  • google-api-python-client version: 2.145.0

Steps to reproduce

  1. python -m virtualenv venv
  2. . venv/bin/activate
  3. pip install api-client
  4. python -c 'from apiclient import HeaderAuthentication'
  5. pip install firebase-admin
  6. python -c 'from apiclient import HeaderAuthentication'

I expect step 6 to be the same as step 4 here, but it results in a stack trace since firebase-admin depends on google-api-python-client which is overwriting .../site-packages/apiclient/. What's even worse is that some package managers (e.g., poetry) seem to install this in a random order resulting in it sometimes working and sometimes not.

Code example

from apiclient import HeaderAuthentication

Stack trace

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'HeaderAuthentication' from 'apiclient' (/private/tmp/test1/venv/lib/python3.11/site-packages/apiclient/__init__.py)

kruton avatar Sep 18 '24 00:09 kruton

Thanks for reporting this @kruton. We'll take a look into this.

ohmayr avatar Sep 20 '24 15:09 ohmayr

I rebased the pull request #2486 onto the newest release.

kruton avatar Dec 06 '24 07:12 kruton

Hi, @ohmayr any chance this could be merged? I cut out the translated documentation changes to make it easier to review. The documentation should be generated automatically from googleapiclient/discovery.py next time pydoc is run.

kruton avatar Jan 31 '25 19:01 kruton