Skip to content

feat: enable mypy session for db-dtypes#16689

Open
chalmerlowe wants to merge 3 commits intomainfrom
feat-enable-mypy-db-dtypes
Open

feat: enable mypy session for db-dtypes#16689
chalmerlowe wants to merge 3 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.

values = values.copy()

super().__init__(values=values, dtype=values.dtype)
super().__init__(values=values, dtype=values.dtype) # type: ignore[call-arg]
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

The call-arg error indicates that the base class's __init__ does not accept these arguments. If the base class is ExtensionArray or PandasObject, it should be called without arguments.

Suggested change
super().__init__(values=values, dtype=values.dtype) # type: ignore[call-arg]
super().__init__()

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.

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>
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