Skip to content
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

Clean sphinx config #3491

Merged
merged 3 commits into from
Mar 31, 2022
Merged
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
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ ci:
- pip-compile
default_language_version:
python: python3.8
exclude: |
(?x)(
^docs/conf.py$
)
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
# keep it before yamllint
Expand Down
87 changes: 34 additions & 53 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import molecule


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -37,18 +36,18 @@
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
templates_path = [".templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = "Molecule"
copyright = " %s, Red Hat Inc." % datetime.date.today().year
author = "AUTHORS.rst"
author = "Red Hat Inc"
copyright = f" {datetime.date.today().year}, {author}"

github_url = "https://github.com"
github_repo_org = "ansible"
Expand Down Expand Up @@ -83,7 +82,7 @@
# 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'
today_fmt = "%B %d, %Y"

# List of documents that shouldn't be included in the build.
# unused_docs = []
Expand Down Expand Up @@ -113,9 +112,9 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'ansible'
pygments_style = "ansible"

highlight_language = 'YAML+Jinja'
highlight_language = "YAML+Jinja"

# Substitutions, variables, entities, & shortcuts for text which do not need to link to anything.
# For titles which should be a link, use the intersphinx anchors set at the index, chapter, and section levels, such as qi_start_:
Expand All @@ -133,7 +132,7 @@
# Options for HTML output
# -----------------------

html_theme = 'sphinx_ansible_theme'
html_theme = "sphinx_ansible_theme"

html_show_sphinx = False
html_favicon = "_static/images/favicon.ico"
Expand All @@ -144,26 +143,26 @@
"style_nav_header_background": "#5bbdbf",
"style_external_links": True,
# 'canonical_url': "https://docs.ansible.com/ansible/latest/",
'vcs_pageview_mode': 'edit',
"vcs_pageview_mode": "edit",
"navigation_depth": 3,
'topbar_links': {
'AnsibleFest': 'https://www.ansible.com/ansiblefest',
'Products': 'https://www.ansible.com/tower',
'Community': 'https://www.ansible.com/community',
'Webinars & Training': 'https://www.ansible.com/webinars-training',
'Blog': 'https://www.ansible.com/blog',
"topbar_links": {
"AnsibleFest": "https://www.ansible.com/ansiblefest",
"Products": "https://www.ansible.com/tower",
"Community": "https://www.ansible.com/community",
"Webinars & Training": "https://www.ansible.com/webinars-training",
"Blog": "https://www.ansible.com/blog",
},
}

html_context = {
'display_github': 'True',
'github_user': 'ansible-community',
'github_repo': 'molecule',
'github_version': 'main/docs/',
'current_version': version,
'latest_version': 'latest',
"display_github": "True",
"github_user": "ansible-community",
"github_repo": "molecule",
"github_version": "main/docs/",
"current_version": version,
"latest_version": "latest",
# list specifically out of order to make latest work
'available_versions': ('latest', ),
"available_versions": ("latest",),
}

# Add extra CSS styles to the resulting HTML pages
Expand All @@ -173,10 +172,10 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = f'{project} Documentation'
html_title = f"{project} Documentation"

# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = 'Documentation'
html_short_title = "Documentation"

# The name of an image file (within the static path) to place at the top of
# the sidebar.
Expand All @@ -191,11 +190,11 @@
# 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_static_path = ["_static"]

# 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'
html_last_updated_fmt = "%b %d, %Y"

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
Expand Down Expand Up @@ -229,7 +228,7 @@
# html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'Poseidodoc'
htmlhelp_basename = "Poseidodoc"

# Configuration for sphinx-notfound-pages
# with no 'notfound_template' and no 'notfound_context' set,
Expand Down Expand Up @@ -257,9 +256,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class
# [howto/manual]).
latex_documents = [
(master_doc, "Molecule.tex", "Molecule Documentation", "AUTHORS.rst", "manual")
]
latex_documents = [(master_doc, "Molecule.tex", "Molecule Documentation", "manual")]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
Expand All @@ -278,33 +275,17 @@
# If false, no module index is generated.
# latex_use_modindex = True

autoclass_content = 'both'
autoclass_content = "both"

# Note: Our strategy for intersphinx mappings is to have the upstream build location as the
# canonical source and then cached copies of the mapping stored locally in case someone is building
# when disconnected from the internet. We then have a script to update the cached copies.
#
# Because of that, each entry in this mapping should have this format:
# name: ('http://UPSTREAM_URL', (None, 'path/to/local/cache.inv'))
#
# The update script depends on this format so deviating from this (for instance, adding a third
# location for the mappning to live) will confuse it.
intersphinx_mapping = {'python': ('https://docs.python.org/2/', (None, '../python2.inv')),
'python3': ('https://docs.python.org/3/', (None, '../python3.inv')),
'jinja2': ('http://jinja.palletsprojects.com/', (None, '../jinja2.inv')),
'ansible_2_9': ('https://docs.ansible.com/ansible/2.9/', (None, '../ansible_2_9.inv')),
'ansible_2_8': ('https://docs.ansible.com/ansible/2.8/', (None, '../ansible_2_8.inv')),
'ansible_2_7': ('https://docs.ansible.com/ansible/2.7/', (None, '../ansible_2_7.inv')),
'ansible_2_6': ('https://docs.ansible.com/ansible/2.6/', (None, '../ansible_2_6.inv')),
'ansible_2_5': ('https://docs.ansible.com/ansible/2.5/', (None, '../ansible_2_5.inv')),
intersphinx_mapping = {
"ansible": ("https://docs.ansible.com/ansible/latest/", None),
"jinja2": ("https://jinja.palletsprojects.com/", None),
"pip": ("https://pip.pypa.io/en/latest/", None),
"python": ("https://docs.python.org/3", None),
"python2": ("https://docs.python.org/2", None),
"testinfra": ("https://testinfra.readthedocs.io/en/latest/", None),
"yamllint": ("http://yamllint.readthedocs.io/en/latest/", None),
"virtualenv": ("https://virtualenv.pypa.io/en/latest/", None),
}
"yamllint": ("https://yamllint.readthedocs.io/en/latest/", None),
}

linkcheck_workers = 25
# linkcheck_anchors = False