-
Notifications
You must be signed in to change notification settings - Fork 32
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
Documentation process and tools #19
Comments
Sphinx appears to use reStructuredText as its markup language and Docutils to parse and generate documents. It appears there is a Markdown parser as well. I found Who needs pandoc when you have Sphinx? to be a useful description of what Sphinx adds to Docutils. |
Another approach is to use MkDocs to author and generate documents and then GitHub pages or Google Cloud to host the docs. https://github.com/scifabric/docs.pybossa.com is an example of this approach. https://github.com/squidfunk/mkdocs-material provides a material design theme for mkdocs documentation. |
NumPyNumPy’s Documentation has information on how NumPy does documentation, including numpydoc, their Sphinx extensions. PandasContributing to the documentation points to pandas docstring guide. They claim to use the PyData Sphinx Theme, also used by Bokeh and JupyterHub.
They also appear to be in the process of factoring out a Sphinx extension for documenting accessors that is now used by xarray as well: keewis/sphinx-autosummary-accessors. DaskContributing to Documentation:
Has its own Sphinx theme.
XarrayContributing to the documentation calls out the IPython Directive for putting code into docs.
ZarrDocumentation notes that all examples should pass as doctests.
|
Some other options
|
Sphinx is great, I think we'd want some compelling motivation to use anything else tbh. I don't have any real opinions in terms of themes and hosting. If it's at all feasible, I'd suggest using Markdown rather than RST though. Markdown is just so much more intuitive, and many more people know it. It's a real barrier to contributors asking them to learn RST when doing docs. But I haven't investigated how good Markdown support in sphinx is, so it might be a non-starter. |
Hail recently added documentation search using Algolia's DocSearch. RTD appears to have done some work on an In Doc Search UI, and there's a Sphinx extension for it, but I'm not sure that I've seen it in the wild. |
While that was my strong bias headed into this survey, I was surprised to find that most PyData ecosystem projects still use reStructuredText, so I think it may be worth asking some developers on those more mature projects why they haven't switched. |
I suppose https://github.com/pystatgen/sgkit/pull/9 is related to this discussion. |
I'd bet on one word: inertia. It's a whole pile of work to switch - I know that's why I haven't done it. |
FWIW I do prefer markdown over rst and did recently look at support for markdown in sphinx. Bottom line I think you can use markdown, but it wasn't obvious how to use many of the sphinx features within it, like all the sphinx directives. There's a relevant SO post here. |
Ah we were looking separately at MyST as a format for Jupyter notebook code reviews with mystify and MyST-NB. That may be our best bet to get Markdown syntax and Sphinx directives. Unfortunately, it's a bit bleeding edge:
On the other hand, the MyST-Markdown VS Code extension has 135 installs, so there is a reasonable user community. Looking into MyST a bit further, it appears to be primarily developed by two people, @choldgraf at Berkeley and @chrisjsewell at Imperial. If we decide to go forward with MyST, it might be a good idea to check in with them to be sure they plan to keep working on it for a while. |
MyST looks good. Btw for jupyter notebook code reviews we use reviewnb. |
We've hit some deficiencies with this product, unfortunately, so are searching for alternatives at the moment. |
Ah OK, would be interested to know what you missed and what alternatives you find. Pretty key tool in our analysis work, has been fine so far but have missed the ability to make line comments. |
I'd rather go with something that is proven to work well, even if it's a bit harder to get up to speed on (RST + Sphinx) than newer things that have gaps in areas we don't know if we need yet. |
@tomwhite as noted by Aaron Meurer on Twitter, once nice thing about MyST is that we don't need to commit entirely to it:
I also did not realize that MyST was only publicly announced on June 15! The comments on that tweet are useful. In particular, one user notes that MyST does not yet work for docstrings, and points to the napoleon docstring preprocessor and autodoc. executablebooks/MyST-Parser#164 has been filed to close the docstring loophole for MyST. It's also interesting to look at issues and PRs from projects that have moved to MyST already, e.g. poliastro/poliastro#977 and asmeurer/brown-water-python#2. While I'm generally in the "use boring technologies" camp, especially for things like documentation, I am also in the "don't make me learn another domain-specific language" camp, and would love to be able to write Markdown. Does it make sense to try to use MyST in one place first, perhaps in one of our IO repos? |
I was hoping we could avoid having separate documentation for each repo, and just have a single set of docs in one repo, so we can avoid the problem of knitting it all together. The IO docs will be fairly small, so putting them in the main repo shouldn't be too much of a stretch. |
Fair enough. Regardless of the location of the |
After some discussion on the 20200709 developer call, we've decided to write docs in ReST, not MyST, for now. We still have some decisions to make
I'll do a bit more research and write up my findings for discussion next week. |
Also be sure to run doctest in our CI. |
@jeromekelleher notes there are linters for docstrings too. |
https://github.com/jdillard/continuous-sphinx has some code for deploying Sphinx docs to Netlify, though they use Travis CI in place of GH Actions. |
I think we can close this issue with #51 going in. Let me know if y'all think otherwise. |
The Hitchhiker's Guide to Python suggests Sphinx to author documentation and Read the Docs to host it.
There have been some new developments in this domain recently, so let's evaluate our options before selecting a process and tools.
The text was updated successfully, but these errors were encountered: