Skip to content

[BUG]: _ClientMixin is not typed properly #330

@HenriChabert

Description

@HenriChabert

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)
Image

To Reproduce

  1. Install lago-python-client
  2. Activate strict typing on Python
  3. 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:

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions