You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Dictionary support not reflected in type annotations #1380
This is a follow-up to #986 (closed). Retesting the recent google-cloud-documentai==1.5.0 version, the issue is still present.
This code is valid:
import google.cloud.documentai_v1 as documentai
client_options = dict(api_endpoint="eu-documentai.googleapis.com")
client = documentai.DocumentProcessorServiceClient(client_options=client_options)
But it triggers the following type checker warning:
Argument of type "dict[str, str]" cannot be assigned to parameter "client_options" of type "ClientOptions | None" in function "__init__"
Type "dict[str, str]" cannot be assigned to type "ClientOptions | None"
"dict[str, str]" is incompatible with "ClientOptions"
If you check the source, client_options can be a dict, yet its declaration says otherwise:
Activity
atulep commentedon Aug 15, 2022
@PicardParis
Yup, your code looks good. Feel free to open a PR. Otherwise, my team will triage this issue and resolve it, but may take longer.
PicardParis commentedon Aug 16, 2022
Hi, I thought the library was auto-generated from protobufs. Please confirm that it's not and I'll make a PR.
vam-google commentedon Aug 26, 2022
@PicardParis The library is generated, so the change should be done not in the lib, but in gapic-generator-python (i.e. this repository) instead. The changes are most likely to happen in one of the template files (
*.py.j2files). I would look into changing somethign here: https://github.com/googleapis/gapic-generator-python/blob/main/gapic/templates/%25namespace/%25name_%25version/%25sub/services/%25service/client.py.j2#L279PicardParis commentedon Sep 6, 2022
@atulep @vam-google
fix: Add supported dict typing for client_options (#1464)