-
-
Notifications
You must be signed in to change notification settings - Fork 952
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
Add docstring parser to remove duplicate in Gymnasium website #329
Add docstring parser to remove duplicate in Gymnasium website #329
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.
@mgoulao Could you confirm that this is a good idea?
Otherwise, looks good to merge
Why dont we remove the docstring under Example
|
@mgoulao As we have pydocstyle in pre-commit and this requires minimal changes to the code base + ide will still work as expected |
I'm just afraid that we are creating too much complexity and that might exist some edge cases that we are not seeing. |
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.
Generating the website locally, I don't see any issues with the implementation and I agree that it makes it easier to read.
If there is an issue we can revert this change for a future release.
I agree with the statement because it is kinda a hack, but I didn't find a better way to fix it without changing the current docstring format. This can be still discussed to change the format of the docstring (removing |
Description
As stated in #320, the documentation Gymnasium website contains duplicated content that can be confusing. Both the docstring from the
Class
and the__init__
are displayed, meaning there is often a sentence repeated twice.To keep the documentation the same, I just added a parser to the Sphinx
conf.py
to remove any lines that are written before aArgs
in the docstring.Example
Here the parser will remove the lines before
Args
, which are the whitespace andInitialize the :class:TransformReward wrapper with an environment and reward transform function :attr:f.
.Important
The parser targets every docstring that has the tag
class
, which are theClass
and__init__
ones. This means that if you place anArgs
section in theClass
docstring, the lines before it will be removed it too.I think only one class had this problem, but it should be noted as bad practice for the future.
Type of change
Please delete options that are not relevant.
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)