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
Use Sphinx autodoc to create the API reference instead of Epydoc #308
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1617cd8
Add missing files to .gitignore
cjmayo c4e6a37
Use Sphinx autodoc to create the API reference instead of Epydoc
cjmayo 8f1498b
Remove duplicate open_in_browser from lxml.html.__all__
cjmayo ce6d1b8
Make ETreeXMLSchemaTestCase docstring Sphinx autodoc friendly
cjmayo b1095c6
Replace codespeak.net links in docstrings
cjmayo 21df98b
Ensure all modules have some documentation
cjmayo 358efda
Include private classes/methods in API documentation.
scoder fe7bb19
Include private members not included in __all__ in API documentation
cjmayo 7c8557e
Don't include tests in API documentation
cjmayo e3d1177
Build html documentation in Travis
cjmayo 37369e2
Revert src/lxml/pyclasslookup.py docstring
cjmayo 774af8b
Remove lxml.pyclasslookup from API documentation
cjmayo d9ad0e0
Merge branch 'master' into autodoc
scoder File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
html: | ||
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" -d "$(BUILDDIR)/doctrees" ../html/api $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath('../../src')) | ||
# For soupparser in lxml.html.ElementSoup module: | ||
sys.path.insert(1, os.path.abspath('../../src/lxml/html')) | ||
|
||
from lxml import __version__ as lxml_version | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'lxml' | ||
copyright = '2020, lxml dev team' | ||
author = 'lxml dev team' | ||
version = lxml_version | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.viewcode', | ||
'sphinx_rtd_theme', | ||
] | ||
|
||
language = 'en' | ||
|
||
exclude_patterns = ['_build'] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
html_theme = 'sphinx_rtd_theme' | ||
|
||
html_logo = '../html/python-xml.png' | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
#html_static_path = ['_static'] | ||
|
||
|
||
# -- Extension configuration ------------------------------------------------- | ||
|
||
autodoc_default_options = { | ||
'ignore-module-all': True, | ||
'private-members': True, | ||
} | ||
|
||
# -- Options for todo extension ---------------------------------------------- | ||
|
||
# If true, `todo` and `todoList` produce output, else they produce nothing. | ||
#todo_include_todos = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
lxml API Reference | ||
================== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
:caption: Contents: | ||
|
||
lxml | ||
lxml.html | ||
lxml.isoschematron | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
lxml.html | ||
================= | ||
|
||
lxml.html.ElementSoup module | ||
---------------------------- | ||
|
||
.. automodule:: lxml.html.ElementSoup | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.builder module | ||
------------------------ | ||
|
||
.. automodule:: lxml.html.builder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.clean module | ||
---------------------- | ||
|
||
.. automodule:: lxml.html.clean | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.defs module | ||
--------------------- | ||
|
||
.. automodule:: lxml.html.defs | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.diff module | ||
--------------------- | ||
|
||
.. automodule:: lxml.html.diff | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.formfill module | ||
------------------------- | ||
|
||
.. automodule:: lxml.html.formfill | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.html5parser module | ||
---------------------------- | ||
|
||
.. automodule:: lxml.html.html5parser | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.soupparser module | ||
--------------------------- | ||
|
||
.. automodule:: lxml.html.soupparser | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.html.usedoctest module | ||
--------------------------- | ||
|
||
.. module:: lxml.html.usedoctest | ||
|
||
Doctest module for HTML comparison. | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: lxml.html | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
lxml.isoschematron | ||
========================== | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: lxml.isoschematron | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
lxml | ||
============ | ||
|
||
lxml.ElementInclude module | ||
-------------------------- | ||
|
||
.. automodule:: lxml.ElementInclude | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.builder module | ||
------------------- | ||
|
||
.. automodule:: lxml.builder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.cssselect module | ||
--------------------- | ||
|
||
.. automodule:: lxml.cssselect | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.doctestcompare module | ||
-------------------------- | ||
|
||
.. automodule:: lxml.doctestcompare | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.etree module | ||
----------------- | ||
|
||
.. automodule:: lxml.etree | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.objectify module | ||
--------------------- | ||
|
||
.. automodule:: lxml.objectify | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.sax module | ||
--------------- | ||
|
||
.. automodule:: lxml.sax | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
lxml.usedoctest module | ||
---------------------- | ||
|
||
.. module:: lxml.usedoctest | ||
|
||
Doctest module for XML comparison. | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: lxml | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to generate these index files automatically? They seem trivial, and that's unlikely to change. But when new modules or packages are added, it's annoying to have to remember and add them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
sphinx-autogen
[1] which can generate module rst files based on one simple top-level rst. You have to have summaries, which maybe is OK, but I can't see how to get the summaries to include private classes like lxml.etree._Element.[1] https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it not take the default "autodoc" options into account?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the autodoc sections yes, but not in the autosummary tables
Classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is possible to use
sphinx-apidoc
every time and forget about the summaries, it does take quite a few options, including--private
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #309 using this approach.