diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# 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) + +.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) diff --git a/docs/_static/.gitkeep b/docs/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/all.rst b/docs/all.rst new file mode 100644 index 0000000..80730ca --- /dev/null +++ b/docs/all.rst @@ -0,0 +1,11 @@ +.. _all the states/modules: + +Complete List of Proxmox modules +================================ + +.. toctree:: + :maxdepth: 2 + :glob: + + topics/index + ref/clouds/all diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..96dc481 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,162 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html +# -- Path setup -------------------------------------------------------------- +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import datetime +import os +import sys + +try: + from importlib_metadata import distribution +except ImportError: + from importlib.metadata import distribution + + +try: + docs_basepath = os.path.abspath(os.path.dirname(__file__)) +except NameError: + # sphinx-intl and six execute some code which will raise this NameError + # assume we're in the doc/ directory + docs_basepath = os.path.abspath(os.path.dirname(".")) + +addtl_paths = ( + os.path.join(os.pardir, "src"), # saltext.proxmox itself (for autodoc) + "_ext", # custom Sphinx extensions +) + +for addtl_path in addtl_paths: + sys.path.insert(0, os.path.abspath(os.path.join(docs_basepath, addtl_path))) + +dist = distribution("saltext.proxmox") + + +# -- Project information ----------------------------------------------------- +this_year = datetime.datetime.today().year +if this_year == 2021: + copyright_year = 2021 +else: + copyright_year = f"2021 - {this_year}" +project = dist.metadata["Summary"] +author = dist.metadata["Author"] +copyright = f"{copyright_year}, {author}" + +# The full version, including alpha/beta/rc tags +release = dist.version + + +# Variables to pass into the docs from sitevars.rst for rst substitution +with open("sitevars.rst") as site_vars_file: + site_vars = site_vars_file.read().splitlines() + +rst_prolog = """ +{} +""".format( + "\n".join(site_vars[:]) +) + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx_copybutton", + "sphinxcontrib.spelling", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [ + "_build", + "Thumbs.db", + ".DS_Store", + ".vscode", + ".venv", + ".git", + ".gitlab-ci", + ".gitignore", + "sitevars.rst", +] + +autosummary_generate = 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 = "furo" +html_title = project + +# 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"] + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +html_logo = "" + +# 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. Favicons can be up to at least 228x228. PNG +# format is supported as well, not just .ico' +html_favicon = "" + +# Sphinx Napoleon Config +napoleon_google_docstring = True +napoleon_numpy_docstring = False +napoleon_include_init_with_doc = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True + +# ----- Intersphinx Config ----------------------------------------------------------------------------------------> +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "pytest": ("https://pytest.readthedocs.io/en/stable", None), + "salt": ("https://docs.saltproject.io/en/latest", None), +} +# <---- Intersphinx Config ----------------------------------------------------------------------------------------- + +# ----- Autodoc Config ----------------------------------------------------------------------------------------------> +autodoc_default_options = {"member-order": "bysource"} +autodoc_mock_imports = ["salt"] +# <---- Autodoc Config ----------------------------------------------------------------------------------------------- + + +def setup(app): + app.add_crossref_type( + directivename="fixture", + rolename="fixture", + indextemplate="pair: %s; fixture", + ) + # Allow linking to pytest's confvals. + app.add_object_type( + "confval", + "pytest-confval", + objname="configuration value", + indextemplate="pair: %s; configuration value", + ) diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..70747ca --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,15 @@ +Welcome to Proxmox Salt Extension Documentation! +================================================ + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + all.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..922152e --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/ref/clouds/all.rst b/docs/ref/clouds/all.rst new file mode 100644 index 0000000..60374f9 --- /dev/null +++ b/docs/ref/clouds/all.rst @@ -0,0 +1,11 @@ + +.. all-saltext.proxmox.clouds: + +_____________ +Cloud Modules +_____________ + +.. autosummary:: + :toctree: + + saltext.proxmox.clouds.proxmox diff --git a/docs/ref/clouds/saltext.proxmox.clouds.proxmox.rst b/docs/ref/clouds/saltext.proxmox.clouds.proxmox.rst new file mode 100644 index 0000000..4489ab8 --- /dev/null +++ b/docs/ref/clouds/saltext.proxmox.clouds.proxmox.rst @@ -0,0 +1,15 @@ +saltext.proxmox.clouds.proxmox +============================== + +.. automodule:: saltext.proxmox.clouds.proxmox + + + + + + + + .. rubric:: Functions + + .. autosummary:: + diff --git a/docs/ref/modules.rst b/docs/ref/modules.rst deleted file mode 100644 index 6b3ef7a..0000000 --- a/docs/ref/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -saltext -======= - -.. toctree:: - :maxdepth: 4 - - saltext diff --git a/docs/ref/saltext.proxmox.clouds.rst b/docs/ref/saltext.proxmox.clouds.rst deleted file mode 100644 index a6d7081..0000000 --- a/docs/ref/saltext.proxmox.clouds.rst +++ /dev/null @@ -1,18 +0,0 @@ -saltext.proxmox.clouds package -============================== - -.. automodule:: saltext.proxmox.clouds - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -saltext.proxmox.clouds.proxmox module -------------------------------------- - -.. automodule:: saltext.proxmox.clouds.proxmox - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/ref/saltext.proxmox.rst b/docs/ref/saltext.proxmox.rst deleted file mode 100644 index c14b094..0000000 --- a/docs/ref/saltext.proxmox.rst +++ /dev/null @@ -1,34 +0,0 @@ -saltext.proxmox package -======================= - -.. automodule:: saltext.proxmox - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - saltext.proxmox.clouds - -Submodules ----------- - -saltext.proxmox.loader module ------------------------------ - -.. automodule:: saltext.proxmox.loader - :members: - :undoc-members: - :show-inheritance: - -saltext.proxmox.version module ------------------------------- - -.. automodule:: saltext.proxmox.version - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/ref/saltext.rst b/docs/ref/saltext.rst deleted file mode 100644 index b4165b3..0000000 --- a/docs/ref/saltext.rst +++ /dev/null @@ -1,12 +0,0 @@ -saltext namespace -================= - -.. py:module:: saltext - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - saltext.proxmox diff --git a/docs/sitevars.rst b/docs/sitevars.rst new file mode 100644 index 0000000..e69de29 diff --git a/docs/topics/index.rst b/docs/topics/index.rst new file mode 100644 index 0000000..20cc00c --- /dev/null +++ b/docs/topics/index.rst @@ -0,0 +1,8 @@ +====== +Topics +====== + +.. toctree:: + :maxdepth: 1 + :glob: +