-
Notifications
You must be signed in to change notification settings - Fork 327
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 helpful pre-commit checks and CI Documentation build step #229
Conversation
Also add codespell configuration to setup.cfg
a0aa864
to
79c6f58
Compare
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
=======================================
Coverage 93.46% 93.46%
=======================================
Files 34 34
Lines 3410 3410
=======================================
Hits 3187 3187
Misses 223 223
Continue to review full report at Codecov.
|
79c6f58
to
2384cf6
Compare
sphinx command has an implicit directory structure partially determined at command line, partially via conf.py. Because readthedocs injects their own code into conf.py, it allows the docs to be built correctly from the main directory, not within ./docs. But we can't just copy their conf.py and install their extension, or at least that brought new errors. So we have to cd into docs like plebs. If you find this in a git blame, please @me... this was a headache.
Solves #230, replacing sphinx_nbexamples with nbsphinx nbsphinx only works with notebooks in docs/, so copy examples/ to docs/examples when building docs. We lose the gallery, however. Edit examples/README.rst to allow links to work from github to github, but when docs built, links go from docs to docs.
64dd88a
to
8593a21
Compare
Okay sphinx build passes with no errors/warnings on my end. Doc build will automatically work for when notebooks are moved from the old format to the new one in #203. Only changes to notebooks were in fixing up header/section hierarchy: Since document header levels are determined at doc build time,
is equivalent to
The following is illegal, so I changed it in all the notebooks where it was giving a warning (again, warnings existed before - they were just ignored)
I'd also like to ask about the Youtube.ipynb notebook in docs/. It wasn't being built in RTD, but it was detected as present and therefore sphinx gave an error about unlinked source files. So I explicitly added it to Once I solve this in CI, this PR will be ready for review. |
Ready for review @akaptano @znicolaou. Summary of changes
Note that when converting notebooks to new format, we will need to change the links on README.rst InstructionsTo test out changes, run:
Then navigate to pysindy/docs/_build/html/index.html to view webpages. |
Taking a look at this now. During "python -m sphinx -TEW -b html -d _build/doctrees . _build/html" I get Traceback (most recent call last): so we could either nix this from conf.py or add a version variable to pysindy, but perhaps I'm misunderstanding |
That's odd, since the relevant lines were added by Markus a long time ago (and passes on my machine). Assuming github changed double underline to bold, the Not that this would explain why your module import doesn't have a If you're using vscode, the following debug configuration is what I use for the doc build: {
"name": "Documentation",
"type": "python",
"request": "launch",
"module": "sphinx.cmd.build",
"console": "integratedTerminal",
"justMyCode": false,
"cwd": "${workspaceFolder}/docs",
"args": [
"-TE",
"-b",
"html",
"-d",
"_build/doctrees",
".",
"_build/html"
]
}, |
I am using sphinx 5.1.1, Python 3.7, and the latest PySINDy main branch. Looks like I was missing some dependency in requirements-dev.txt so no longer getting that error. Now I get:sphinx.errors.SphinxWarning: Invalid configuration value found: 'language = None'. Update your configuration to a valid language code. Falling back to 'en' (English). Warning, treated as error: |
The docs build successfully in my repo, but I had to |
Hmm, that should've been fixed when I changed this line in conf.py from language = None to language = "en" It shouldn't need setting explicitly at the command line, but if you add
I added nbsphinx to the requirements-dev.txt, but nbsphinx requires pandoc, unfortunately. I assume readthedocs has that, but I'm not sure and I don't know how to make RTD do a test run on this branch. @akaptano is it possible to add me as a maintainer on the RTD account for pysindy? In the interim I will try building from this repo in a separate test RTD site. |
Verified passes on RTD |
@Jacob-Stevens-Haas Any idea why the linting failed here? Looks like the sphinx-listing is off |
@Jacob-Stevens-Haas Wondering if you don't mind taking a look at the sphinx linting on the main branch in the next week or two -- this has been broken since this merge but is not high priority. Hope you're doing well! |
Yeah definitely, I can take a look today. Sorry for going incommunicado for a couple weeks - general exam is this Thursday. |
Sorry it took so long - covid got me after my general. See #254 |
Add helpful pre-commit checks and CI Documentation build step
Fixes #218
... partially.I used pandas' list of pre-commits to find some helpful ones, including one checking for .rst issues. Doesn't detect the binder issue or bad docstrings, unfortunately - still looking.
Also added a documentation build step to CI. I think it would be helpful - current build has a lot of broken rst, resulting in multiple of each of the following issues:
Leaving as draft because I can't see if the CI step works until I create a PR