GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add type hints to Client by rinarakaki · Pull Request #2044 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@rinarakaki

@rinarakaki rinarakaki commented Oct 21, 2024

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rinarakaki
add type hints
14fd6a9
@rinarakaki
rinarakaki requested review from a team and agrawal-siddharth October 21, 2024 10:32
@blunderbuss-gcf blunderbuss-gcf Bot assigned Neenu1995 Oct 21, 2024
@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Oct 21, 2024
@conventional-commit-lint-gcf

conventional-commit-lint-gcf Bot commented Oct 21, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Oct 21, 2024
chalmerlowe
chalmerlowe reviewed Nov 21, 2024
View reviewed changes
Comment thread google/cloud/bigquery/client.py
Comment on lines +244 to +249
if client_options is None:
client_options = {}
if isinstance(client_options, dict):
client_options = google.api_core.client_options.from_dict(client_options)
assert isinstance(client_options, google.api_core.client_options.ClientOptions)

@chalmerlowe chalmerlowe Nov 21, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I am curious, why did we choose to:

  • move this content from after the call to super() to before the call to super()? What is the reason for reordering this content?
  • add an assert statement when one was not used previously?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rinarakaki rinarakaki Nov 22, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

  • Moving this part before the call to super() is optional, but I did it because actually the exact same type check & coercion happens inside the super() (Client.__init__) as well, so I let it early break in the second time.
  • The reason for adding the assert statement is to let the type checker know the type of client_options, otherwise it wouldn't know that the if client_options.api_endpoint: expression at the line 261 is valid .

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 25, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 25, 2024
@chalmerlowe

chalmerlowe commented Nov 25, 2024

Copy link
Copy Markdown
Collaborator

@rinarakaki I ran the kokoro CI/CD checks.
There are a number of things that are going wrong both in the standard tests and in mypy.
I spent as much time as I could today trying to trouble shoot the issues, to no avail.
I have other tasks that require my attention. If you are able to figure out why these tests fail I am willing to come back and take another look at this.

mypy errors:

google/cloud/bigquery/client.py:265: error: Incompatible types in assignment
   (expression has type "str", target has type "Optional[ClientInfo]")  [assignment]
google/cloud/bigquery/client.py:269: error: Incompatible types in assignment
   (expression has type "str", target has type "Optional[ClientInfo]")  [assignment]

unit test errors:

tests/unit/conftest.py:19: in 
    from .helpers import make_client
tests/unit/helpers.py:19: in 
    import google.cloud.bigquery.client
google/cloud/bigquery/__init__.py:36: in 
    from google.cloud.bigquery.client import Client
google/cloud/bigquery/client.py:185: in 
    class Client(ClientWithProject):
google/cloud/bigquery/client.py:235: in Client
    _http: Optional[requests.Session] = None,
E   NameError: name 'requests' is not defined
rinarakaki reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chalmerlowe and others added 4 commits December 4, 2024 07:31
@chalmerlowe
Merge branch 'main' into typing-client
a0a0f99
@rinarakaki
Merge branch 'main' into typing-client
624df2b
@chalmerlowe
Update client.py
a3c2b7f
Moves import from being used solely during specific checks to being more universally available.
@chalmerlowe
Merge branch 'main' into typing-client
9950656
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
chalmerlowe
chalmerlowe reviewed Dec 10, 2024
View reviewed changes
Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@chalmerlowe
Update google/cloud/bigquery/client.py
a71e193
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
@chalmerlowe
Update client.py
701ef13
testing some minor changes to deal with mypy quirks
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
chalmerlowe
chalmerlowe reviewed Dec 10, 2024
View reviewed changes
Comment thread google/cloud/bigquery/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@chalmerlowe
Update google/cloud/bigquery/client.py
0f8af52
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 10, 2024
chalmerlowe
chalmerlowe approved these changes Dec 10, 2024
View reviewed changes

@chalmerlowe chalmerlowe left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rinarakaki reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@chalmerlowe
chalmerlowe merged commit 40529de into googleapis:main Dec 10, 2024
@chalmerlowe

chalmerlowe commented Dec 10, 2024

Copy link
Copy Markdown
Collaborator

@rinarakaki

Thanks for providing this update to the code.

rinarakaki reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@release-please release-please Bot mentioned this pull request Dec 6, 2024
chore(main): release 3.28.0 #2056
Merged
@rinarakaki
rinarakaki deleted the typing-client branch December 11, 2024 04:33
chalmerlowe added a commit that referenced this pull request Jan 2, 2025
@rinarakaki @chalmerlowe
feat: add type hints to Client (#2044)
c4f5fd5
* add type hints

* Update client.py

Moves import from being used solely during specific checks to being more universally available.

* Update google/cloud/bigquery/client.py

* Update client.py

testing some minor changes to deal with mypy quirks

* Update google/cloud/bigquery/client.py

---------

Co-authored-by: Chalmer Lowe <[email protected]>
This was referenced Jan 21, 2025
January 20, 2025 kitta65/bq-extension-vscode#639
Closed
January 20, 2025 kitta65/prettier-plugin-bq#579
Closed
January 20, 2025 kitta65/bq2cst#468
Closed
lkhagvadorj-amp pushed a commit to lkhagvadorj-amp/python-bigquery that referenced this pull request Feb 21, 2025
@rinarakaki @chalmerlowe @lkhagvadorj-amp
feat: add type hints to Client (googleapis#2044)
a46beb7
* add type hints

* Update client.py

Moves import from being used solely during specific checks to being more universally available.

* Update google/cloud/bigquery/client.py

* Update client.py

testing some minor changes to deal with mypy quirks

* Update google/cloud/bigquery/client.py

---------

Co-authored-by: Chalmer Lowe <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@agrawal-siddharth agrawal-siddharth Awaiting requested review from agrawal-siddharth
1 more reviewer
@chalmerlowe chalmerlowe chalmerlowe approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Neenu1995 Neenu1995

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: s Pull request size is small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rinarakaki @chalmerlowe @Neenu1995 @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.