Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

2.2.0 breaks typing checks in applications #734

Description

@syphar

In #716 a py.typed file was added to tell mypy that it should use the provided type annotations (or stub-files) in this package.

Problem with that: there are no type annotations and no stub-file.

In our application this leads to errors like this:
grafik

( only on 2.2.0, not in 2.1.0)

Environment details

  • Mac OS 12.2.1
  • Python version: 3.10.2
  • pip version: 21.2.4
  • google-cloud-storage version: 2.2.0

Steps to reproduce

  1. install 2.2.0 in your application
  2. use a class anywhere ( it broke for Client and Blob for me
  3. use mypy --strict ( I believe the needed settings are disallow_untyped_defs or disallow_untyped_calls, but I'm not 100% certain. I can provide my config if that's needed).

Code example

importjsonimportosfromfunctoolsimportcachefromgoogle.cloudimportstoragefromgoogle.oauth2importservice_account@cachedef_client() ->storage.Client:
ifstorage_key:=os.environ.get("GOOGLE_CLOUD_STORAGE_KEY", None):
data=json.loads(storage_key)
credentials=service_account.Credentials.from_service_account_info(data)
returnstorage.Client( # typing error here credentials=credentials,
project=data["project_id"],
)

possible solution

  • add type annotations to all methods & classes
  • remove the py.typed marker again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/python-storage API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions