You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, unlike epydoc which supported multiple markup languages including epytext and reStructuredText (but not MarkDown), pdoc currently only supports MarkDown: mitmproxy/pdoc#111
Switching all the docstrings from reStructuredText (and epydoc) to MarkDown (and pdoc) might not be as much work as it sounds, since most of the docstrings use minimal markup anyway.
Sphinx can do markdown, too. It doesn't look like pdoc is at the same level of project maturity as Sphinx or even epydoc.
Many years ago Ruan ported the LaTeX docs to rST in both English and Chinese, intended to be used with Sphinx. I remember another Biopython user in China set up and hosted Sphinx API docs in English and Chinese. These are out of date now, but the point is that we should really use Sphinx and rST to unify our documentation efforts and the community of potential contributors.
I agree pdoc isn't yet ready to replace epydoc although if mitmproxy/pdoc#111 was addressed to allow RST input it would be worth exploring.
As I noted on #907 (which overlaps with #906), it would be nice to use the same markup language on the docstrings (currently RST with epydoc), tutorial (currently LaTeX with hevea) and webpages (currently Markdown with GitHub Pages) - but it doesn't look possible right now.
sphinx-apidoc -e -F -o Doc/api/Bio Bio
# I was running Sphinx under Python 3, thus needed:
sed -i.bak "s/ python / python3 /g" Doc/api/Bio/Makefile
# Note Bio.Restriction breaks Sphinx, so skip it entirely!## Exception occurred:# File ".../site-packages/Bio/Restriction/Restriction.py", line 341, in __len__# return cls.size# AttributeError: type object 'RestrictionType' has no attribute 'size'#
rm -rf Doc/api/Bio/Bio.Restriction.*
make -C Doc/api/Bio/ html
open doc/api/Bio/_build/html/Bio.SeqRecord.html
Note there are quite a few warnings from Sphinx about section names etc.
Work in progress for automating building the API documentation using Sphinx, using our TravisCI/Tox setup (tested under Python 2.7):
[testenv:api]
# Note Sphinx likes to have the code installed so can import it
skip_install = False
whitelist_externals =
bash
sphinx-apidoc
make
deps =
mmtf-python
mysql-python
numpy
rdflib
reportlab
scipy
sphinx
commands =
bash -c \'python setup.py install > /dev/null\'
# Can't see a better way than running apidoc twice,
sphinx-apidoc -e -F -o /tmp/api/Bio Bio
sphinx-apidoc -e -F -o /tmp/api/BioSQL BioSQL
# Now merge RST files where we have a custom index.rst and conf.py
bash -c \'cp /tmp/api/BioSQL/BioSQL*.rst Doc/api/\'
bash -c \'cp /tmp/api/Bio/Bio*.rst Doc/api/\'
bash -c \'cp /tmp/api/Bio/Makefile Doc/api/\'
bash -c \'mkdir -p Doc/api/_templates Doc/api/_static Doc/api/_build\'
make -C Doc/api/ html
This branch also includes a conf.py file with Biopython meta-data filled in, plus a custom index.rst file in order to cover both the Bio and BioSQL top level namespaces:
.. Biopython API documentation master file, based on sphinx-quickstart This depends on having sphinx-apidoc run on both Bio and BioSQL to generate the per-module/package RST file referenced here.
Welcome to Biopython's API documentation!
=========================================
.. toctree::
:maxdepth:4:caption:Contents:BioBioSQL
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
There is still a lot to tinker with here, including things like private modules, special methods (especially __init__), but shows promise.
Again final URLs subject to change, we discussed including a language code like /en/ in the URL - probably before the version or /dev/ for latest version?
While the Sphinx version looks quite stylish, the Epydoc version is much easier to read and understand. One reason for this is related to style (size of main frame, font-size),
Style and font sizes are down to the Sphinx theme, currently the popular read-the-docs theme. We can look at changing that.
the other to the organization of the document, e.g. the summary tables for functions and variables, which are available in Epydoc.
tables of functions - I'm unsure if sphinx apidoc offers anything like this?
tables of variables - I'm not sure how to get Sphinx to include public variables in a module. That would be useful.
Another problem, also present in Epydoc, is that variables in function definitions are "filled" with the content, instead of just displaying the name. Epydoc does a little bit better job by abbreviating long list. E.g. compare:
That specific case would be fixed by #2213, and others like it could and perhaps should be tackled the same way. There is an open sphinx issue for this related problem:
Activity
[-]Modernising API and Tutorial Documentation[/-][+]Replacing epydoc for API documentation[/+]peterjc commentedon Aug 3, 2016
One possible replacement for epydoc is pdoc, https://github.com/BurntSushi/pdoc - see its self-generated documentation at http://pdoc.burntsushi.net/pdoc
However, unlike epydoc which supported multiple markup languages including epytext and reStructuredText (but not MarkDown), pdoc currently only supports MarkDown: mitmproxy/pdoc#111
Switching all the docstrings from reStructuredText (and epydoc) to MarkDown (and pdoc) might not be as much work as it sounds, since most of the docstrings use minimal markup anyway.
Switching to MarkDown would also have the benefit of matching the Biopython website source files https://github.com/biopython/biopython.github.io/tree/master/wiki (rendered using Jekyll using GitHub Pages).
peterjc commentedon Aug 15, 2016
Possibly useful blog post on using Sphinx and readthedocs: https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/
Source repository: https://github.com/SamStudio8/goldilocks
Output: http://goldilocks.readthedocs.io/en/latest/index.html
Note this combines RST documentation (see #907), e.g. http://goldilocks.readthedocs.io/en/latest/cli.html <--> https://github.com/SamStudio8/goldilocks/blob/master/docs/cli.rst
AND this uses the docstrings, e.g. http://goldilocks.readthedocs.io/en/latest/source/goldilocks.html <--> https://raw.githubusercontent.com/SamStudio8/goldilocks/master/docs/source/goldilocks.rst and https://github.com/SamStudio8/goldilocks/blob/master/goldilocks/goldilocks.py
I'm not keen on the "dummy"
*.rstfiles apparently created for every*.pyfile.etal commentedon Aug 15, 2016
Sphinx can do markdown, too. It doesn't look like pdoc is at the same level of project maturity as Sphinx or even epydoc.
Many years ago Ruan ported the LaTeX docs to rST in both English and Chinese, intended to be used with Sphinx. I remember another Biopython user in China set up and hosted Sphinx API docs in English and Chinese. These are out of date now, but the point is that we should really use Sphinx and rST to unify our documentation efforts and the community of potential contributors.
peterjc commentedon Aug 15, 2016
I agree pdoc isn't yet ready to replace epydoc although if mitmproxy/pdoc#111 was addressed to allow RST input it would be worth exploring.
As I noted on #907 (which overlaps with #906), it would be nice to use the same markup language on the docstrings (currently RST with epydoc), tutorial (currently LaTeX with hevea) and webpages (currently Markdown with GitHub Pages) - but it doesn't look possible right now.
peterjc commentedon Apr 25, 2017
Related to this, we should check our docstrings are valid RST, see e.g. feature request at PyCQA/pydocstyle#245
peterjc commentedon Sep 8, 2017
As a proof of principle, I hacked
pdocto support reStructuredText using docutils, mitmproxy/pdoc#137Run as follows, not sure if I can get it to do
BioandBioSQLat the same time:Sample output showing the
SeqRecordclass. Note the doctest snippets of Python code are not currently syntax coloured:Equivalent page from epydoc:
Unfortunately the author of
pdochas not been merging any contributions recently, and the project seems dormant.TODO: Example rendering of the docstrings using Sphinx.
peterjc commentedon Sep 11, 2017
Using Sphinx,
Note there are quite a few warnings from Sphinx about section names etc.
There are some things I don't like in the default API template, for example I find the division of the left hand column listing into sub-packages vs sub-modules unhelpful - the user should not care. Others have looked at this, https://stackoverflow.com/questions/29385564/customize-templates-for-sphinx-apidoc suggests https://github.com/goerz/better-apidoc
peterjc commentedon Sep 12, 2017
Work in progress for automating building the API documentation using Sphinx, using our TravisCI/Tox setup (tested under Python 2.7):
This branch also includes a
conf.pyfile with Biopython meta-data filled in, plus a customindex.rstfile in order to cover both theBioandBioSQLtop level namespaces:There is still a lot to tinker with here, including things like private modules, special methods (especially
__init__), but shows promise.peterjc commentedon Oct 10, 2017
I think I've got the special methods working nicely now on #1388 (subject to a feature request being merged in Sphinx itself).
peterjc commentedon Jun 14, 2019
Some of you will have noticed a new (currently almost empty) repository appeared, https://github.com/biopython/docs
The goal here is to extend the existing TravisCI job which turns our API documentation into RST and HTML using Sphinx autodoc, by deploying the files to https://github.com/biopython/docs using https://github.com/drdoctr/doctr
peterjc commentedon Jun 28, 2019
There is a proof of principle live right now, http://biopython.org/docs/dev/api/
Not so pretty initially, untill you drill down to a specific page, e.g. https://biopython.org/docs/dev/api/Bio.SeqRecord.html
Final URLs subject to change (I am thinking
.../dev/for the latest code, otherwise the version).peterjc commentedon Aug 14, 2019
As of 3c6a2c2 the Sphinx API documentation pages all have working "Edit on GitHub" links (which point at the associated Python files):
https://biopython.org/docs/dev/api/
Again final URLs subject to change, we discussed including a language code like
/en/in the URL - probably before the version or/dev/for latest version?peterjc commentedon Aug 14, 2019
Cross reference #2174 for the current deliberate exclusion of
Bio.Restriction.Restrictionfrom the Sphinx API documentation.peterjc commentedon Aug 14, 2019
Other points raised by @MarkusPiotrowski on #2172,
Style and font sizes are down to the Sphinx theme, currently the popular read-the-docs theme. We can look at changing that.
tables of functions - I'm unsure if sphinx apidoc offers anything like this?
tables of variables - I'm not sure how to get Sphinx to include public variables in a module. That would be useful.
It might be worth looking at https://github.com/astropy/sphinx-automodapi in place of the apidoc extension, as used for astropy: https://astropy.readthedocs.io/en/stable/utils/index.html
Solved that today by adding links to GitHub (see comment above).
Theme limitation, logged as readthedocs/sphinx_rtd_theme#777 - can probably be done now with theme template customisation.
That specific case would be fixed by #2213, and others like it could and perhaps should be tackled the same way. There is an open sphinx issue for this related problem:
sphinx-doc/sphinx#759
Logged as #2174
peterjc commentedon Jul 28, 2020
I think we can close this now.