We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[search] use algolia docsearch
## 📚 Documentation
While built-in search is enough, searching something and hit enter feels like not a good UX.
To be able to search interactively, we can apply [Algolia Docsearch](https://docsearch.algolia.com/) for that.
PyTorch is also using it when searching from homepage.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/source/conf.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 #
3 # Configuration file for the Sphinx documentation builder.
4 #
5 # This file does only contain a selection of the most common options. For a
6 # full list see the documentation:
7 # http://www.sphinx-doc.org/en/stable/config
8 
9 # -- Path setup --------------------------------------------------------------
10 
11 # If extensions (or modules to document with autodoc) are in another directory,
12 # add these directories to sys.path here. If the directory is relative to the
13 # documentation root, use os.path.abspath to make it absolute, like shown here.
14 #
15 import os
16 import sys
17 
18 sys.path.insert(0, os.path.abspath("../.."))
19 import ignite
20 import pytorch_sphinx_theme
21 
22 from datetime import datetime
23 
24 # -- Project information -----------------------------------------------------
25 
26 project = "ignite"
27 author = "PyTorch-Ignite Contributors"
28 copyright = f"{datetime.now().year}, {author}"
29 
30 # The short X.Y version
31 try:
32     version = os.environ["code_version"]
33     if "master" in version:
34         version = "master (" + ignite.__version__ + ")"
35     else:
36         version = version.replace("v", "")
37 except KeyError:
38     version = ignite.__version__
39 
40 # The full version, including alpha/beta/rc tags
41 release = "master"
42 
43 
44 # -- General configuration ---------------------------------------------------
45 
46 # If your documentation needs a minimal Sphinx version, state it here.
47 #
48 # needs_sphinx = '1.0'
49 
50 # Add any Sphinx extension module names here, as strings. They can be
51 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
52 # ones.
53 extensions = [
54     "sphinx.ext.autodoc",
55     "sphinx.ext.autosummary",
56     "sphinx.ext.doctest",
57     "sphinx.ext.intersphinx",
58     "sphinx.ext.todo",
59     "sphinx.ext.coverage",
60     "sphinxcontrib.katex",
61     "sphinx.ext.napoleon",
62     "sphinx.ext.viewcode",
63     "sphinx.ext.autosectionlabel",
64 ]
65 
66 # katex options
67 katex_prerender = True
68 
69 # Add any paths that contain templates here, relative to this directory.
70 templates_path = ["_templates"]
71 
72 # The suffix(es) of source filenames.
73 # You can specify multiple suffix as a list of string:
74 #
75 # source_suffix = ['.rst', '.md']
76 source_suffix = ".rst"
77 
78 # The master toctree document.
79 master_doc = "index"
80 
81 # The language for content autogenerated by Sphinx. Refer to documentation
82 # for a list of supported languages.
83 #
84 # This is also used if you do content translation via gettext catalogs.
85 # Usually you set "language" from the command line for these cases.
86 language = None
87 
88 # List of patterns, relative to source directory, that match files and
89 # directories to ignore when looking for source files.
90 # This pattern also affects html_static_path and html_extra_path .
91 exclude_patterns = []
92 
93 # The name of the Pygments (syntax highlighting) style to use.
94 pygments_style = "sphinx"
95 
96 
97 # -- Options for HTML output -------------------------------------------------
98 
99 # The theme to use for HTML and HTML Help pages.  See the documentation for
100 # a list of builtin themes.
101 #
102 html_theme = "pytorch_sphinx_theme"
103 html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
104 
105 html_theme_options = {
106     "canonical_url": "https://pytorch.org/ignite/index.html",
107     "collapse_navigation": False,
108     "display_version": True,
109     "logo_only": True,
110     "navigation_with_keys": True,
111 }
112 
113 html_logo = "_templates/_static/img/ignite_logo.svg"
114 
115 html_favicon = "_templates/_static/img/ignite_logomark.svg"
116 
117 # Theme options are theme-specific and customize the look and feel of a theme
118 # further.  For a list of options available for each theme, see the
119 # documentation.
120 #
121 # html_theme_options = {}
122 
123 # Add any paths that contain custom static files (such as style sheets) here,
124 # relative to this directory. They are copied after the builtin static files,
125 # so a file named "default.css" will overwrite the builtin "default.css".
126 html_static_path = ["_static", "_templates/_static"]
127 
128 html_context = {
129     "css_files": [
130         # 'https://fonts.googleapis.com/css?family=Lato',
131         # '_static/css/pytorch_theme.css'
132         "_static/css/ignite_theme.css"
133     ],
134 }
135 
136 
137 # -- Options for HTMLHelp output ---------------------------------------------
138 
139 # Output file base name for HTML help builder.
140 htmlhelp_basename = "ignitedoc"
141 
142 
143 # -- Options for LaTeX output ------------------------------------------------
144 
145 latex_elements = {
146     # The paper size ('letterpaper' or 'a4paper').
147     #
148     # 'papersize': 'letterpaper',
149     # The font size ('10pt', '11pt' or '12pt').
150     #
151     # 'pointsize': '10pt',
152     # Additional stuff for the LaTeX preamble.
153     #
154     # 'preamble': '',
155     # Latex figure (float) alignment
156     #
157     # 'figure_align': 'htbp',
158 }
159 
160 # Grouping the document tree into LaTeX files. List of tuples
161 # (source start file, target name, title,
162 #  author, documentclass [howto, manual, or own class]).
163 latex_documents = [
164     (master_doc, "ignite.tex", "ignite Documentation", "Torch Contributors", "manual"),
165 ]
166 
167 
168 # -- Options for manual page output ------------------------------------------
169 
170 # One entry per manual page. List of tuples
171 # (source start file, name, description, authors, manual section).
172 man_pages = [(master_doc, "ignite", "ignite Documentation", [author], 1)]
173 
174 
175 # -- Options for Texinfo output ----------------------------------------------
176 
177 # Grouping the document tree into Texinfo files. List of tuples
178 # (source start file, target name, title, author,
179 #  dir menu entry, description, category)
180 texinfo_documents = [
181     (
182         master_doc,
183         "ignite",
184         "ignite Documentation",
185         author,
186         "ignite",
187         "One line description of project.",
188         "Miscellaneous",
189     ),
190 ]
191 
192 
193 # -- Extension configuration -------------------------------------------------
194 
195 # -- Options for intersphinx extension ---------------------------------------
196 
197 # Example configuration for intersphinx: refer to the Python standard library.
198 intersphinx_mapping = {
199     "python": ("https://docs.python.org/3", None),
200     "torch": ("https://pytorch.org/docs/stable/", None),
201 }
202 
203 # -- Options for todo extension ----------------------------------------------
204 
205 # If true, `todo` and `todoList` produce output, else they produce nothing.
206 todo_include_todos = True
207 
208 # -- Type hints configs ------------------------------------------------------
209 
210 autodoc_inherit_docstrings = True
211 autoclass_content = "both"
212 autodoc_typehints = "description"
213 napoleon_attr_annotations = True
214 
215 # -- A patch that turns-off cross refs for type annotations ------------------
216 
217 import sphinx.domains.python
218 from docutils import nodes
219 from sphinx import addnodes
220 
221 # replaces pending_xref node with desc_type for type annotations
222 sphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type("", nodes.Text(t))
223 
224 # -- Autosummary patch to get list of a classes, funcs automatically ----------
225 
226 from importlib import import_module
227 from inspect import getmembers, isclass, isfunction
228 import sphinx.ext.autosummary
229 from sphinx.ext.autosummary import Autosummary
230 from docutils.parsers.rst import directives
231 from docutils.statemachine import StringList
232 
233 
234 class BetterAutosummary(Autosummary):
235     """Autosummary with autolisting for modules.
236 
237     By default it tries to import all public names (__all__),
238     otherwise import all classes and/or functions in a module.
239 
240     Options:
241     - :autolist: option to get list of classes and functions from currentmodule.
242     - :autolist-classes: option to get list of classes from currentmodule.
243     - :autolist-functions: option to get list of functions from currentmodule.
244 
245     Example Usage:
246 
247     .. currentmodule:: ignite.metrics
248 
249     .. autosummary::
250         :nosignatures:
251         :autolist:
252     """
253 
254     # Add new option
255     _option_spec = Autosummary.option_spec.copy()
256     _option_spec.update(
257         {
258             "autolist": directives.unchanged,
259             "autolist-classes": directives.unchanged,
260             "autolist-functions": directives.unchanged,
261         }
262     )
263     option_spec = _option_spec
264 
265     def run(self):
266         for auto in ("autolist", "autolist-classes", "autolist-functions"):
267             if auto in self.options:
268                 # Get current module name
269                 module_name = self.env.ref_context.get("py:module")
270                 # Import module
271                 module = import_module(module_name)
272 
273                 # Get public names (if possible)
274                 try:
275                     names = getattr(module, "__all__")
276                 except AttributeError:
277                     # Get classes defined in the module
278                     cls_names = [
279                         name[0]
280                         for name in getmembers(module, isclass)
281                         if name[-1].__module__ == module_name and not (name[0].startswith("_"))
282                     ]
283                     # Get functions defined in the module
284                     fn_names = [
285                         name[0]
286                         for name in getmembers(module, isfunction)
287                         if (name[-1].__module__ == module_name) and not (name[0].startswith("_"))
288                     ]
289                     names = cls_names + fn_names
290                     # It may happen that module doesn't have any defined class or func
291                     if not names:
292                         names = [name[0] for name in getmembers(module)]
293 
294                 # Filter out members w/o doc strings
295                 names = [name for name in names if getattr(module, name).__doc__ is not None]
296 
297                 if auto == "autolist":
298                     # Get list of all classes and functions inside module
299                     names = [
300                         name for name in names if (isclass(getattr(module, name)) or isfunction(getattr(module, name)))
301                     ]
302                 else:
303                     if auto == "autolist-classes":
304                         # Get only classes
305                         check = isclass
306                     elif auto == "autolist-functions":
307                         # Get only functions
308                         check = isfunction
309                     else:
310                         raise NotImplementedError
311 
312                     names = [name for name in names if check(getattr(module, name))]
313 
314                 # Update content
315                 self.content = StringList(names)
316         return super().run()
317 
318 
319 # Patch original Autosummary
320 sphinx.ext.autosummary.Autosummary = BetterAutosummary
321
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -32,8 +32,8 @@
     version = os.environ["code_version"]
     if "master" in version:
         version = "master (" + ignite.__version__ + ")"
-    else:
-        version = version.replace("v", "")
+    # else:
+    #     version = version.replace("v", "")
 except KeyError:
     version = ignite.__version__
 
@@ -129,7 +129,8 @@
     "css_files": [
         # 'https://fonts.googleapis.com/css?family=Lato',
         # '_static/css/pytorch_theme.css'
-        "_static/css/ignite_theme.css"
+        "_static/css/ignite_theme.css",
+        "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css",
     ],
 }

{"golden_diff": "diff --git a/docs/source/conf.py b/docs/source/conf.py\n--- a/docs/source/conf.py\n+++ b/docs/source/conf.py\n@@ -32,8 +32,8 @@\n     version = os.environ[\"code_version\"]\n     if \"master\" in version:\n         version = \"master (\" + ignite.__version__ + \")\"\n-    else:\n-        version = version.replace(\"v\", \"\")\n+    # else:\n+    #     version = version.replace(\"v\", \"\")\n except KeyError:\n     version = ignite.__version__\n \n@@ -129,7 +129,8 @@\n     \"css_files\": [\n         # 'https://fonts.googleapis.com/css?family=Lato',\n         # '_static/css/pytorch_theme.css'\n-        \"_static/css/ignite_theme.css\"\n+        \"_static/css/ignite_theme.css\",\n+        \"https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css\",\n     ],\n }\n", "issue": "[search] use algolia docsearch\n## \ud83d\udcda Documentation\r\nWhile built-in search is enough, searching something and hit enter feels like not a good UX.\r\nTo be able to search interactively, we can apply [Algolia Docsearch](https://docsearch.algolia.com/) for that.\r\nPyTorch is also using it when searching from homepage.\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/stable/config\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\nimport sys\n\nsys.path.insert(0, os.path.abspath(\"../..\"))\nimport ignite\nimport pytorch_sphinx_theme\n\nfrom datetime import datetime\n\n# -- Project information -----------------------------------------------------\n\nproject = \"ignite\"\nauthor = \"PyTorch-Ignite Contributors\"\ncopyright = f\"{datetime.now().year}, {author}\"\n\n# The short X.Y version\ntry:\n    version = os.environ[\"code_version\"]\n    if \"master\" in version:\n        version = \"master (\" + ignite.__version__ + \")\"\n    else:\n        version = version.replace(\"v\", \"\")\nexcept KeyError:\n    version = ignite.__version__\n\n# The full version, including alpha/beta/rc tags\nrelease = \"master\"\n\n\n# -- General configuration ---------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.autosummary\",\n    \"sphinx.ext.doctest\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinx.ext.todo\",\n    \"sphinx.ext.coverage\",\n    \"sphinxcontrib.katex\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.viewcode\",\n    \"sphinx.ext.autosectionlabel\",\n]\n\n# katex options\nkatex_prerender = True\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = \".rst\"\n\n# The master toctree document.\nmaster_doc = \"index\"\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path .\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = \"sphinx\"\n\n\n# -- Options for HTML output -------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pytorch_sphinx_theme\"\nhtml_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]\n\nhtml_theme_options = {\n    \"canonical_url\": \"https://pytorch.org/ignite/index.html\",\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": True,\n    \"navigation_with_keys\": True,\n}\n\nhtml_logo = \"_templates/_static/img/ignite_logo.svg\"\n\nhtml_favicon = \"_templates/_static/img/ignite_logomark.svg\"\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\n# html_theme_options = {}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\", \"_templates/_static\"]\n\nhtml_context = {\n    \"css_files\": [\n        # 'https://fonts.googleapis.com/css?family=Lato',\n        # '_static/css/pytorch_theme.css'\n        \"_static/css/ignite_theme.css\"\n    ],\n}\n\n\n# -- Options for HTMLHelp output ---------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = \"ignitedoc\"\n\n\n# -- Options for LaTeX output ------------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, \"ignite.tex\", \"ignite Documentation\", \"Torch Contributors\", \"manual\"),\n]\n\n\n# -- Options for manual page output ------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [(master_doc, \"ignite\", \"ignite Documentation\", [author], 1)]\n\n\n# -- Options for Texinfo output ----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (\n        master_doc,\n        \"ignite\",\n        \"ignite Documentation\",\n        author,\n        \"ignite\",\n        \"One line description of project.\",\n        \"Miscellaneous\",\n    ),\n]\n\n\n# -- Extension configuration -------------------------------------------------\n\n# -- Options for intersphinx extension ---------------------------------------\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n}\n\n# -- Options for todo extension ----------------------------------------------\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n# -- Type hints configs ------------------------------------------------------\n\nautodoc_inherit_docstrings = True\nautoclass_content = \"both\"\nautodoc_typehints = \"description\"\nnapoleon_attr_annotations = True\n\n# -- A patch that turns-off cross refs for type annotations ------------------\n\nimport sphinx.domains.python\nfrom docutils import nodes\nfrom sphinx import addnodes\n\n# replaces pending_xref node with desc_type for type annotations\nsphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type(\"\", nodes.Text(t))\n\n# -- Autosummary patch to get list of a classes, funcs automatically ----------\n\nfrom importlib import import_module\nfrom inspect import getmembers, isclass, isfunction\nimport sphinx.ext.autosummary\nfrom sphinx.ext.autosummary import Autosummary\nfrom docutils.parsers.rst import directives\nfrom docutils.statemachine import StringList\n\n\nclass BetterAutosummary(Autosummary):\n    \"\"\"Autosummary with autolisting for modules.\n\n    By default it tries to import all public names (__all__),\n    otherwise import all classes and/or functions in a module.\n\n    Options:\n    - :autolist: option to get list of classes and functions from currentmodule.\n    - :autolist-classes: option to get list of classes from currentmodule.\n    - :autolist-functions: option to get list of functions from currentmodule.\n\n    Example Usage:\n\n    .. currentmodule:: ignite.metrics\n\n    .. autosummary::\n        :nosignatures:\n        :autolist:\n    \"\"\"\n\n    # Add new option\n    _option_spec = Autosummary.option_spec.copy()\n    _option_spec.update(\n        {\n            \"autolist\": directives.unchanged,\n            \"autolist-classes\": directives.unchanged,\n            \"autolist-functions\": directives.unchanged,\n        }\n    )\n    option_spec = _option_spec\n\n    def run(self):\n        for auto in (\"autolist\", \"autolist-classes\", \"autolist-functions\"):\n            if auto in self.options:\n                # Get current module name\n                module_name = self.env.ref_context.get(\"py:module\")\n                # Import module\n                module = import_module(module_name)\n\n                # Get public names (if possible)\n                try:\n                    names = getattr(module, \"__all__\")\n                except AttributeError:\n                    # Get classes defined in the module\n                    cls_names = [\n                        name[0]\n                        for name in getmembers(module, isclass)\n                        if name[-1].__module__ == module_name and not (name[0].startswith(\"_\"))\n                    ]\n                    # Get functions defined in the module\n                    fn_names = [\n                        name[0]\n                        for name in getmembers(module, isfunction)\n                        if (name[-1].__module__ == module_name) and not (name[0].startswith(\"_\"))\n                    ]\n                    names = cls_names + fn_names\n                    # It may happen that module doesn't have any defined class or func\n                    if not names:\n                        names = [name[0] for name in getmembers(module)]\n\n                # Filter out members w/o doc strings\n                names = [name for name in names if getattr(module, name).__doc__ is not None]\n\n                if auto == \"autolist\":\n                    # Get list of all classes and functions inside module\n                    names = [\n                        name for name in names if (isclass(getattr(module, name)) or isfunction(getattr(module, name)))\n                    ]\n                else:\n                    if auto == \"autolist-classes\":\n                        # Get only classes\n                        check = isclass\n                    elif auto == \"autolist-functions\":\n                        # Get only functions\n                        check = isfunction\n                    else:\n                        raise NotImplementedError\n\n                    names = [name for name in names if check(getattr(module, name))]\n\n                # Update content\n                self.content = StringList(names)\n        return super().run()\n\n\n# Patch original Autosummary\nsphinx.ext.autosummary.Autosummary = BetterAutosummary\n", "path": "docs/source/conf.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/stable/config\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\nimport sys\n\nsys.path.insert(0, os.path.abspath(\"../..\"))\nimport ignite\nimport pytorch_sphinx_theme\n\nfrom datetime import datetime\n\n# -- Project information -----------------------------------------------------\n\nproject = \"ignite\"\nauthor = \"PyTorch-Ignite Contributors\"\ncopyright = f\"{datetime.now().year}, {author}\"\n\n# The short X.Y version\ntry:\n    version = os.environ[\"code_version\"]\n    if \"master\" in version:\n        version = \"master (\" + ignite.__version__ + \")\"\n    # else:\n    #     version = version.replace(\"v\", \"\")\nexcept KeyError:\n    version = ignite.__version__\n\n# The full version, including alpha/beta/rc tags\nrelease = \"master\"\n\n\n# -- General configuration ---------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.autosummary\",\n    \"sphinx.ext.doctest\",\n    \"sphinx.ext.intersphinx\",\n    \"sphinx.ext.todo\",\n    \"sphinx.ext.coverage\",\n    \"sphinxcontrib.katex\",\n    \"sphinx.ext.napoleon\",\n    \"sphinx.ext.viewcode\",\n    \"sphinx.ext.autosectionlabel\",\n]\n\n# katex options\nkatex_prerender = True\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = [\"_templates\"]\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = \".rst\"\n\n# The master toctree document.\nmaster_doc = \"index\"\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path .\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = \"sphinx\"\n\n\n# -- Options for HTML output -------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages.  See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = \"pytorch_sphinx_theme\"\nhtml_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]\n\nhtml_theme_options = {\n    \"canonical_url\": \"https://pytorch.org/ignite/index.html\",\n    \"collapse_navigation\": False,\n    \"display_version\": True,\n    \"logo_only\": True,\n    \"navigation_with_keys\": True,\n}\n\nhtml_logo = \"_templates/_static/img/ignite_logo.svg\"\n\nhtml_favicon = \"_templates/_static/img/ignite_logomark.svg\"\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further.  For a list of options available for each theme, see the\n# documentation.\n#\n# html_theme_options = {}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = [\"_static\", \"_templates/_static\"]\n\nhtml_context = {\n    \"css_files\": [\n        # 'https://fonts.googleapis.com/css?family=Lato',\n        # '_static/css/pytorch_theme.css'\n        \"_static/css/ignite_theme.css\",\n        \"https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css\",\n    ],\n}\n\n\n# -- Options for HTMLHelp output ---------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = \"ignitedoc\"\n\n\n# -- Options for LaTeX output ------------------------------------------------\n\nlatex_elements = {\n    # The paper size ('letterpaper' or 'a4paper').\n    #\n    # 'papersize': 'letterpaper',\n    # The font size ('10pt', '11pt' or '12pt').\n    #\n    # 'pointsize': '10pt',\n    # Additional stuff for the LaTeX preamble.\n    #\n    # 'preamble': '',\n    # Latex figure (float) alignment\n    #\n    # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n#  author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n    (master_doc, \"ignite.tex\", \"ignite Documentation\", \"Torch Contributors\", \"manual\"),\n]\n\n\n# -- Options for manual page output ------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [(master_doc, \"ignite\", \"ignite Documentation\", [author], 1)]\n\n\n# -- Options for Texinfo output ----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n#  dir menu entry, description, category)\ntexinfo_documents = [\n    (\n        master_doc,\n        \"ignite\",\n        \"ignite Documentation\",\n        author,\n        \"ignite\",\n        \"One line description of project.\",\n        \"Miscellaneous\",\n    ),\n]\n\n\n# -- Extension configuration -------------------------------------------------\n\n# -- Options for intersphinx extension ---------------------------------------\n\n# Example configuration for intersphinx: refer to the Python standard library.\nintersphinx_mapping = {\n    \"python\": (\"https://docs.python.org/3\", None),\n    \"torch\": (\"https://pytorch.org/docs/stable/\", None),\n}\n\n# -- Options for todo extension ----------------------------------------------\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = True\n\n# -- Type hints configs ------------------------------------------------------\n\nautodoc_inherit_docstrings = True\nautoclass_content = \"both\"\nautodoc_typehints = \"description\"\nnapoleon_attr_annotations = True\n\n# -- A patch that turns-off cross refs for type annotations ------------------\n\nimport sphinx.domains.python\nfrom docutils import nodes\nfrom sphinx import addnodes\n\n# replaces pending_xref node with desc_type for type annotations\nsphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type(\"\", nodes.Text(t))\n\n# -- Autosummary patch to get list of a classes, funcs automatically ----------\n\nfrom importlib import import_module\nfrom inspect import getmembers, isclass, isfunction\nimport sphinx.ext.autosummary\nfrom sphinx.ext.autosummary import Autosummary\nfrom docutils.parsers.rst import directives\nfrom docutils.statemachine import StringList\n\n\nclass BetterAutosummary(Autosummary):\n    \"\"\"Autosummary with autolisting for modules.\n\n    By default it tries to import all public names (__all__),\n    otherwise import all classes and/or functions in a module.\n\n    Options:\n    - :autolist: option to get list of classes and functions from currentmodule.\n    - :autolist-classes: option to get list of classes from currentmodule.\n    - :autolist-functions: option to get list of functions from currentmodule.\n\n    Example Usage:\n\n    .. currentmodule:: ignite.metrics\n\n    .. autosummary::\n        :nosignatures:\n        :autolist:\n    \"\"\"\n\n    # Add new option\n    _option_spec = Autosummary.option_spec.copy()\n    _option_spec.update(\n        {\n            \"autolist\": directives.unchanged,\n            \"autolist-classes\": directives.unchanged,\n            \"autolist-functions\": directives.unchanged,\n        }\n    )\n    option_spec = _option_spec\n\n    def run(self):\n        for auto in (\"autolist\", \"autolist-classes\", \"autolist-functions\"):\n            if auto in self.options:\n                # Get current module name\n                module_name = self.env.ref_context.get(\"py:module\")\n                # Import module\n                module = import_module(module_name)\n\n                # Get public names (if possible)\n                try:\n                    names = getattr(module, \"__all__\")\n                except AttributeError:\n                    # Get classes defined in the module\n                    cls_names = [\n                        name[0]\n                        for name in getmembers(module, isclass)\n                        if name[-1].__module__ == module_name and not (name[0].startswith(\"_\"))\n                    ]\n                    # Get functions defined in the module\n                    fn_names = [\n                        name[0]\n                        for name in getmembers(module, isfunction)\n                        if (name[-1].__module__ == module_name) and not (name[0].startswith(\"_\"))\n                    ]\n                    names = cls_names + fn_names\n                    # It may happen that module doesn't have any defined class or func\n                    if not names:\n                        names = [name[0] for name in getmembers(module)]\n\n                # Filter out members w/o doc strings\n                names = [name for name in names if getattr(module, name).__doc__ is not None]\n\n                if auto == \"autolist\":\n                    # Get list of all classes and functions inside module\n                    names = [\n                        name for name in names if (isclass(getattr(module, name)) or isfunction(getattr(module, name)))\n                    ]\n                else:\n                    if auto == \"autolist-classes\":\n                        # Get only classes\n                        check = isclass\n                    elif auto == \"autolist-functions\":\n                        # Get only functions\n                        check = isfunction\n                    else:\n                        raise NotImplementedError\n\n                    names = [name for name in names if check(getattr(module, name))]\n\n                # Update content\n                self.content = StringList(names)\n        return super().run()\n\n\n# Patch original Autosummary\nsphinx.ext.autosummary.Autosummary = BetterAutosummary\n", "path": "docs/source/conf.py"}]}