google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

Type safety issues

Open nicholas-johnson-techxcel opened this issue 5 months ago • 0 comments

Determine this is the right repository

  • [x] I determined this is the correct repository in which to report this bug.

Summary of the issue

Using VSCode or Cursor.ai editor, with everything set up (type checking strict, ruff linter and pyright) the project has

  • no py.typed file
  • Functions with no annotated return value
  • no type stubs

Which means the editor complains and all code which touches this library is lit up red, making it hard to tell real issues from GCP python library issues.

Google has vast resources, they can afford to take due diligence and follow mainstream best practices in software development lifecycle, which includes making sure type safety works.

Please annotate your return types and make a py.typed file.

I am using python 3.13.4 and google-cloud-storage==3.2.0

API client name and version

google-cloud-storage==3.2.0

Reproduction steps: code

.vscode/settings.json

{
  "python.analysis.typeCheckingMode": "strict"
}

With the Python and Pylance extensions installed. Even the pyrightconfig.json does not help:

{
  "typeCheckingMode": "strict",
  "pythonVersion": "3.13",
  "analyzeUnannotatedFunctions": true,
  "useLibraryCodeForTypes": true,
  "reportMissingTypeStubs": false
}

Reproduction steps: supporting files

Reproduction steps: actual results

Already given

Reproduction steps: expected results

I expect that libraries function with type safety and do not cause errors just by importing them.

OS & version + platform

No response

Python environment

3.13.4

Python dependencies

$ pip freeze | grep -i google google-api-core==2.25.1 google-auth==2.40.3 google-cloud-core==2.4.3 google-cloud-storage==3.2.0 google-crc32c==1.7.1 google-resumable-media==2.7.2 googleapis-common-protos==1.70.0

Additional context

No response