Skip to content

Provide "from_env" constructor in "DuneClient" class #153

@PaulRBerg

Description

@PaulRBerg

Problem

PyLance throws type errors when the Dune client is obtained by using the from_env constructor because the type returned is BaseDuneClient, which doesn't contain the methods available in QueryAPI:

Solution

I'm not a Python expert but I think that the solution is to override from_env in the DuneClient class so that it returns the type like this:

def from_env(cls) -> DuneClient:

Workaround

In the meantime, the workaround is to use the typing package like so:

dune = cast(DuneClient, DuneClient.from_env())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions