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

Collection of updates to remove deprecated RTD features, add new Sphinx extensions #410

5 changes: 2 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ sphinx:

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats:
- pdf
- htmlzip

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
system_packages: true
path: .
44 changes: 42 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@
'sphinx.ext.todo',
'sphinx.ext.viewcode', # Add a link to the Python source code for classes, functions etc.
'nbsphinx',
'sphinx_search.extension', # search across multiple docsets in domain
'sphinx.ext.viewcode', # link to view source code
'myst_parser', # source files written in MD or RST
]

myst_enable_extensions = [
"amsmath",
"attrs_inline",
"colon_fence",
"deflist",
"dollarmath",
"fieldlist",
"html_admonition",
"html_image",
"inv_link",
"linkify",
"replacements",
"smartquotes",
"strikethrough",
"substitution",
"tasklist",
]

autodoc_default_options = {
Expand All @@ -78,7 +99,7 @@

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ['.rst', '.md']
master_doc = 'index'

# General information about the project.
Expand All @@ -98,7 +119,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']

# suppress warnings for multiple possible Python references in the namespace
# suppress_warnings = ['ref.python']
Expand Down Expand Up @@ -128,8 +149,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_css_files = ['theme_overrides.css']

html_context = {
'rtd_url': 'https://docs.idmod.org/projects/covasim/en/latest',
'theme_vcs_pageview_mode': 'edit'
Expand All @@ -156,6 +180,22 @@
# base URL from which the finished HTML is served.
html_use_opensearch = 'docs.idmod.org/projects/covasim/en/latest'


# -- RTD Sphinx search for searching across the entire domain, default child -------------

if os.environ.get('READTHEDOCS') == 'True':

search_project_parent = "institute-for-disease-modeling-idm"
search_project = os.environ["READTHEDOCS_PROJECT"]
search_version = os.environ["READTHEDOCS_VERSION"]

rtd_sphinx_search_default_filter = f"subprojects:{search_project}/{search_version}"

rtd_sphinx_search_filters = {
"Search this project": f"project:{search_project}/{search_version}",
"Search all IDM docs": f"subprojects:{search_project_parent}/{search_version}",
}

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

Expand Down
5 changes: 4 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ nbsphinx
pandoc
pypandoc
optuna
seaborn
seaborn
myst-parser
readthedocs-sphinx-search
jupyterlab
Loading