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 }}
Repository navigation
Pyright has issues with some things in 3.10.0 of the api #445
Pyright has issues with some things in 3.10.0 of the api
These two things are really common in our code
from shotgun_api3 import Shotgun
has this warning "Shotgun" is not exported from module "shotgun_api3" Import from "shotgun_api3.shotgun" instead (Pyright)
I assume since __init__.py doesn't define an __all__
And when accessing any fields returned from the api asset['code'] Could not access item in TypedDict "code" is not a defined key in "BaseEntity" (Pyright)
Yeah, we've noticed both of these recently as well.
I think the BaseEntity typeddict is too strict for the use case of most shotgun codebases and should be replaced with a Dict[str, Any].
The spirit of using a TypedDict is nice, but in practice if you do sg.find("Version", [...], ["code", "entity"]), you know that code and entity both exist. The TypedDict requiring that you use .get() instead of accessing it directly is unreasonable.
total=False means that the keys defined are not required, which does not match the API contract that is documented in the Shotgun.find method. It says:
:returns: list of dictionaries representing each entity with the requested fields, and the
defaults ``"id"`` and ``"type"`` which are always included.
Activity
austinwitherspoon commentedon Apr 23, 2026
Yeah, we've noticed both of these recently as well.
I think the BaseEntity typeddict is too strict for the use case of most shotgun codebases and should be replaced with a
Dict[str, Any].The spirit of using a TypedDict is nice, but in practice if you do
sg.find("Version", [...], ["code", "entity"]), you know thatcodeandentityboth exist. The TypedDict requiring that you use.get()instead of accessing it directly is unreasonable.add __all__ to avoid linting warnings
jhultgre commentedon Jul 21, 2026
would fix the linting errors for extra keys, but needs
typing_extensions.TypedDictinstead of typing.TypedDictdkbarn commentedon Aug 19, 2026
total=Falsemeans that the keys defined are not required, which does not match the API contract that is documented in theShotgun.findmethod. It says:source
If "id" and "type" are always included, then the correct type definition would be: