Skip to content

Commit

Permalink
Fix sphinx autosummary breaking change
Browse files Browse the repository at this point in the history
sphinx release 7.4.6 (released Jul 18, 2024):
autosummary: Do not add the package prefix when generating autosummary directives for modules within a package.

sphinx-doc/sphinx#12609
  • Loading branch information
sitic committed Oct 11, 2024
1 parent 61deeda commit fa81e8c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: FedericoCarboni/setup-ffmpeg@v3

- name: Install opencv
run: python -m pip install opencv-python-headless ipywidgets "numpy<2.0" "sphinx<8.0"
run: python -m pip install opencv-python-headless ipywidgets "numpy<2.0"

- name: Checkout code
uses: actions/checkout@v4
Expand Down
31 changes: 15 additions & 16 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -1,63 +1,62 @@
{{ fullname | escape | underline}}

{% block modules %}
{% if modules %}
{%- block modules %}
{%- if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{{ item }}
{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{%- endblock %}

.. automodule:: {{ fullname }}
:members:

{% block attributes %}
{% if attributes %}
{%- if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{%- endblock %}

{% block functions %}
{% if functions %}
{%- block functions %}
{%- if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{%- endblock %}

{% block classes %}
{% if classes %}
{%- block classes %}
{%- if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{%- endblock %}

{% block exceptions %}
{% if exceptions %}
{%- block exceptions %}
{%- if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{%- endblock %}
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def remove_markdown(cell):
nb_execution_mode = "cache"
nb_execution_timeout = 600 # seconds
nb_execution_excludepatterns = ['tutorials/converted/*']
jupyter_cache = str(Path(__file__).parent / ".jupyter_cache")
nb_execution_cache_path = str(Path(__file__).parent / ".jupyter_cache")

# add_module_names = False
# napoleon_google_docstring = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
],
"test": ["pytest"],
"docs": [
"sphinx",
"sphinx>=7.4.6",
"sphinxcontrib-napoleon",
"sphinxcontrib-bibtex",
"sphinxcontrib-video",
Expand Down

0 comments on commit fa81e8c

Please sign in to comment.