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
Describe the bug
When using strict typing with Python, and trying to call function find or find_all, I receive the following typing error:
Cannot access attribute "find_all" for class "SubscriptionClient"
Could not bind method "find_all" because "SubscriptionClient" is not assignable to parameter "self"
"SubscriptionClient" is incompatible with protocol "_ClientMixin[SubscriptionResponse]"
"API_RESOURCE" is not defined as a ClassVar in protocol
"RESPONSE_MODEL" is not defined as a ClassVar in protocol
"ROOT_NAME" is not defined as a ClassVar in protocolPylance[reportAttributeAccessIssue](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportAttributeAccessIssue)
To Reproduce
Install lago-python-client
Activate strict typing on Python
Paste the following code:
from lago_python_client.client import Client as LagoClient
lago_client = LagoClient(
api_url="https://api.lago.dev",
api_key="sk_test_1234567890",
)
subscriptions_api = lago_client.subscriptions()
lago_subscriptions = subscriptions_api.find_all()
You should see the following typing error:
Expected behavior
Output type from find_all should not be unknown, and actually be list[SubscriptionResponse]
Screenshots
See above
Support
OS: macOS Sequoia - Version 15.5
Browser: Chrome
Version: lago-python-client == 1.32.0
Reacted by Jean-Baptiste Louazel and Victor Faucon
After investigating the solutions on the codebase, I understand the problem that came up, and that makes things hard to fix. The fact is that ClassVar does not support Generic as parameter, which makes it hard to use in our case.
A proposal would be to still use ClassVar[Type[_PM]] in BaseClient and _ClientMixin and use # type: ignore for this. It seems the variable still works as a ClassVar, and the whole typing work properly. Other changes are just to assign Generic of BaseClient for all clients, for example:
Hi Lago team! I opened PR #441 aligning BaseClient and _ClientMixin with ClassVar attributes, splitting _ChildClientMixin from _NestedClientMixin, and typing options/params as Optional[QueryPairs] along with regression tests in tests/test_mixin_protocols.py.
Activity
HenriChabert commentedon Aug 3, 2025
After investigating the solutions on the codebase, I understand the problem that came up, and that makes things hard to fix. The fact is that
ClassVardoes not supportGenericas parameter, which makes it hard to use in our case.A proposal would be to still use
ClassVar[Type[_PM]]inBaseClientand_ClientMixinand use# type: ignorefor this. It seems the variable still works as aClassVar, and the whole typing work properly. Other changes are just to assignGenericofBaseClientfor all clients, for example:What do you think of that ?
eldertek commentedon Nov 15, 2026
Hi Lago team! I opened PR #441 aligning
BaseClientand_ClientMixinwithClassVarattributes, splitting_ChildClientMixinfrom_NestedClientMixin, and typingoptions/paramsasOptional[QueryPairs]along with regression tests intests/test_mixin_protocols.py.