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

[Feature Request] Enable type annotation checker #47

Open
1 of 2 tasks
XuehaiPan opened this issue Apr 20, 2023 · 0 comments
Open
1 of 2 tasks

[Feature Request] Enable type annotation checker #47

XuehaiPan opened this issue Apr 20, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@XuehaiPan
Copy link
Member

XuehaiPan commented Apr 20, 2023

Required prerequisites

Motivation

I found many wrong type annotations in the codebase after a quick glance.

https://github.com/OmniSafeAI/safety-gymnasium/blob/c1c598ea45f23535405f9941695800bae41d3a4a/safety_gymnasium/utils/random_generator.py#L170-L173

-def constrain_placement(self, placement: dict, keepout: float) -> tuple[float]:
+def constrain_placement(self, placement: list[float], keepout: float) -> tuple[float, float, float, float]:

Also, mypy reports:

-Found 129 errors in 13 files (checked 82 source files)

We should enable a CI workflow to check type annotations are correct.

Solution

Update type annotations and enable mypy in the CI workflow. And remove:

https://github.com/OmniSafeAI/safety-gymnasium/blob/c1c598ea45f23535405f9941695800bae41d3a4a/pyproject.toml#L150-L156

Alternatives

No response

Additional context

No response

@XuehaiPan XuehaiPan added enhancement New feature or request bug Something isn't working labels Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant