Repository: pytorch/ignite

Issue:
Update sphinx to 3.5.4 or latest
## 📚 Documentation

Let's bump Sphinx version to 3.5.4 or later for our docs building.


Discussion:
hi @vfdev-5 .first timer this side .i want to work on this issue please guide me .
Hi @Anubha13kumari , please check out https://github.com/pytorch/ignite/blob/master/CONTRIBUTING.md#writing-documentation and try to build locally our docs. Next, change sphinx version in `docs/requirements.txt`, reinstall the new version and rebuild the docs. Please report here how it works and send a PR with the change. 
As a side note, updating to latest (4.2.0) is [failing to build the old versioned docs](https://github.com/ydcjeff/ignite/runs/3731615939?check_suite_focus=true).

We should think about how to manage old versioned docs.
Looks like it is an issue with https://github.com/pytorch-ignite/sphinxcontrib-versioning which we can update as well from our side
> Looks like it is an issue with https://github.com/pytorch-ignite/sphinxcontrib-versioning which we can update as well from our side

@vfdev-5 I think at some point, we might have used deprecated API of latest sphinx to work with old versioned docs since old docs used old sphinx features.
@trsvchn can you check how much effort it can take to update https://github.com/pytorch-ignite/sphinxcontrib-versioning  ? thanks
@vfdev-5 Sure!

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -16,10 +16,11 @@
 import sys
 
 sys.path.insert(0, os.path.abspath("../.."))
-import ignite
+from datetime import datetime
+
 import pytorch_sphinx_theme
 
-from datetime import datetime
+import ignite
 
 # -- Project information -----------------------------------------------------
 
@@ -133,7 +134,8 @@
 }
 
 html_last_updated_fmt = "%m/%d/%Y, %X"
-html_add_permalinks = "#"
+html_permalinks = True
+html_permalinks_icon = "#"
 
 # -- Options for HTMLHelp output ---------------------------------------------
 
@@ -213,26 +215,17 @@
 autodoc_typehints = "description"
 napoleon_attr_annotations = True
 
-# -- A patch that turns-off cross refs for type annotations ------------------
-
-import sphinx.domains.python
-from docutils import nodes
-from sphinx import addnodes
-
-# replaces pending_xref node with desc_type for type annotations
-sphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type("", nodes.Text(t))
-
 # -- Autosummary patch to get list of a classes, funcs automatically ----------
 
 from importlib import import_module
 from inspect import getmembers, isclass, isfunction
-import sphinx.ext.autosummary
-from sphinx.ext.autosummary import Autosummary
+
 from docutils.parsers.rst import directives
 from docutils.statemachine import StringList
+from sphinx.ext.autosummary import Autosummary
 
 
-class BetterAutosummary(Autosummary):
+class AutolistAutosummary(Autosummary):
     """Autosummary with autolisting for modules.
 
     By default it tries to import all public names (__all__),
@@ -317,9 +310,6 @@ def run(self):
         return super().run()
 
 
-# Patch original Autosummary
-sphinx.ext.autosummary.Autosummary = BetterAutosummary
-
 # --- autosummary config -----------------------------------------------------
 autosummary_generate = True
 
@@ -352,3 +342,7 @@ def run(self):
 
 manual_seed(666)
 """
+
+
+def setup(app):
+    app.add_directive("autosummary", AutolistAutosummary, override=True)


Test patch: