Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix morphology docs and sphinx version (#1042)

Edgar Riba4a813aa2200d
diff --git a/docs/requirements.txt b/docs/requirements.txt
index b6cd6f55a..a38e68f7f 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,13 +1,12 @@
# docs requirements
torch>=1.6.0
torchvision>=0.7.0
-opencv-python==4.2.0.34
-matplotlib==3.1.1
+opencv-python
+matplotlib
# sphinx
-sphinx==2.1.2
-sphinx-gallery==0.4.0
-sphinx_rtd_theme==0.4.3
-sphinxcontrib-bibtex==0.4.2
-nbsphinx==0.4.2
-nbconvert==5.5.0
-notebook==6.1.5
+sphinx >=2.1, <3
+sphinx_rtd_theme
+sphinxcontrib-bibtex<2.0.0
+nbsphinx
+nbconvert
+notebook
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 3db3177bb..74daad141 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -4,7 +4,6 @@ import sys
import torch
import kornia
-import sphinx_gallery
import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory,
@@ -36,7 +35,6 @@ extensions = [
'sphinx.ext.githubpages',
'nbsphinx',
'sphinxcontrib.bibtex',
- 'sphinx_gallery.gen_gallery',
]
napoleon_use_ivar = True
@@ -191,61 +189,3 @@ sphinx_gallery_conf = {
'gallery_dirs': ['tutorials'], # path where to save gallery generated output
'filename_pattern': './',
}
-
-
-# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
-# See http://stackoverflow.com/a/41184353/3343043
-
-from docutils import nodes
-from sphinx.util.docfields import TypedField
-from sphinx import addnodes
-
-
-def patched_make_field(self, types, domain, items, **kw):
- # `kw` catches `env=None` needed for newer sphinx while maintaining
- # backwards compatibility when passed along further down!
-
- # type: (List, unicode, Tuple) -> nodes.field
- def handle_item(fieldarg, content):
- par = nodes.paragraph()
- par += addnodes.literal_strong('', fieldarg) # Patch: this line added
- # par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
- # addnodes.literal_strong))
- if fieldarg in types:
- par += nodes.Text(' (')
- # NOTE: using .pop() here to prevent a single type node to be
- # inserted twice into the doctree, which leads to
- # inconsistencies later when references are resolved
- fieldtype = types.pop(fieldarg)
- if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
- typename = u''.join(n.astext() for n in fieldtype)
- typename = typename.replace('int', 'python:int')
- typename = typename.replace('long', 'python:long')
- typename = typename.replace('float', 'python:float')
- typename = typename.replace('type', 'python:type')
- par.extend(self.make_xrefs(self.typerolename, domain, typename, addnodes.literal_emphasis, **kw))
- else:
- par += fieldtype
- par += nodes.Text(')')
- par += nodes.Text(' -- ')
- par += content
- return par
-
- fieldname = nodes.field_name('', self.label)
- if len(items) == 1 and self.can_collapse:
- fieldarg, content = items[0]
- bodynode = handle_item(fieldarg, content)
- else:
- bodynode = self.list_type()
- for fieldarg, content in items:
- bodynode += nodes.list_item('', handle_item(fieldarg, content))
- fieldbody = nodes.field_body('', bodynode)
- return nodes.field('', fieldname, fieldbody)
-
-
-TypedField.make_field = patched_make_field
-
-
-# @jpchen's hack to get rtd builder to install latest pytorch
-if 'READTHEDOCS' in os.environ:
- os.system('pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp27-cp27mu-linux_x86_64.whl')
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 907d42fae..5f23fc4eb 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -9,7 +9,7 @@ Kornia Documentation
introduction
installation
- tutorials/index
+ Tutorials <https://kornia-tutorials.readthedocs.io/en/latest/>
.. toctree::
:maxdepth: 2
diff --git a/docs/source/morphology.rst b/docs/source/morphology.rst
index 33d903f3b..64a5d34b5 100644
--- a/docs/source/morphology.rst
+++ b/docs/source/morphology.rst
@@ -3,10 +3,10 @@ kornia.morphology
.. currentmodule:: kornia.morphology
-.. autofunction:: dilation
-.. autofunction:: erosion
-.. autofunction:: open
-.. autofunction:: close
-.. autofunction:: gradient
-.. autofunction:: top_hat
-.. autofunction:: black_hat
+.. autofunction:: dilation
+.. autofunction:: erosion
+.. autofunction:: opening
+.. autofunction:: closing
+.. autofunction:: gradient
+.. autofunction:: top_hat
+.. autofunction:: bottom_hat