Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

turn on Sphinx warnings as errors #13544

Merged
merged 6 commits into from
Dec 18, 2018

Conversation

aaronmarkham
Copy link
Contributor

@aaronmarkham aaronmarkham commented Dec 5, 2018

Description

This PR updates the website build trigger sphinx-build with the -W switch. This turns on the "warnings as errors" feature in Sphinx.

edit: This needs to be considered carefully as it may impact several people as they get used to the change. Also, the website build process exempts the old versions as they are still error-riddled.
Are there any other exemptions needed before proceeding with this PR?

What This Means

Once merged, anyone that submits a PR that breaks the docs - particularly the Python docs - their PR will fail CI.

If you create a C operator that has docs strings that bubble up into the Python docs and break there, your PR will fail CI.

Testing Your Code Prior to a PR

But let's not fail in CI all of the time. You can test it out first.

  1. Turn off the doc sets you don't need to test in docs/settings.ini. Most of the time you just need to update the [document_sets_default] section. I tend to turn everything off for faster cycles on testing the build, then turn everything back on for a final test if my change messed with something that might trigger a Doxygen issue (C or C++ change) or Scala/Java docs issue (.scala or .java change).
  2. Run make html USE_OPENMP=1 SPHINXOPTS=-W from the docs folder. (or make docs with the same parameters from mxnet root)
    If it fails, read the error and fix it. Once you get a successful build, you're ready to submit your PR.

For documentation help, check out the documentation guide.
For details on building the website, check out how to build the website

Testing & CI Deployment

I tested this with ./build_all_version.sh "v1.4.x;master" "1.4.0;master". The script will run the older version branch (that still has docs errors in it) and then runs master. Since the script only enables -W for master, it will show the warnings, but not stop the build when building the v1.4.x branch. When it eventually works on master, the -W flag is enabled, and if there are any Sphinx warnings it stops the build with an error.

Currently the Jenkins job for the website deployment builds master first. I could switch that to last, but actually, I think it is better that the job fails quickly if it is going to fail.

If you have questions, please ask!

@aaronmarkham aaronmarkham requested a review from szha as a code owner December 5, 2018 02:49
@aaronmarkham
Copy link
Contributor Author

aaronmarkham commented Dec 5, 2018

@mli @anirudhacharya @lupesko @marcoabreu @larroy @sergeykolychev @lebeg - Please review. Not sure if this is the best time to do this, but we've shored up the current bugs in the docs, so if this goes through we can keep the Python API docs/website from breaking.

@aaronmarkham aaronmarkham changed the title turn on Sphinx warnings as errors [WIP] turn on Sphinx warnings as errors Dec 5, 2018
@aaronmarkham aaronmarkham changed the title [WIP] turn on Sphinx warnings as errors turn on Sphinx warnings as errors Dec 6, 2018
@aaronmarkham
Copy link
Contributor Author

This is time sensitive. As it ages, we'll have another round of cleaning up bugs that are introduced to get a clean start.

@@ -117,6 +120,8 @@ function checkout () {
git checkout "$repo_folder" || git branch $repo_folder "upstream/$repo_folder" && git checkout "$repo_folder" || exit 1
if [ $tag == 'master' ]; then
git pull
# master gets warnings as errors for Sphinx builds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we enable this in general? Otherwise a release branch might run into problems.

Also, is this script executed as part of the pr pipeline? We want to fail PRs ideally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the -W option to the new docs pipeline. This should force it to happen any time that runs. And the website build flow will still skip it for old versions. I'm not totally familiar with new pipelines, so please let me know if you think this is going to be an issue or not.

@anirudhacharya
Copy link
Member

At what stage in the CI is this check performed? Can you please point to the logs where we can check and confirm?

@aaronmarkham
Copy link
Contributor Author

At what stage in the CI is this check performed? Can you please point to the logs where we can check and confirm?

I just added it to the website pipeline in the deploy_docs() function. Look for the following test in a PR, and that's where the errors will pop up.
2018-12-05_21-27-35

I see that the website validation job has a child 1.4.x job in addition to master. I imagine that will break if it also runs the deploy_docs() function, because many bugs that we've recently fixed in master have not been ported over to that branch.

@aaronmarkham
Copy link
Contributor Author

It failed on the website pipeline. So, yay?
The failure is on a docs bug we already fixed here:
https://github.com/apache/incubator-mxnet/pull/13539/files#diff-631586dbe3b11092920c7268fdc499fc
Looks like I need a rebase and to try again. Actually a good test, assuming it passes after this.

@aaronmarkham
Copy link
Contributor Author

aaronmarkham commented Dec 6, 2018

Well that was a bit baffling... I rebased and the bug fixes were gone. Looks like this commit for 1.4.x reverted at least one of the changes in master, including the docs bug fixes. I think that commit should be reverted/fixed as that was probably not the intention.

@srochel - please take a look. docs/api/python/symbol/contrib.md shouldn't be in there. I also see some mkldnn stuff in there that isn't really a version bump.

@TaoLv
Copy link
Member

TaoLv commented Dec 6, 2018

@aaronmarkham I have submitted a PR to revert #13478 and am waiting for the CI finishing.

@aaronmarkham aaronmarkham added the pr-awaiting-review PR is waiting for code review label Dec 6, 2018
@nswamy nswamy added pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress labels Dec 7, 2018
@aaronmarkham
Copy link
Contributor Author

After patching the docs errors that came in from another PR, this PR passed fine.
I also tested another run through the CI and it passed fine.

I'll keep this open for a bit and rebase and catch some bugs, refer them back to their authors to help ease this in. Then around the 15th, we can go for merge? Sound good?

In the meantime, everyone doing docs/website updates, please use make html USE_OPENMP=1 SPHINXOPTS=-W to build the docs to catch the errors as this PR will.

Copy link
Contributor

@larroy larroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea to fail CI if the docs break, so I support this PR but I'm not very familiar with the doc generation or the problems that were fixed, so probably best to have somebody else's opinion.

I didn't understand the story about let's not fail CI. CI is there to fail if something is broken. If you want to add a local test before sending to CI I suggest to add it to the dev_menu.py. Adding more commands / instructions and manual steps is something we should avoid since everything is complex enough and we should lower barrier to entry and contributions.

LGTM

@aaronmarkham
Copy link
Contributor Author

@larroy:
The CI output is pretty clear and it will tell the contributor what broke in the docs. When there's only your error, it's not so bad. When it piles up to thousands of errors from every other PR that made it through without checking docs, then that's hard.
This has been sitting around for a week, so I can imagine one or two docs error have slipped in. I'm going to rebase it and clean up whatever might have slipped in. Then it should be good to go for merging.
Adding a menu item to the dev_menu.py script to check for docs errors is a great idea. It makes it easy for people to test locally before sending a PR through CI.

@aaronmarkham aaronmarkham merged commit 67a9a81 into apache:master Dec 18, 2018
mseth10 pushed a commit to mseth10/incubator-mxnet that referenced this pull request Dec 18, 2018
* turn on warnings as errors

* move warnings as error logic to build_all_version

* fix typo in comment

* add warning as error option for docs pipeline

* bump ci to test again; use this chance to add notes on this feature

* fix bugs in image.py docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Build Doc pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants