cognitedata/cognite-sdk-python

Typing error: Type of "list" is partially unknown

miladh opened this issue ยท 8 comments

System information (please complete the following information):

  • OS: Ubuntu
  • Python Version: 3.9.18
  • SDK Version: 7.28.2

Describe the bug
Versions after 7.28.0 (#1667) triggers the pyright error: Type of "list" is partially unknown, for e.g.:

client.assets.list(limit=-1) 

hellow can you give us a preffered output such as screenshot of how output you want

The preferred solution would be to not get the typing errors. Here is an example CI run from a renovate PR that bumped the SDK version in one of our repos, where the type-checker started to fail:
https://ci.jenkins.cogheim.net/blue/organizations/jenkins/cognitedata-ci%2Fcog-ai/detail/PR-1649/10/pipeline

By adding # type: ignore[reportUnknownMemberType] I was able to suppress the error, see e.g. this commit.

But I believe this is something that should be fixed in SDK

I'm unable to reproduce with 3.8 and 3.9. After taking a look at the referenced repo, I don't see pylint being an explicit dependency so I'm not sure what version of pylint to test with (I looked at pyproject.toml, .pre-commit-config.yaml and the Jenkinsfile)

I'm unable to reproduce with 3.8 and 3.9. After taking a look at the referenced repo, I don't see pylint being an explicit dependency so I'm not sure what version of pylint to test with (I looked at pyproject.toml, .pre-commit-config.yaml and the Jenkinsfile)

We are using pyright as type checker.

.pre-commit-config.yaml uses the make command py-lint (unfortunate choice of name), which runs poetry run pyright.
The pyright version we are using is 1.1.354

@miladh oh, haha, I see ๐Ÿ˜… I ran it using poetry:

poetry run pre-commit run py-lint --all-files

...but somehow it succeeds for me ๐Ÿค” Is main perhaps updated - ah of course. I checked out 085ae95a2ea3fcba75231eda683ba86dd150e903 and I get the same errors. I'll have a look tomorrow ๐Ÿ‘

@miladh ...I've found the cause after quite some trial and error ๐Ÿ˜… Made a PR here: #1682. I'll ping you once it has been merged and a new release has been made.

@miladh ...I've found the cause after quite some trial and error ๐Ÿ˜… Made a PR here: #1682. I'll ping you once it has been merged and a new release has been made.

Awesome @haakonvt and thank you for looking into this ๐Ÿ™

Released now! Took the liberty to make a PR as well ๐Ÿ˜„ https://github.com/cognitedata/cog-ai/pull/1709