You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a note that I've adopted a specific format for # type: ignore comments when they are caused by issues in upstream packages such as pyglet. In these cases, the proper fix should happen in the upstream library, not in arcade.
However, waiting for the upstream fix to be implemented, merged, and published to pypi would take too long. In the interim, arcade's CI would fail with errors. Even if we chose to ignore the errors, they would confuse beginners and obscure more meaningful errors.
In these situations, I suppress the errors with a comment of the form:
This oddly-specific syntax is compatible with both mypy and pyright. Even if arcade uses pyright, it's nice to be compatible with down-stream users who may choose mypy. Mypy, for example, logs an error for # type: ignore pending but it is happy if we add that extra #.
This comment clearly links to a description of the underlying issue. It has zero changes to arcade's python syntax -- is guaranteed not to affect runtime behavior -- so hopefully it's non-controversial. When the upstream issue is fixed, we can remove the comment.
This issue serves as documentation of this convention. If appropriate, we can add it to the programming guide and close this issue.
The text was updated successfully, but these errors were encountered:
cspotcode
changed the title
Revisit # type: ignore pending ... comments
Revisit # type: ignore # pending ... comments
May 18, 2023
I tweaked the formatting of the above after learning that mypy is touchy about the formatting of these comments. pyright espouses # type: ignore -- actual comment but is happy with mypy's format, # type: ignore # actual commetn
This is a note that I've adopted a specific format for
# type: ignore
comments when they are caused by issues in upstream packages such as pyglet. In these cases, the proper fix should happen in the upstream library, not in arcade.However, waiting for the upstream fix to be implemented, merged, and published to pypi would take too long. In the interim, arcade's CI would fail with errors. Even if we chose to ignore the errors, they would confuse beginners and obscure more meaningful errors.
In these situations, I suppress the errors with a comment of the form:
This oddly-specific syntax is compatible with both mypy and pyright. Even if arcade uses pyright, it's nice to be compatible with down-stream users who may choose mypy. Mypy, for example, logs an error for
# type: ignore pending
but it is happy if we add that extra#
.This comment clearly links to a description of the underlying issue. It has zero changes to arcade's python syntax -- is guaranteed not to affect runtime behavior -- so hopefully it's non-controversial. When the upstream issue is fixed, we can remove the comment.
This issue serves as documentation of this convention. If appropriate, we can add it to the programming guide and close this issue.
The text was updated successfully, but these errors were encountered: