Skip to content

New Sphinx Setup for Director #83

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions docs/ARCHITECTURE.md

This file was deleted.

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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 = source
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)
11 changes: 0 additions & 11 deletions docs/SETUP.md

This file was deleted.

15 changes: 0 additions & 15 deletions docs/TROUBLESHOOTING.md

This file was deleted.

16 changes: 0 additions & 16 deletions docs/docker-swarm.md

This file was deleted.

35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%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.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
4 changes: 4 additions & 0 deletions docs/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx
sphinx-copybutton
myst_parser
furo
34 changes: 34 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ name | escape | underline}}

Qualified name: ``{{ fullname }}``

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:show-inheritance:
:members:
:private-members:


{% block methods %}
{%- if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods if item != '__init__' and item[0] != '_' and item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endfor %}
{%- endif %}
{%- endblock %}

{% block attributes %}
{%- if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes if item[0] != '_' and item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endfor %}
{%- endif %}
{% endblock %}
52 changes: 52 additions & 0 deletions docs/source/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{ name | escape | underline }}

.. currentmodule:: {{ fullname }}

.. automodule:: {{ fullname }}

{% block classes %}
{% if classes %}
.. rubric:: Classes

.. autosummary::
:toctree: .
:nosignatures:
{% for class in classes %}
{{ class }}
{% endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

{% for item in functions %}
.. autofunction:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
148 changes: 148 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import sys
from datetime import datetime
from pathlib import Path


# -- 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.


BASE_ROOT = Path(__file__).parent.parent.resolve()
major_paths = (
os.fspath(BASE_ROOT / proj)
for proj in (
"manager",
"orchestrator",
"router",
"shell",
)
)
sys.path = [*major_paths, *sys.path]

# -- Project information -----------------------------------------------------

project = "Director4"
copyright = f"2020-{datetime.now().year}, Sysadmins at TJ CSL"
author = "Sysadmins at TJ CSL"

# TODO: enable sphinxcontrib_django after all dependencies are merged into one Pipfile
# django_settings = "director.settings"


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"myst_parser",
# "sphinxcontrib_django"
]

add_function_parentheses = False

# Automatically generate stub pages when using the .. autosummary directive
autosummary_generate = True

# controls whether functions documented by the autofunction directive
# appear with their full module names
add_module_names = False

# napoleon settings
napoleon_numpy_docstring = False # force google
napoleon_include_special_with_doc = False

napoleon_custom_sections = [
("Special", "params_style"),
]

templates_path = ["_templates"]
exclude_patterns = []

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
"django": (
"https://docs.djangoproject.com/en/stable/",
"https://docs.djangoproject.com/en/stable/_objects/",
),
}

extlinks = {
"issue": ("https://github.com/tjcsl/director4/issues/%s", "issue %s"),
"pr": ("https://github.com/tjcsl/director4/pull/%s", "pr #%s"),
}
# warn hardcoded links
extlinks_detect_hardcoded_links = True

# -- 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"

# use |br| for linebreak
rst_prolog = """
.. |br| raw:: html

<br/>
"""

# 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 = {
"source_repository": "https://github.com/tjcsl/director4/",
"source_branch": "main",
"source_directory": "docs/source/",
"light_logo": "logo-full-black.svg",
"dark_logo": "logo-full-white.svg",
"sidebar_hide_name": True,
"light_css_variables": {
"color-content-foreground": "#000000",
"color-background-primary": "#ffffff",
"color-background-border": "#ffffff",
"color-sidebar-background": "#f8f9fb",
"color-brand-content": "#1c00e3",
"color-brand-primary": "#192bd0",
"color-link": "#c93434",
"color-link--hover": "#5b0000",
"color-inline-code-background": "#f6f6f6;",
"color-foreground-secondary": "#000",
},
"dark_css_variables": {
"color-content-foreground": "#ffffffd9",
"color-background-primary": "#131416",
"color-background-border": "#303335",
"color-sidebar-background": "#1a1c1e",
"color-brand-content": "#2196f3",
"color-brand-primary": "#007fff",
"color-link": "#51ba86",
"color-link--hover": "#9cefc6",
"color-inline-code-background": "#262626",
"color-foreground-secondary": "#ffffffd9",
},
}
html_title = "Director4"

# This specifies any additional css files that will override the theme's
html_css_files = []
13 changes: 13 additions & 0 deletions docs/source/dev.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##########
Developing
##########

A collection of reference documents for developers.

.. toctree::
:maxdepth: 1

dev/umask
dev/deploying
dev/docker-image-registry
dev/troubleshooting
Loading
Loading