From e483762015d94b2450379737f099c36e7c3647a0 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 5 Jun 2023 17:39:11 +0200 Subject: Update RtD and Sphinx configuration (#38046) --- .github/dependabot.yml | 5 +++++ .readthedocs.yml | 8 +++++++- lib/spack/docs/_pygments/style.py | 16 ++++++++++++++++ lib/spack/docs/conf.py | 34 +++++----------------------------- lib/spack/docs/requirements.txt | 21 ++++++++------------- 5 files changed, 41 insertions(+), 43 deletions(-) create mode 100644 lib/spack/docs/_pygments/style.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2c7d170839..13572e9542 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,8 @@ updates: directory: "/" schedule: interval: "daily" + # Requirements to build documentation + - package-ecosystem: "pip" + directory: "/lib/spack/docs" + schedule: + interval: "daily" diff --git a/.readthedocs.yml b/.readthedocs.yml index cdb97bfad7..ff47753613 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,10 +1,16 @@ version: 2 +build: + os: "ubuntu-22.04" + apt_packages: + - graphviz + tools: + python: "3.11" + sphinx: configuration: lib/spack/docs/conf.py fail_on_warning: true python: - version: 3.7 install: - requirements: lib/spack/docs/requirements.txt diff --git a/lib/spack/docs/_pygments/style.py b/lib/spack/docs/_pygments/style.py new file mode 100644 index 0000000000..0d7c386463 --- /dev/null +++ b/lib/spack/docs/_pygments/style.py @@ -0,0 +1,16 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# The name of the Pygments (syntax highlighting) style to use. +# We use our own extension of the default style with a few modifications +from pygments.styles.default import DefaultStyle +from pygments.token import Generic + + +class SpackStyle(DefaultStyle): + styles = DefaultStyle.styles.copy() + background_color = "#f4f4f8" + styles[Generic.Output] = "#355" + styles[Generic.Prompt] = "bold #346ec9" diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 8ba6717147..841ed53868 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -149,7 +149,6 @@ graphviz_dot_args = [ # Get nice vector graphics graphviz_output_format = "svg" - # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -233,30 +232,8 @@ nitpick_ignore = [ # 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. -# We use our own extension of the default style with a few modifications -from pygments.style import Style -from pygments.styles.default import DefaultStyle -from pygments.token import Comment, Generic, Text - - -class SpackStyle(DefaultStyle): - styles = DefaultStyle.styles.copy() - background_color = "#f4f4f8" - styles[Generic.Output] = "#355" - styles[Generic.Prompt] = "bold #346ec9" - - -import pkg_resources - -dist = pkg_resources.Distribution(__file__) -sys.path.append(".") # make 'conf' module findable -ep = pkg_resources.EntryPoint.parse("spack = conf:SpackStyle", dist=dist) -dist._ep_map = {"pygments.styles": {"plugin1": ep}} -pkg_resources.working_set.add(dist) - -pygments_style = "spack" +sys.path.append("./_pygments") +pygments_style = "style.SpackStyle" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -341,16 +318,15 @@ html_last_updated_fmt = "%b %d, %Y" # Output file base name for HTML help builder. htmlhelp_basename = "Spackdoc" - # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). - #'papersize': 'letterpaper', + # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). - #'pointsize': '10pt', + # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. - #'preamble': '', + # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples diff --git a/lib/spack/docs/requirements.txt b/lib/spack/docs/requirements.txt index 648f3c40b5..9a2892080d 100644 --- a/lib/spack/docs/requirements.txt +++ b/lib/spack/docs/requirements.txt @@ -1,13 +1,8 @@ -# These dependencies should be installed using pip in order -# to build the documentation. - -sphinx>=3.4,!=4.1.2,!=5.1.0 -sphinxcontrib-programoutput -sphinx-design -sphinx-rtd-theme -python-levenshtein -# Restrict to docutils <0.17 to workaround a list rendering issue in sphinx. -# https://stackoverflow.com/questions/67542699 -docutils <0.17 -pygments <2.13 -urllib3 <2 +sphinx==6.2.1 +sphinxcontrib-programoutput==0.17 +sphinx_design==0.4.1 +sphinx-rtd-theme==1.2.1 +python-levenshtein==0.21.0 +docutils==0.18.1 +pygments==2.15.1 +urllib3==2.0.2 -- cgit v1.2.3-60-g2f50