Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Pyright version update #2700

Closed
1 task done
kir0ul opened this issue Mar 16, 2022 · 7 comments
Closed
1 task done

[Bug Report] Pyright version update #2700

kir0ul opened this issue Mar 16, 2022 · 7 comments

Comments

@kir0ul
Copy link
Contributor

kir0ul commented Mar 16, 2022

If you are submitting a bug report, please fill in the following details and use the tag [bug].

Describe the bug
The Pyright version 1.1.204 defined in CI is kind of old, I'm not able to install it from Pip, and the last one 1.1.230 finds a bunch of error that the one we have doesn't.

Code example
Please try to provide a minimal example to reproduce the bug. Error messages and stack traces are also helpful.

❯ pip install "pyright==1.1.204"
ERROR: Could not find a version that satisfies the requirement pyright==1.1.204 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.13.post0, 1.1.224, 1.1.224.post0, 1.1.224.post1, 1.1.225, 1.1.226, 1.1.227, 1.1.228, 1.1.229, 1.1.230)
ERROR: No matching distribution found for pyright==1.1.204

System Info
Describe the characteristic of your environment:

  • What OS/version of Linux you're using: Ubuntu 18.04.6 LTS
  • Python version: 3.9.1

Checklist

  • I have checked that there is no similar issue in the repo (required)
@balisujohn
Copy link
Contributor

That's a node package version number not a pip package version. The CI pipeline uses this github action: https://github.com/jakebailey/pyright-action, which is set to use npm pyright package version 1.1.204 https://www.npmjs.com/package/pyright

@kir0ul
Copy link
Contributor Author

kir0ul commented Mar 16, 2022

Right, so now I have the same version as in CI but I'm still confused why I get 2 errors on a freshly pulled master branch, but I don't get any error in CI:

❯ pyright --version
pyright 1.1.204
./gym/spaces/box.py
  ./gym/spaces/box.py:66:30 - error: Operator "<" not supported for types "float" and "ndarray[Unknown, Unknown] | SupportsFloat"
    Operator "<" not supported for types "float" and "SupportsFloat" (reportGeneralTypeIssues)
  ./gym/spaces/box.py:68:30 - error: Operator ">" not supported for types "float" and "ndarray[Unknown, Unknown] | SupportsFloat"
    Operator ">" not supported for types "float" and "SupportsFloat" (reportGeneralTypeIssues)
2 errors, 0 warnings, 0 infos

@balisujohn
Copy link
Contributor

One thing to note is that https://github.com/jakebailey/pyright-action is being specifically parameterized to check python 3.7 in the CI which may not be the default rules for pyright, and may have different rules than when checking other python versions.

@jkterry1
Copy link
Collaborator

Could you please create a PR to bump things and fix this?

@ikamensh
Copy link
Contributor

Aside from fixing this at the moment, how about adding typing test to the latest supported python version in CI?

@gianlucadecola
Copy link
Contributor

gianlucadecola commented Apr 6, 2022

Which numpy version are you using?
The problem seems not to be directly related to python's version but to numpy's version. With numpy <= 1.21.5 pyright will fail. CI is using latest numpy which has more type annotation info (somewhat related: microsoft/pylance-release#150 (comment)).

The problem I'm seeing is that pyright is running with the flag --pythonversion=3.7 on python3.10 and latest numpy.
This will collide with the fact that numpy > 1.21.5 has a python version requirements >=3.8

EDIT:
With the latest numpy version you still need to run pyright as: pyright --pythonversion=3.7, otherwise it will fail. Running with pyright --pythonversion=3.10 will also trigger:

gym/envs/registration.py:690:41 - error: No parameter named "group" (reportGeneralTypeIssues)

@kir0ul
Copy link
Contributor Author

kir0ul commented Apr 7, 2022

I was using NumPy v1.21.4. With NumPy v1.22.3 and pyright --pythonversion=3.7, I don't get anymore errors 🎉

But with pyright --pythonversion=3.10, I still get the following 3 errors:

./gym/envs/registration.py
  ./gym/envs/registration.py:690:41 - error: No parameter named "group" (reportGeneralTypeIssues)
./gym/spaces/box.py
  ./gym/spaces/box.py:69:30 - error: Operator "<" not supported for types "float" and "NDArray[Any] | SupportsFloat | ndarray[Unknown, Unknown] | generic | bool | int | float | complex | str | bytes | memoryview"
    Operator "<" not supported for types "float" and "SupportsFloat"
    Operator "<" not supported for types "float" and "generic"
    Operator "<" not supported for types "float" and "complex"
    Operator "<" not supported for types "float" and "str"
    Operator "<" not supported for types "float" and "bytes"
    Operator "<" not supported for types "float" and "memoryview" (reportGeneralTypeIssues)
  ./gym/spaces/box.py:71:30 - error: Operator ">" not supported for types "float" and "NDArray[Any] | SupportsFloat | ndarray[Unknown, Unknown]"
    Operator ">" not supported for types "float" and "SupportsFloat" (reportGeneralTypeIssues)
3 errors, 0 warnings, 0 infos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants