mihai-dinculescu / tapo

Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P115, P300), hubs (H100), switches (S200B) and sensors (KE100, T100, T110, T300, T310, T315).
MIT License
313 stars 30 forks source link

cannot import 'LightHander' or 'ColorLightHandler' for typings #218

Closed alfadormx closed 1 month ago

alfadormx commented 1 month ago

Hello,

First of all, thank @mihai-dinculescu for your work in this library. So, while all we need is to import the ApiClient to use this library, I am trying to add Type support for intellisense in VSCode so I am importing:

from tapo import ApiClient, LightHandler, ColorLightHandler

and my editor now looks like this: image

However, this happens when I run the code: image

This is the list of all my imports, I hope this issue isn't related to shadowing or something.

import asyncio
import colorsys
import sys
import TouchPortalAPI as TP
import yaml
from functools import wraps
from typing import Awaitable, Dict, Optional, Tuple, TypeVar, Union
from argparse import ArgumentParser
from TouchPortalAPI.logger import Logger
from tapo import ApiClient, LightHandler, ColorLightHandler

So my questions is, were LightHandler and ColorLightHandler not intented to be imported like this? If so, how to import them? Thank you kindly for your help pointing me into the right direction.

mihai-dinculescu commented 1 month ago

They were supposed to be exported. I've just merged a fix to main.

Thank you for reporting this issue!

alfadormx commented 1 month ago

Thank you for fixing this issue. Has this push to main fixed the package dependency? I mean, to take advantage of this fix, shall I only reinstall the dependency with pip?

mihai-dinculescu commented 1 month ago

Not yet. I'll wait a few more days to gather a couple more changes before cutting a new release. You can build it from source (the git repo) if you want to use it right away.