Skip to content

Commit

Permalink
DOC: centralize and update autodoc settings
Browse files Browse the repository at this point in the history
Explicitly use `sphinx-autodoc-typehints` rather than its extension,
as the extension just installs it anyway. Also move autodoc options to
default options in `conf.py` and adjust some settings that fix
autodoc typehint resolution.
  • Loading branch information
mferrera committed Nov 6, 2023
1 parent 6324af9 commit 3be7189
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 100 deletions.
84 changes: 0 additions & 84 deletions docs/apireference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ Classes
"""""""

.. autoclass:: xtgeo.RegularSurface
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -38,10 +34,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Surfaces
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand Down Expand Up @@ -69,10 +61,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Points
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -92,10 +80,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Polygons
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -117,10 +101,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Well
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -131,10 +111,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Wells
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -152,10 +128,6 @@ Classes
"""""""

.. autoclass:: xtgeo.BlockedWell
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -171,10 +143,6 @@ Classes
"""""""

.. autoclass:: xtgeo.BlockedWells
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -196,10 +164,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Cube
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -220,10 +184,6 @@ Classes
"""""""

.. autoclass:: xtgeo.Grid
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -241,10 +201,6 @@ Classes
"""""""

.. autoclass:: xtgeo.GridProperty
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -255,10 +211,6 @@ Classes
"""""""

.. autoclass:: xtgeo.GridProperties
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -273,10 +225,6 @@ RoxUtils
""""""""

.. autoclass:: xtgeo.RoxUtils
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -287,54 +235,34 @@ MetadataRegularSurface
""""""""""""""""""""""

.. autoclass:: xtgeo.MetaDataRegularSurface
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

MetaDataRegularCube
"""""""""""""""""""

.. autoclass:: xtgeo.MetaDataRegularCube
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

MetaDataCPGeometry
""""""""""""""""""

.. autoclass:: xtgeo.MetaDataCPGeometry
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

MetaDataCPProperty
""""""""""""""""""

.. autoclass:: xtgeo.MetaDataCPProperty
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

MetaDataWell
""""""""""""

.. autoclass:: xtgeo.MetaDataWell
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Expand All @@ -345,31 +273,19 @@ XSection
""""""""

.. autoclass:: xtgeo.plot.XSection
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Map
"""

.. autoclass:: xtgeo.plot.Map
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::

Grid3DSlice
"""""""""""

.. autoclass:: xtgeo.plot.Grid3DSlice
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__

.. autoclasstoc::
29 changes: 16 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
# noqa # pylint: skip-file
from datetime import date

import xtgeo
from autoclasstoc import PublicMethods

import xtgeo

version = xtgeo.__version__
release = xtgeo.__version__
project = "xtgeo"
current_year = date.today().year
copyright = "Equinor 2019 - " + str(current_year) + f" (XTGeo release {release})"

extensions = [
"autoclasstoc",
"myst_parser",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx_toolbox.more_autodoc.typehints",
"sphinx.ext.autodoc",
"sphinx_toolbox.more_autosummary",
"autoclasstoc",
"sphinx_autodoc_typehints",
]

autosummary_generate = True

autoclass_content = "both"


class RemainingPublicMethods(PublicMethods):
# skip dunder methods
def predicate(self, name, attr, meta):
return super().predicate(name, attr, meta) and not name.startswith("__")


autoclass_content = "both"
autoclasstoc_sections = [
"public-attrs",
"public-methods",
]

autodoc_typehints = "description"

autosummary_generate = True
autodoc_default_options = {
"inherited-members": True,
"members": True,
"undoc-members": True,
"show-inheritance": True,
"special-members": "__init__",
}
autodoc_typehints = "none"
napoleon_include_special_with_doc = False

# The suffix of source filenames.
Expand All @@ -48,7 +52,6 @@ def predicate(self, name, attr, meta):
# The master toctree document.
master_doc = "index"


templates_path = ["_templates"]
exclude_patterns = ["_build"]
pygments_style = "sphinx"
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ dev = [
"pytest-xdist",
]
docs = [
"autoclasstoc",
"myst-parser",
"pydocstyle",
"Sphinx",
"sphinx",
"sphinx-autodoc-typehints",
"sphinx-rtd-theme",
"sphinx-toolbox",
"autoclasstoc",
"myst-parser",
]

[tool.black]
Expand Down

0 comments on commit 3be7189

Please sign in to comment.