Skip to content

feat: enable mypy session for db-dtypes#16689

Merged
chalmerlowe merged 7 commits intomainfrom
feat-enable-mypy-db-dtypes
Apr 17, 2026
Merged

feat: enable mypy session for db-dtypes#16689
chalmerlowe merged 7 commits intomainfrom
feat-enable-mypy-db-dtypes

Conversation

@chalmerlowe
Copy link
Copy Markdown
Contributor

This PR enables the mypy session in noxfile.py for db-dtypes and aligns it with the GAPIC generator template. It passes with some type ignores added for missing stubs and internal pandas usage.

@chalmerlowe chalmerlowe requested review from a team as code owners April 16, 2026 14:42
@chalmerlowe chalmerlowe requested review from tswast and removed request for a team April 16, 2026 14:42
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 enables mypy type checking by adding a dedicated nox session and applying type suppression comments across the codebase. The review feedback highlights several areas where type safety can be improved beyond simple suppression, such as correctly initializing the base class in core.py, declaring internal methods as class attributes, and fixing an invalid type hint for na_value. It is also suggested to remove the broad --ignore-missing-imports flag from the mypy configuration to avoid masking potential environment issues.

Comment thread packages/db-dtypes/db_dtypes/core.py
Comment thread packages/db-dtypes/db_dtypes/core.py Outdated
Comment thread packages/db-dtypes/db_dtypes/json.py Outdated
Comment thread packages/db-dtypes/noxfile.py
chalmerlowe and others added 2 commits April 16, 2026 11:20
Giving pd.NAType a try instead of Any to see if that passes.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
segregated the steps associated with assigning values to NDArrayBackedExtensionArray versus PandasObject/ExtensionArray to improve clarity and avoid a mypy type hinting issue.
Comment thread packages/db-dtypes/db_dtypes/core.py Outdated
indents function definition.
Attempting to assign values to the attributes directly resulted in write errors.
@chalmerlowe chalmerlowe requested review from a team as code owners April 17, 2026 14:23
@chalmerlowe chalmerlowe force-pushed the feat-enable-mypy-db-dtypes branch from 2222ee9 to c5b6937 Compare April 17, 2026 14:26
@chalmerlowe chalmerlowe merged commit 856731e into main Apr 17, 2026
30 checks passed
@chalmerlowe chalmerlowe deleted the feat-enable-mypy-db-dtypes branch April 17, 2026 15:58
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