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

Naming conflict when importing ga_operation #819

Closed
parthea opened this issue Mar 22, 2021 · 1 comment · Fixed by #820 or #1133
Closed

Naming conflict when importing ga_operation #819

parthea opened this issue Mar 22, 2021 · 1 comment · Fixed by #820 or #1133
Assignees
Labels
priority: p3 Desirable enhancement or 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

@parthea
Copy link
Contributor

parthea commented Mar 22, 2021

I'm having trouble generating the client for appengine v1 and I found the issue is that there is a naming conflict with ga_operation

In client.py, ga_operation has a naming conflict.

from google.api_core import operation as ga_operation

conflicts with

from google.cloud.appengine_admin_v1.types import operation as ga_operation
__________________________________ ERROR collecting tests/unit/gapic/appengine_admin_v1/test_applications.py __________________________________
tests/unit/gapic/appengine_admin_v1/test_applications.py:38: in <module>
    from google.cloud.appengine_admin_v1.services.applications import (
google/cloud/appengine_admin_v1/__init__.py:18: in <module>
    from .services.applications import ApplicationsClient
google/cloud/appengine_admin_v1/services/applications/__init__.py:18: in <module>
    from .client import ApplicationsClient
google/cloud/appengine_admin_v1/services/applications/client.py:78: in <module>
    class ApplicationsClient(metaclass=ApplicationsClientMeta):
google/cloud/appengine_admin_v1/services/applications/client.py:392: in ApplicationsClient
    ) -> ga_operation.Operation:
E   AttributeError: module 'google.cloud.appengine_admin_v1.types.operation' has no attribute 'Operation'
@parthea parthea self-assigned this Mar 22, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 23, 2021
@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels Mar 23, 2021
@software-dov
Copy link
Contributor

Root cause turns out to be that raw imports in e.g. test template are not being added to name disambiguation. Fix is to add "auth" et al to RESERVED_NAMES.

software-dov pushed a commit that referenced this issue Mar 23, 2021
In the current design, the first character of each package is used to create an alias. I'd like to append the first character before underscores in the package name to further reduce conflicts.

Previously google.appengine_admin would have an alias prefix of ga. With this change, the alias prefix will be gaa.

Fixes: #819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment