BentoML icon indicating copy to clipboard operation
BentoML copied to clipboard

bug: pyright failed

Open zsaladin opened this issue 10 months ago • 0 comments

Describe the bug

It seems to occur because of usage of lower python version. typing.Concatenate has been introduced since Python 3.10. But I'm uisng Python 3.9

bentoml supports Python3.8 and more. So IMO you may need typing extentions to support lower versions of python.

To reproduce

import bentoml


@bentoml.service
class Service:
    @bentoml.api
    async def svc(self, text: str) -> int:
        return 1

pyright .

/mypath/service.py:6:6 - error: Argument of type "(self: Self@Service, text: str) -> Coroutine[Any, Any, int]" cannot be assigned to parameter "func" of type "() -> R@api" in function "api"
    Type "(self: Self@Service, text: str) -> Coroutine[Any, Any, int]" cannot be assigned to type "() -> R@api" (reportArgumentType)
1 error, 0 warnings, 0 informations 

Expected behavior

pyright .

0 error, 0 warnings, 0 informations 

Environment

[tool.poetry.dependencies]
python = "~3.9."
bentoml = "^1.2.10"

[tool.poetry.group.dev.dependencies]
pyright = "^1.1.358"

[tool.pyright]
typeCheckingMode = "basic"
reportPrivateImportUsage = "none"

zsaladin avatar Apr 12 '24 06:04 zsaladin