Skip to content
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

Generate complete API docs using sphinx-apidoc #1330

Merged

Conversation

ltalirz
Copy link
Member

@ltalirz ltalirz commented Mar 23, 2018

Fix #1255

  • Autogenerate complete API documentation of aiida using sphinx-apidoc
  • removes QueryTool (deprecated in v0.8.0, import was anyhow broken)

This is a continuation of PR #1255

Let's see whether we can get this into aiida-core v0.11.3

ltalirz and others added 15 commits March 23, 2018 20:42
For reference, here is the regex I used:

```
cd source
for f in */dev.rst; do
   gsed -i -r -e 's/(\s+)(:members:)/\1\2\n\1:noindex:/g' $f
done
```

Note: gsed should be gnu sed (I used v4.4) which supports the -r option
(the sed shipped with recent MacOS versions won't do)

Down to 263 warnings.
Now down to 80 warnings that actually need to be looked into
down to 42 warnings
Only 3 warnings remain, two related to a broken import and one
because of an internal guard
Added running of sphinx-apidoc to Makefile.
Running apidoc.sh is equivalent to running

  make clean
  make all

The default target now makes both apidoc and html, i.e. the travis
scripts don't need to be changed.
make default target instead of html
(html does not build the apidoc automatically)
Unfortunately, sphinx-apidoc currently does not allow to adjust the
tocdepth of the subpackage tocs (sphinx-doc/sphinx#2108)
It was not being used and it had import errors
This file became obsolete when a general test loading system was
implemented way back for both backends
…compile the documentation - they don't make sense such checks anyway during the documentation compilation
QueryTool was deprecated in v0.8.0
(and was being imported also in sqlalchemy, where it didn't exist)
@ltalirz
Copy link
Member Author

ltalirz commented Mar 23, 2018

Copied from old PR:

What remains is to decide what to do with the old, manually generated API documentation.
Most of the sources/*/dev.rst files just contain a list of automodule/class/... statements for sub-selection of the code. In my view, these files are replaced adequately by the new api doc and should be deleted:

Delete:

  • cmdline/dev.rst
  • djsite/dev.rst
  • execmanager/dev.rst
  • parsers/dev.rst
  • scheduler/dev.rst
  • sqlalchemy/dev.rst
  • testing/dev.rst
  • tools/dev.rst
  • work/dev.rst
  • developer_guide/control/dev.rst
  • querying/querybuilder/dev.rst

Others contain either a bit of text as well or some ordered selection, which might contain some thought. In my view, these could be integrated in other parts of the documentation, if needed.

To Decide:

  • common/dev.rst : delete
  • orm/dev.rst : include in developer docs
  • registrytools/dev.rst: move to documentation of corresponding modules
  • transport/dev.rst : moved to developer docs
  • import_export/dbexporters/dev.rst : retain the note
  • import_export/dbimporters/dev.rst : delete

@giovannipizzi Do you agree with this assessment?

still remaining: sphinx does not want to make references to
protected methods (starting with _ and __)
issue with private methods not being referenced was actually a sphinx bug
sphinx-doc/sphinx#4091
Fixed in sphinx 1.6.6

Lots of nice new errors popping up :-)
sphinx-apidoc did not include private/special members.
back to 106 warnings ;-)
@ltalirz
Copy link
Member Author

ltalirz commented Mar 24, 2018

plus a few nitpicky warnings still to fix (total: 28)
2 nitpicky warnings remaining (will go away, when code
duplication is removed)

1 actual warning that I'm unable to figure out
this removes just documents that were incomplete lists of the
classes. next: try to merge docs that contain some more information
it's still far from ideal... too many "Subpackages" / "Submodules".
We could use something like this: https://github.com/goerz/better-apidoc
but perhaps we just wait until sphinx-apidoc finally gets a bit more
configurable.
also move resultmanager docs to working_with_aiida
@ltalirz
Copy link
Member Author

ltalirz commented Mar 26, 2018

@sphuber @giovannipizzi
From my point of view, this PR is now ready to be merged.

The apidoc is not yet entirely ideal in the sense that it's a little bit bloated by the page of every package first containing the "Package" and "Subpackage" modules.

sphinx-apidoc currently does not natively support modifying this appropriately.
One could do hacks like this or introduce additional dependencies.

Or we keep it as it is for the moment and make it better, once sphinx-apidoc makes it easy to do.

@ltalirz ltalirz changed the title [WIP] Generate complete API docs using sphinx-apidoc Generate complete API docs using sphinx-apidoc Mar 26, 2018
@giovannipizzi giovannipizzi merged commit 026a4fe into aiidateam:release_v0.11.3 Mar 27, 2018
@ltalirz ltalirz deleted the issue_1242_sphinx-apidoc_rebased branch April 12, 2018 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants