chore: complete google-cloud-dns migration#16678
chore: complete google-cloud-dns migration#16678jskeet wants to merge 2 commits intogoogleapis:mainfrom
Conversation
jskeet
commented
Apr 16, 2026
- Reformat with nox
- Enable generation with librarian
- Regenerate with librarian
There was a problem hiding this comment.
Code Review
This pull request updates the configuration and metadata for the google-cloud-dns package, including enabling generation in librarian.yaml and cleaning up .repo-metadata.json. It also performs extensive linting and import reordering across the codebase to improve consistency. A review comment suggests restoring a blank line between third-party and local imports in _http.py to adhere to PEP 8 standards.
| from google.cloud import _http | ||
|
|
||
| from google.cloud.dns import __version__ |
There was a problem hiding this comment.
According to PEP 8, there should be a blank line between related third-party imports and local application-specific imports. google.cloud._http is a dependency from google-cloud-core, while google.cloud.dns is part of the local package. This consistency is maintained in other files like changes.py and zone.py but was removed here.
| from google.cloud import _http | |
| from google.cloud.dns import __version__ | |
| from google.cloud import _http | |
| from google.cloud.dns import __version__ |
References
- PEP 8 recommends grouping imports: standard library, third-party, and local application imports, with a blank line between each group. (link)
| from google.cloud.dns.zone import ManagedZone | ||
| from google.cloud.dns.resource_record_set import ResourceRecordSet | ||
|
|
||
| from google.cloud.dns.version import __version__ |
There was a problem hiding this comment.
The import error is due to the __version__ being moved
The Execution Chain
__init__.py starts. It reaches line 27: from google.cloud.dns.client import Client.
client.py starts. It reaches line 21: from google.cloud.dns._http import Connection.
_http.py starts. It reaches line 18: from google.cloud.dns import __version__.
Back to __init__.py: Python looks for __version__ in google.cloud.dns. However, because __init__.py is still waiting for Client to finish loading, it hasn't reached the line where __version__ is defined yet. Crash.
Restoring the original code fixes the error
# 1. Define/Import the version FIRST
from google.cloud.dns.version import __version__
You can see a similar pattern in the generated clients were we have __version__ at the top