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

Type Hint Issues: Pyright + Mypy #2192

Open
mikedh opened this issue Mar 25, 2024 · 2 comments
Open

Type Hint Issues: Pyright + Mypy #2192

mikedh opened this issue Mar 25, 2024 · 2 comments

Comments

@mikedh
Copy link
Owner

mikedh commented Mar 25, 2024

It would be a "nice to have" to someday pass pyright. We currently pass all unit tests using beartype or typeguard as of #2188 so type hints reflect the values passed in unit tests. I'd like to keep type hint stuff contained to this issue to avoid being overwhelmed, and any PR's fixing any of these are very welcome! Currently:

mikedh@orion:trimesh$ pyright trimesh
...
1120 errors, 3 warnings, 0 informations

If anyone is interested in contributing a great place to start would be fixing a single file, i.e.:

mikedh@orion:trimesh$ pyright trimesh/sample.py
/home/mikedh/trimesh/trimesh/sample.py
  /home/mikedh/trimesh/trimesh/sample.py:62:18 - error: No overloads for "cumsum" match the provided arguments (reportCallIssue)
  /home/mikedh/trimesh/trimesh/sample.py:62:28 - error: Argument of type "ArrayLike | Unknown | None" cannot be assigned to parameter "a" of type "ArrayLike" in function "cumsum" (reportArgumentType)
  /home/mikedh/trimesh/trimesh/sample.py:112:33 - error: "uv_vectors" is possibly unbound (reportPossiblyUnboundVariable)
  /home/mikedh/trimesh/trimesh/sample.py:113:45 - error: "uv_origins" is possibly unbound (reportPossiblyUnboundVariable)
  /home/mikedh/trimesh/trimesh/sample.py:211:5 - error: Expression with type "tuple[Unknown, Unknown, Unknown | None] | tuple[Unknown, Unknown]" cannot be assigned to target tuple
    Type "tuple[Unknown, Unknown, Unknown | None]" is incompatible with target tuple
      Tuple size mismatch; expected 2 but received 3 (reportAssignmentType)
5 errors, 0 warnings, 0 informations
@mikedh mikedh pinned this issue Mar 25, 2024
@wenbc21
Copy link

wenbc21 commented Aug 31, 2024

Hi mikedh! I'm interested in contributing to this issue.
May I ask if there is someone doing it? If not, I would like to try.
Thanks

@mikedh
Copy link
Owner Author

mikedh commented Sep 3, 2024

Hey @wenbc21 I've been tweaking the types when it affects me but there's no major effort on these. Beartype catches egregious violations in tests, but mypy/pylance would still need quite a bit of work. PR's would be great!

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

2 participants