Skip to content

chore: complete google-cloud-dns migration#16678

Open
jskeet wants to merge 2 commits intogoogleapis:mainfrom
jskeet:reformat-google-cloud-dns
Open

chore: complete google-cloud-dns migration#16678
jskeet wants to merge 2 commits intogoogleapis:mainfrom
jskeet:reformat-google-cloud-dns

Conversation

@jskeet
Copy link
Copy Markdown
Contributor

@jskeet jskeet commented Apr 16, 2026

  • Reformat with nox
  • Enable generation with librarian
  • Regenerate with librarian

@jskeet jskeet requested a review from parthea April 16, 2026 07:03
@jskeet jskeet requested a review from a team as a code owner April 16, 2026 07:03
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 17 to 18
from google.cloud import _http

from google.cloud.dns import __version__
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
from google.cloud import _http
from google.cloud.dns import __version__
from google.cloud import _http
from google.cloud.dns import __version__
References
  1. PEP 8 recommends grouping imports: standard library, third-party, and local application imports, with a blank line between each group. (link)

@parthea parthea self-assigned this Apr 16, 2026
from google.cloud.dns.zone import ManagedZone
from google.cloud.dns.resource_record_set import ResourceRecordSet

from google.cloud.dns.version import __version__
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

from google.cloud.accessapproval_v1 import gapic_version as package_version
__version__ = package_version.__version__

@parthea parthea assigned jskeet and unassigned parthea Apr 16, 2026
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

Successfully merging this pull request may close these issues.

2 participants