diff --git a/doc/_templates/autosummary/attribute.rst b/doc/_templates/autosummary/attribute.rst new file mode 100644 index 000000000000..053ef2e599bc --- /dev/null +++ b/doc/_templates/autosummary/attribute.rst @@ -0,0 +1,9 @@ +:orphan: + +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +attribute + +.. auto{{ objtype }}:: {{ objname }} diff --git a/doc/_templates/autosummary/base.rst b/doc/_templates/autosummary/base.rst new file mode 100644 index 000000000000..a39b883d7da9 --- /dev/null +++ b/doc/_templates/autosummary/base.rst @@ -0,0 +1,13 @@ +{% if objtype == 'property' %} +:orphan: +{% endif %} + +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +{% if objtype == 'property' %} +property +{% endif %} + +.. auto{{ objtype }}:: {{ objname }} diff --git a/doc/_templates/autosummary/class.rst b/doc/_templates/autosummary/class.rst index 1016b42d3361..64c1b11e9f8b 100644 --- a/doc/_templates/autosummary/class.rst +++ b/doc/_templates/autosummary/class.rst @@ -1,53 +1,27 @@ -{{ fullname }} -{{ underline }} - -.. currentmodule:: {{ module }} - -.. autoclass:: {{ objname }} - - .. - Methods +{% extends "!autosummary/class.rst" %} {% block methods %} - - .. rubric:: Methods - - .. - Special methods - -{% for item in ('__getitem__', '__setitem__', '__len__', '__next__', '__iter__') %} -{% if item in all_methods or item in all_attributes %} - .. automethod:: {{ item }} +{% if methods %} + .. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. + .. autosummary:: + :toctree: + {% for item in all_methods %} + {%- if not item.startswith('_') or item in ['__call__'] %} + {{ name }}.{{ item }} + {%- endif -%} + {%- endfor %} {% endif %} -{%- endfor %} - - .. - Ordinary methods - -{% for item in methods %} -{% if item not in ('__init__',) %} - .. automethod:: {{ item }} -{% endif %} -{%- endfor %} - - .. - Special methods +{% endblock %} -{% for item in ('__eq__', '__ne__', '__lt__', '__le__', '__gt__', '__ge__') %} -{% if item in all_methods %} - .. automethod:: {{ item }} +{% block attributes %} +{% if attributes %} + .. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. + .. autosummary:: + :toctree: + {% for item in all_attributes %} + {%- if not item.startswith('_') %} + {{ name }}.{{ item }} + {%- endif -%} + {%- endfor %} {% endif %} -{%- endfor %} {% endblock %} - - .. - Attributes - -{% block attributes %} {% if attributes %} - - .. rubric:: Attributes - -{% for item in attributes %} - .. autoattribute:: {{ item }} -{%- endfor %} -{% endif %} {% endblock %} diff --git a/doc/_templates/autosummary/member.rst b/doc/_templates/autosummary/member.rst new file mode 100644 index 000000000000..aff1005ece71 --- /dev/null +++ b/doc/_templates/autosummary/member.rst @@ -0,0 +1,9 @@ +:orphan: + +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +member + +.. auto{{ objtype }}:: {{ objname }} diff --git a/doc/_templates/autosummary/method.rst b/doc/_templates/autosummary/method.rst new file mode 100644 index 000000000000..cdf7bc566a17 --- /dev/null +++ b/doc/_templates/autosummary/method.rst @@ -0,0 +1,9 @@ +:orphan: + +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +method + +.. auto{{ objtype }}:: {{ objname }} diff --git a/doc/_templates/autosummary/minimal_module.rst b/doc/_templates/autosummary/minimal_module.rst new file mode 100644 index 000000000000..b192459c0d12 --- /dev/null +++ b/doc/_templates/autosummary/minimal_module.rst @@ -0,0 +1,6 @@ +{{ fullname | escape | underline}} + +.. automodule:: {{ fullname }} + + {% block docstring %} + {% endblock %} diff --git a/doc/_templates/autosummary/module.rst b/doc/_templates/autosummary/module.rst new file mode 100644 index 000000000000..66b2fb5e040f --- /dev/null +++ b/doc/_templates/autosummary/module.rst @@ -0,0 +1,41 @@ +{% extends "!autosummary/module.rst" %} + +{# This file is almost the same as the default, but adds :toctree: to the + autosummary directives. The original can be found at + ``sphinx/ext/autosummary/templates/autosummary/module.rst``. #} + +{% block attributes %} +{% if attributes %} + .. rubric:: Module Attributes + + .. autosummary:: + :toctree: + {% for item in attributes %} + {{ item }} + {%- endfor %} +{% endif %} +{% endblock %} + +{% block functions %} +{% if functions %} + .. rubric:: Functions + + .. autosummary:: + :toctree: + {% for item in functions %} + {{ item }} + {%- endfor %} +{% endif %} +{% endblock %} + +{% block classes %} +{% if classes %} + .. rubric:: Classes + + .. autosummary:: + :toctree: + {% for item in classes %} + {{ item }} + {%- endfor %} +{% endif %} +{% endblock %} diff --git a/doc/conf.py b/doc/conf.py index 081070a5e59b..413f3d0ac399 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -6,6 +6,8 @@ # full list see the documentation: # http://www.sphinx-doc.org/en/master/config +from datetime import datetime + from sphinx.ext.autodoc import FunctionDocumenter from dpnp.dpnp_algo.dpnp_elementwise_common import DPNPBinaryFunc, DPNPUnaryFunc @@ -32,7 +34,8 @@ # -- Project information ----------------------------------------------------- project = "Data Parallel Extension for NumPy" -copyright = "2020-2024, Intel Corporation" +year = datetime.now().year +copyright = f"2020-{year}, Intel Corporation" author = "Intel" version = dpnp.__version__.strip(".dirty")