-
Notifications
You must be signed in to change notification settings - Fork 168
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.
Description
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:

( 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-storageversion:2.2.0
Steps to reproduce
- install 2.2.0 in your application
- use a class anywhere ( it broke for
ClientandBlobfor me - use
mypy --strict( I believe the needed settings aredisallow_untyped_defsordisallow_untyped_calls, but I'm not 100% certain. I can provide my config if that's needed).
Code example
import json
import os
from functools import cache
from google.cloud import storage
from google.oauth2 import service_account
@cache
def _client() -> storage.Client:
if storage_key := os.environ.get("GOOGLE_CLOUD_STORAGE_KEY", None):
data = json.loads(storage_key)
credentials = service_account.Credentials.from_service_account_info(data)
return storage.Client( # typing error here
credentials=credentials,
project=data["project_id"],
)possible solution
- add type annotations to all methods & classes
- remove the
py.typedmarker again.
pietrodn, sofijajvc, claudioscalzo, ocardia, davidepedranz and 14 more
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.