-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Fix pyright errors in envs and spaces folders #3061
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I just have two questions
5bd1a1c
to
752c527
Compare
@ldfrancis Hey, sorry I have been super busy with other stuff. could you fix the merge conflicts. I believe that #3072 will fix the mujoco issues that we were discussing and I have 1 comment to address |
assert self.car is not None | ||
if action is not None: | ||
if self.continuous: | ||
assert isinstance(action, np.ndarray) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry on the discussion on np.clip
I was talking about Car Racing not Lunar Lander, my mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no call to np.clip
in CarRacing. So passing a tensor would cause an error when the environment internals try to use the elements of the tensor. We can alleviate this by additionally calling action = np.array(action)
which ensures tensor conversion to numpy arrays.
Hence, as it is, the environment would not work with tensors, even without the assert that ensures actions are numpy arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove it for now
Could you resolve all of the discussion which are closed |
In 'step' method, discourage users from passing in None as action, and type ignore the use of None when calling 'step' in 'reset'
I'm slightly confused with how this PR works exactly. As far as I can tell, there are no changes to the pyproject.toml configuration, so there is no actual difference in which type checks now pass, correct? Since they weren't failing previously, and nothing new is enabled. Given that, I'm strongly opposed to each of the There is a few other changes that I can see between the ignores, some of them are reasonable, some are potentially problematic (e.g. casting any |
Closing in favor of Gymnasium https://github.com/Farama-Foundation/Gymnasium |
Description
This PR aims to fix the
pyright
type errors that currently go unnoticed since the check is disabled inpyproject.toml
The proposed method of approach to accomplish this is to start with the
gym
folder and all sub-folders within. Then proceed to thetests
folder. Once these errors are fixed, we then enable the check for type errors for the entire codebase.At the moment, type errors are fixed for the folders;
gym/envs
andgym/spaces
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)