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-apidoc to create API reference #309
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d61ddf2
Add missing files to .gitignore
cjmayo cf9cce1
Remove duplicate open_in_browser from lxml.html.__all__
cjmayo cb0166d
Make ETreeXMLSchemaTestCase docstring Sphinx autodoc friendly
cjmayo f5151b1
Replace codespeak.net links in docstrings
cjmayo fed214e
Convert html/defs.py comment to be the module docstring
cjmayo e678695
Use sphinx-apidoc to create the API reference instead of epydoc
cjmayo e67e3eb
Include the elements from html.builder in the API reference
cjmayo 28bd579
Use Python 3.8 for coverage Travis job
cjmayo c7d1d5b
Build html documentation in Travis
cjmayo 092bc2c
Move "inplace" Makefile dependency only where it is needed, and actua…
scoder 61d135e
Make sure lxml gets imported from the source directory and not from a…
scoder e03219e
Remove work-around code.
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,58 @@ | ||
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')) | ||
scoder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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'] | ||
|
||
html_theme_options = { | ||
'collapse_navigation': False, | ||
'titles_only': True, | ||
} | ||
|
||
# -- Extension configuration ------------------------------------------------- | ||
|
||
autodoc_default_options = { | ||
'ignore-module-all': True, | ||
'private-members': True, | ||
} | ||
|
||
autodoc_member_order = 'groupwise' | ||
|
||
# -- 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,14 @@ | ||
lxml API Reference | ||
================== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
lxml | ||
|
||
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
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.
I think this is what needs the
inplace
lxml build as a dependency, not the other targets, right?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.
sphinx-apidoc
appears to only scan files, which is how I read:https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html
and the build inplace causes sphinx-apidoc to create duplicate entries
e.g.
Looks like excluding .so files avoids this, by adding "*.so":
That's a possibility but still needs a separate apidoc target to support apidf as well. I'm not sure if it gains anything?
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.
The duplication seems to be because there is a system copy of lxml installed. But without a system lxml, sphinx-apidoc appears to work without compiling lxml.