Skip to content

Latest mypy checks fail for several generated packages #2579

@parthea

Description

@parthea

PR #2530 updated the mypy version to the latest.

This change is blocking googleapis/google-cloud-python#16063 where there are several mypy failures.

See https://github.com/googleapis/google-cloud-python/actions/runs/22913070856/job/66490664690?pr=16063

As an example

checking changes with 'git diff --quiet origin/main... packages/google-cloud-artifact-registry/'
change detected in packages/google-cloud-artifact-registry/
running test in packages/google-cloud-artifact-registry/
~/work/google-cloud-python/google-cloud-python/packages/google-cloud-artifact-registry ~/work/google-cloud-python/google-cloud-python
nox > Running session mypy-3.14
nox > Creating virtual environment (virtualenv) using python3.14 in .nox/mypy-3-14
nox > python -m pip install mypy types-requests types-protobuf
nox > python -m pip install .
nox > mypy -p google --check-untyped-defs
mypy.ini: [mypy-google.iam.*]: Per-module sections should only specify per-module flags (explicit_package_bases, incremental)
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py:3335: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py:3450: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py:3537: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py:2832: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py:2948: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py:3036: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/client.py:5594: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/client.py:5709: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/client.py:5796: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py:4959: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py:5075: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py:5163: error: Item "dict[Any, Any]" of "Any | dict[Any, Any]" has no attribute "resource"  [union-attr]
Found 12 errors in 4 files (checked 58 source files)

As a temporary fix, we should revert mypy back to 1.16.0 to unblock other features

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions