diff --git a/README.rst b/README.rst index 2d0c264..07b32ea 100644 --- a/README.rst +++ b/README.rst @@ -21,11 +21,11 @@ Sphinx AutoAPI :target: https://github.com/python/black :alt: Formatted with Black -Sphinx AutoAPI provides "autodoc" style documentation for multiple programming languages +Sphinx AutoAPI is a Sphinx extension for generating complete API documentation without needing to load, run, or import the project being documented. In contrast to the traditional `Sphinx autodoc `_, -which is Python-only and uses code imports, +which requires manual authoring and uses code imports, AutoAPI finds and generates documentation by parsing source code. Language Support diff --git a/docs/_static/overrides.css b/docs/_static/overrides.css new file mode 100644 index 0000000..110e28c --- /dev/null +++ b/docs/_static/overrides.css @@ -0,0 +1,4 @@ +.sd-card-title { + margin-bottom: 1em; + text-align: center; +} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 167bac1..1ff2e84 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,291 +1,59 @@ -# -*- coding: utf-8 -*- +# Configuration file for the Sphinx documentation builder. # -# Sphinx AutoAPI documentation build configuration file, created by -# sphinx-quickstart on Wed Apr 22 15:38:18 2015. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['autoapi.extension', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon'] +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html -autoapi_type = 'python' -autoapi_dirs = ['../autoapi'] -autoapi_generate_api_docs = False - -intersphinx_mapping = { - 'jinja': ('https://jinja.palletsprojects.com/en/3.0.x/', None), - 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), - 'python': ('https://docs.python.org/3/', None), -} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +import re -# The encoding of source files. -#source_encoding = 'utf-8-sig' +from sphinx import addnodes +from sphinx.util.docfields import TypedField -# The master toctree document. -master_doc = 'index' +import autoapi -# General information about the project. -project = u'Sphinx AutoAPI' -copyright = u'2015, Read the Docs, Inc' -author = u'Read the Docs, Inc' +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -import autoapi -# The short X.Y version. +project = 'Sphinx AutoAPI' +copyright = '2023, Read the Docs' +author = 'Read the Docs' version = ".".join(str(x) for x in autoapi.__version_info__[:2]) -# The full version, including alpha/beta/rc tags. release = autoapi.__version__ -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = "en" - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build', 'changes/*.rst'] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'sphinx_rtd_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None +extensions = [ + 'autoapi.extension', + 'sphinx.ext.intersphinx', + 'sphinx.ext.napoleon', + 'sphinx_design', +] -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'changes/*.rst'] -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -# 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_theme = 'furo' html_static_path = ['_static'] +html_css_files = ['overrides.css'] -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -#html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'SphinxAutoAPIdoc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - #'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - #'pointsize': '10pt', +# -- Options for AutoAPI extension ------------------------------------------- +autoapi_type = 'python' +autoapi_dirs = ['../autoapi'] +autoapi_generate_api_docs = False - # Additional stuff for the LaTeX preamble. - #'preamble': '', +# -- Options for intersphinx extension --------------------------------------- - # Latex figure (float) alignment - #'figure_align': 'htbp', +intersphinx_mapping = { + 'jinja': ('https://jinja.palletsprojects.com/en/3.0.x/', None), + 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), + 'python': ('https://docs.python.org/3/', None), } -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'SphinxAutoAPI.tex', u'Sphinx AutoAPI Documentation', - u'Read the Docs, Inc', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'sphinxautoapi', u'Sphinx AutoAPI Documentation', - [author], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'SphinxAutoAPI', u'Sphinx AutoAPI Documentation', - author, 'SphinxAutoAPI', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - - -import re - -from sphinx import addnodes +# -- Enable confval and event roles ------------------------------------------ event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)') @@ -305,7 +73,6 @@ def parse_event(env, sig, signode): def setup(app): - from sphinx.util.docfields import TypedField app.add_object_type('confval', 'confval', objname='configuration value', indextemplate='pair: %s; configuration value') diff --git a/docs/how_to.rst b/docs/how_to.rst index a0da5a8..94f4101 100644 --- a/docs/how_to.rst +++ b/docs/how_to.rst @@ -1,6 +1,13 @@ How-to Guides ============= +These guides will take you through the steps to perform common actions +or solve common problems in AutoAPI. +They will assume that you already have a Sphinx project with AutoAPI +set up already. +If you don't know how to do this then read the :doc:`tutorials`. + + .. _customise-templates: How to Customise Layout Through Templates diff --git a/docs/index.rst b/docs/index.rst index 7c8c373..0b2d4cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,79 @@ Sphinx AutoAPI ============== +Sphinx AutoAPI is a Sphinx extension for generating complete API documentation +without needing to load, run, or import the project being documented. + +In contrast to the traditional `Sphinx autodoc `_, +which requires some manual authoring and uses code imports, +AutoAPI finds and generates documentation by parsing source code. + + +.. grid:: 2 + :gutter: 3 + + .. grid-item-card:: Beginner Guides + + New to AutoAPI? Check out the Tutorials. + They are a hands-on introduction for beginners. + + +++ + + .. button-ref:: tutorials + :expand: + :color: secondary + :click-parent: + + To the beginner guides + + .. grid-item-card:: User Guides + + The user guides are recipes for key tasks and common problems. + + +++ + + .. button-ref:: how_to + :expand: + :color: secondary + :click-parent: + + To the user guides + + .. grid-item-card:: Reference Guide + + The reference guide contains a detailed description of the + configuration options, directives, and templates included in AutoAPI. + + +++ + + .. button-ref:: reference/index + :expand: + :color: secondary + :click-parent: + + To the reference guide + + .. grid-item-card:: Contributor Guides + + Want to add to the codebase? + The contributing guidelines will guide you through the + process of improving AutoAPI. + + +++ + + .. button-ref:: maintenance/index + :expand: + :color: secondary + :click-parent: + + To the contributor guides + + + .. toctree:: - :maxdepth: 2 - :glob: + :hidden: - tutorials - how_to - reference/* - maintenance/* + tutorials + how_to + reference/index + maintenance/index diff --git a/docs/maintenance/index.rst b/docs/maintenance/index.rst new file mode 100644 index 0000000..53d042f --- /dev/null +++ b/docs/maintenance/index.rst @@ -0,0 +1,8 @@ +#################### +Contributor's Guides +#################### + +.. toctree:: + + design + release-process \ No newline at end of file diff --git a/docs/reference/index.rst b/docs/reference/index.rst new file mode 100644 index 0000000..60f2414 --- /dev/null +++ b/docs/reference/index.rst @@ -0,0 +1,13 @@ +############### +Reference Guide +############### + +The reference guide contains a detailed description of the +configuration options, directives, and templates included in AutoAPI. +To learn how to use AutoAPI, see the :doc:`tutorials`. + +.. toctree:: + + config + directives + templates \ No newline at end of file diff --git a/docs/tutorials.rst b/docs/tutorials.rst index 2aa4901..5e20637 100644 --- a/docs/tutorials.rst +++ b/docs/tutorials.rst @@ -1,13 +1,15 @@ Tutorials ========= -Setting up Automatic API Documentation Generation -------------------------------------------------- - -This tutorial will assume that you already have a basic Sphinx project set up. +These tutorials will guide you through how to start using AutoAPI. +They will assume that you already have a basic Sphinx project set up. If you are not sure how to do this, you can follow the :doc:`sphinx:usage/quickstart` guide in the Sphinx documentation. + +Setting up Automatic API Documentation Generation +------------------------------------------------- + The recommended way of installing AutoAPI is through a `virtualenv `_. Once you have a virtualenv set up, you can install AutoAPI with the command: @@ -25,11 +27,7 @@ Javascript ``pip install sphinx-autoapi`` Support for all languages other than Python will be removed in the next major version! Depending on which language you are trying to document, -each language has a different set of steps for finishing the setup of AutoAPI: - -.. contents:: - :local: - :backlinks: none +each language has a different set of steps for finishing the setup of AutoAPI. Python diff --git a/setup.cfg b/setup.cfg index f933f47..82ed887 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,8 +42,9 @@ install_requires = [options.extras_require] docs = + furo sphinx - sphinx_rtd_theme + sphinx_design go = sphinxcontrib-golangdomain dotnet = diff --git a/tox.ini b/tox.ini index d41fdfb..f7d1aa7 100644 --- a/tox.ini +++ b/tox.ini @@ -52,6 +52,7 @@ commands = [testenv:docs] extras = docs +deps = changedir = {toxinidir}/docs commands = sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html