Avoid generating modules that conflict with builtin modules #2269
Labels
next major: breaking change
this is a change that we should wait to bundle into the next major version
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.
A file
logging.py
exists in the generated client forgoogle-cloud-logging
in the directorygoogle/cloud/logging_v2/types
here.It's not ideal to import the client using the statement
from google.cloud.logging_v2.types import logging
like we do here :gapic-generator-python/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/client.py
Line 42 in d874809
The reason is that logging is also a built-in Python3 module, and
from google.cloud.logging_v2.types import logging
will clobber the built-in modulelogging
.See the error in https://github.com/googleapis/gapic-generator-python/actions/runs/12129001516/job/33816582330
The fix is to ensure that we don't generate files which conflict with built-in modules. As an example, instead of
logging.py
, we could havetypes_logging.py
The text was updated successfully, but these errors were encountered: