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 basic CI to test documentation (using pytest-markdown-docs) #153
Conversation
…ly which I don't know how to fix)
(will fail now cause errors need to be fixed)
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.
LGTM, we must solve the issues in the documentation
I created this in the repo not a fork so you guys can edit the branch and fix the bugs |
Looks like these changes are correct to me but what’s weird now is the documentation test action took an hour then cancelled after your first change, then six hours and cancelled after the second. Maybe there’s training code that is in the docs but should be excluded from these tests? Like the torch data loader tutorial. |
I believe the default pytest ignore syntax works here so you can in line —ignore=docs/tutorials/myscript.py |
This error is still there: |
This errors out for me when I run it locally but I'm not seeing it in the CI, honestly not sure why the CI seems to be taking forever, maybe the move is to just fix these issues that have been found because of it but not actually put it in the CI unless the runtime can be made shorter (cause you definitely don't want a longer iteration time because of one test, seems like this bit runs for over an hour sometimes?) |
On my laptop (6 core i7 intel 2019 mbp 16 inch) it takes 5 minutes for reference |
I don't see it in my laptop as well; which version of gymnasium-robotics do you have? |
Ohhh it must be an old version, maybe you should require the latest version in the testing extra (I believe I did pip install -e .[testing] —u to upgrade but maybe not |
Oh you are right, the v4 was introduced with 1.2.3, but the dependency are requiring >=1.2.1; I fix this |
Btw I found this plugin which apparently supports shell commands as well as Python so maybe we could have it even test the stuff like CLI calling minari list datasets or whatever, also had a pr merged and new release on sept and has more stars than the other one, so maybe it’s better https://github.com/nschloe/pytest-codeblocks |
On my laptop (Apple M1) it takes more than 30 mins. Are you using Btw, it is failing exactly because bash codes are not run (needed for this tutorial: https://minari.farama.org/tutorials/using_datasets/behavioral_cloning/), so I think it is better to migrate to the library you suggested |
I don’t have too much time to mess around with that other library, if one of you guys wanted to that would probably be best (as I also don’t know which bash scripts etc are needed to execute) |
Thanks for handling this Omar, weird that it still errored out on docs/tutorials things even though it says exclude in the pyproject.toml |
I actually removed it before, to try using it inline, but apparently it didn't work. |
@elliottower can you check if my changes make sense to you? Thanks |
Can't approve cause it's my own PR but looks good to me |
Wait hold on it looks like every single test on here is done twice because of "push" and "pull request". Push should only be to the master branch once it is merged. I'll go check on that. |
Oh oops I created this PR from the main repo's branch not a fork, so it seems to not be running the CI now because I set it to only do the master branch, I'll try to fix that |
… to build/docs test
There we go now it only does 6 actions and doesn't duplicate it |
LGTM now, I made a separate PR as well just adding some additional pre-commit checks that I was going to put here (on the topic of making CI match gymnasium/pz) but didn't want to muddy things and change too many files with one PR. Edit: checked the duration of each test and the new docs test now slows down the iteration time from ~3-5 minutes to 11 minutes, I'm testing pytest-xdist because it should be able to roughly half the execution time using multiprocessing. Only added it to that test though as it's not necessary to run for everything. Edit 2: Looks like that didn't work because of some async h5py file opening stuff, guess it's probably fine to have 11 mins for the CI if it does actually check all the docs |
…ssing (11 minute CI, other CI takes ~3 mins max)
Found a small typo using master instead of main, and still having some stuff from pytest xdist, now I think the PR should be fully good (just reviewed it all) |
Looks like some flake8 issue? Not sure what that’s from |
I solved the flake8 issues and added the version to minigrid |
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] |
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.
Should we keep this for push on main? @elliottower
I noticed it because we don't have anymore build-publish on merged PRs
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.
Oh I guess gymnasium also does it for all prs I guess it’s just “can this be built” and only uploads if it’s a release. My bad about that, I don’t think it’ll be a huge deal but probably best to be consistent. Pettingzoo it was just for release but since this is much more based on gymnasium obviously we should inherit from there
Talked with Rodrigo a bit about this, figured I'd throw up a PR for it in case you guys want it. The plugin pytest-markdown-docs isn't the most fully featured library and can be somewhat slow if documentation gets very large, but does work out of the box pretty well. I added it to PettingZoo and it works well and has showed me a number of documentation issues.
It looks like there are two issues it detected currently:
ERROR docs/_scripts/gen_dataset_md.py - gymnasium.error.VersionNotFound: Environment version `v4` for environment `AntMaze_Large_Diverse_GR` doesn't exist. It provides versioned environments: [ `v3` ].
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue), Depends on # (pull request)
Type of change
Screenshots
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)pytest -v
and no errors are present.pytest -v
has generated that are related to my code to the best of my knowledge.