Skip to content
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

google-api-python-client overwrites the __init__.py file of api-client #57

Open
archatas opened this issue Jan 18, 2025 · 1 comment
Open

Comments

@archatas
Copy link

One of the dependencies google-api-python-client overwrites the __init__.py file of api-client, and if it has been used by other packages, there is an unresolved conflict.

The original __init__.py:

# Allow direct access to the base client and other methods.
from apiclient.authentication_methods import (
    BasicAuthentication,
    HeaderAuthentication,
    NoAuthentication,
    QueryParameterAuthentication,
)
from apiclient.client import APIClient
from apiclient.decorates import endpoint
from apiclient.paginators import paginated
from apiclient.request_formatters import JsonRequestFormatter
from apiclient.response_handlers import JsonResponseHandler, RequestsResponseHandler, XmlResponseHandler
from apiclient.retrying import retry_request

The overwritten one:

"""Retain apiclient as an alias for googleapiclient."""

from googleapiclient import channel, discovery, errors, http, mimeparse, model

try:
    from googleapiclient import sample_tools
except ImportError:
    # Silently ignore, because the vast majority of consumers won't use it and
    # it has deep dependence on oauth2client, an optional dependency.
    sample_tools = None
from googleapiclient import schema

_SUBMODULES = {
    "channel": channel,
    "discovery": discovery,
    "errors": errors,
    "http": http,
    "mimeparse": mimeparse,
    "model": model,
    "sample_tools": sample_tools,
    "schema": schema,
}

import sys

for module_name, module in _SUBMODULES.items():
    sys.modules["apiclient.%s" % module_name] = module
@archatas archatas changed the title google-api-python-client overwrite the __init__.py file of apiclient google-api-python-client overwrites the __init__.py file of apiclient Jan 18, 2025
@archatas archatas changed the title google-api-python-client overwrites the __init__.py file of apiclient google-api-python-client overwrites the __init__.py file of api-client Jan 18, 2025
@archatas
Copy link
Author

After a quick search I found that it's a known bug: googleapis/google-api-python-client#2485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant