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

update pyright to 1.1.383 #1200

Merged

Conversation

Kallinteris-Andreas
Copy link
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Documentation only change (no code changed)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@pseudo-rnd-thoughts
Copy link
Member

pseudo-rnd-thoughts commented Oct 9, 2024

@Kallinteris-Andreas 213 errors, 6 warnings, 0 informations ooof and this is a most of the settings disabled.
I would consider moving to MyPY as it does better error checker for NumPy than PyRight

@Kallinteris-Andreas
Copy link
Collaborator Author

Kallinteris-Andreas commented Oct 9, 2024

Some of the errors are straight up wrong (unless I am crazy)

 /home/runner/work/Gymnasium/Gymnasium/gymnasium/envs/mujoco/reacher_v4.py
  /home/runner/work/Gymnasium/Gymnasium/gymnasium/envs/mujoco/reacher_v4.py:29:35 - error: Argument of type "dict[str, int]" cannot be assigned to parameter "default_camera_config" of type "Dict[str, float | int] | None" in function "__init__"
    Type "dict[str, int]" is not assignable to type "Dict[str, float | int] | None"
      "dict[str, int]" is not assignable to "Dict[str, float | int]"
        Type parameter "_VT@dict" is invariant, but "int" is not the same as "float | int"
        Consider switching from "dict" to "Mapping" which is covariant in the value type
      "dict[str, int]" is not assignable to "None" (reportArgumentType)

int should be assignable to float | int

I am not strictly opposed to moving to MyPY, but it likely requires all the other Farama projects to change to MyPy also

@Kallinteris-Andreas
Copy link
Collaborator Author

note: I have edited my previous message by adding a "not", misstyping sorry

@Kallinteris-Andreas
Copy link
Collaborator Author

Kallinteris-Andreas commented Oct 11, 2024

I have disabled reportAttributeAccessIssue, reportArgumentType as I think they create wrong issues

I have temporarily disabled the following, and marked them with TODO which can be fixed one at a time:
reportIndexIssue, reportReturnType, reportCallIssue, reportOperatorIssue, reportInvalidTypeForm, reportOptionalMemberAccess, reportRedeclaration, reportAssignmentType

#76 is immortal, you fix 1 issue 2 more shall take its place

@Kallinteris-Andreas Kallinteris-Andreas marked this pull request as ready for review October 11, 2024 18:27
@pseudo-rnd-thoughts
Copy link
Member

#76 is immortal, you fix 1 issue 2 more shall take its place

Totally, this is part of my motivation for moving to MyPY as PyRight has minimal support for NumPy which is the cause of 90% of our issues

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only worry with this update is that it doesn't actually fix any of the type problems, just hides them better.

An alternative approach is to use something like https://github.com/beartype/beartype which operates during testing to check that the types passed to functions match the exacted type. Quite cool imo

@Kallinteris-Andreas Kallinteris-Andreas merged commit b5ab287 into Farama-Foundation:main Oct 16, 2024
13 checks passed
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

Successfully merging this pull request may close these issues.

2 participants