From e3c48d0083336954b96ee7fe127f1470cc799929 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 22 Dec 2021 17:08:33 -0500 Subject: [PATCH 001/115] Back to dev: 0.15.dev [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index ef8951d..62b20ed 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.15.0 (unreleased) +------------------- + 0.14.0 (2021-12-22) ------------------- From bcc41ff14a4a1df24091f1836f7b1e506beca4f6 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 22 Dec 2021 17:14:26 -0500 Subject: [PATCH 002/115] Update readme badges [ci skip] --- README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 36c14a0..45b17da 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|CI Status| |Coverage Status| |PyPI| +|DOI| |PyPI| |Docs| |CI Status| |Coverage Status| About ===== @@ -20,12 +20,16 @@ or if you have `tox `_ installed:: tox -e test +.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5799977.svg + :target: https://doi.org/10.5281/zenodo.5799977 +.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg + :target: https://pypi.python.org/pypi/sphinx-automodapi +.. |Docs| image:: https://readthedocs.org/projects/sphinx-automodapi/badge/?version=latest + :target: https://sphinx-automodapi.readthedocs.io/en/latest/?badge=latest .. |CI Status| image:: https://github.com/astropy/sphinx-automodapi/workflows/CI/badge.svg :target: https://github.com/astropy/sphinx-automodapi/actions .. |Coverage Status| image:: https://codecov.io/gh/astropy/sphinx-automodapi/branch/main/graph/badge.svg :target: https://codecov.io/gh/astropy/sphinx-automodapi -.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg - :target: https://pypi.python.org/pypi/sphinx-automodapi Development status ------------------ From baa95e98ac266eca63fe115ddb3a6ea08c493408 Mon Sep 17 00:00:00 2001 From: Ed Slavich Date: Mon, 27 Dec 2021 14:10:22 -0500 Subject: [PATCH 003/115] Add test of :skip: with stdlib objects --- .../tests/example_module/stdlib.py | 12 +++++ sphinx_automodapi/tests/test_automodapi.py | 50 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 sphinx_automodapi/tests/example_module/stdlib.py diff --git a/sphinx_automodapi/tests/example_module/stdlib.py b/sphinx_automodapi/tests/example_module/stdlib.py new file mode 100644 index 0000000..3ce715d --- /dev/null +++ b/sphinx_automodapi/tests/example_module/stdlib.py @@ -0,0 +1,12 @@ +""" +A module that imports objects from the standard library. +""" +from pathlib import Path +from datetime import time + + +def add(a, b): + """ + Add two numbers + """ + return a + b diff --git a/sphinx_automodapi/tests/test_automodapi.py b/sphinx_automodapi/tests/test_automodapi.py index cd0550e..21f6e1d 100644 --- a/sphinx_automodapi/tests/test_automodapi.py +++ b/sphinx_automodapi/tests/test_automodapi.py @@ -327,6 +327,56 @@ def test_am_replacer_skip(tmpdir): assert result == am_replacer_skip_expected +am_replacer_skip_stdlib_str = """ +This comes before + +.. automodapi:: sphinx_automodapi.tests.example_module.stdlib + :skip: time + :skip: Path + +This comes after +""" + + +am_replacer_skip_stdlib_expected = """ +This comes before + + +sphinx_automodapi.tests.example_module.stdlib Module +---------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.stdlib + +Functions +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.stdlib + :functions-only: + :toctree: api + :skip: time,Path + + +This comes after +""".format(empty='') + + +def test_am_replacer_skip_stdlib(tmpdir): + """ + Tests using the ":skip:" option in an ".. automodapi::" + that skips objects imported from the standard library. + """ + + with open(tmpdir.join('index.rst').strpath, 'w') as f: + f.write(am_replacer_skip_stdlib_str.format(options='')) + + run_sphinx_in_tmpdir(tmpdir) + + with open(tmpdir.join('index.rst.automodapi').strpath) as f: + result = f.read() + + assert result == am_replacer_skip_stdlib_expected + + am_replacer_include_str = """ This comes before From 8be51e311d8748594e3537ed22471b6d114e3799 Mon Sep 17 00:00:00 2001 From: Ed Slavich Date: Mon, 27 Dec 2021 14:19:12 -0500 Subject: [PATCH 004/115] Fix style issue --- sphinx_automodapi/tests/example_module/stdlib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sphinx_automodapi/tests/example_module/stdlib.py b/sphinx_automodapi/tests/example_module/stdlib.py index 3ce715d..626dc69 100644 --- a/sphinx_automodapi/tests/example_module/stdlib.py +++ b/sphinx_automodapi/tests/example_module/stdlib.py @@ -5,6 +5,9 @@ from datetime import time +__all__ = ['Path', 'time', 'add'] + + def add(a, b): """ Add two numbers From 610bb350c336fb48b2011e9ea2a974a1e89f9416 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 28 Dec 2021 18:10:57 -0500 Subject: [PATCH 005/115] fix for skip bug --- sphinx_automodapi/automodapi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index 1957194..28cff8a 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -411,12 +411,12 @@ def _mod_info(modname, toskip=[], include=[], onlylocals=True): hascls = hasfunc = hasother = False - skips = [] + skips = toskip.copy() for localnm, fqnm, obj in zip(*find_mod_objs(modname, onlylocals=onlylocals)): - if localnm in toskip or (include and localnm not in include): + if include and localnm not in include and localnm not in skips: skips.append(localnm) - else: + elif localnm not in toskip: hascls = hascls or inspect.isclass(obj) hasfunc = hasfunc or inspect.isroutine(obj) hasother = hasother or (not inspect.isclass(obj) and From 57a83608a60228688c7813ab43223fd03e59c519 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 28 Dec 2021 18:11:19 -0500 Subject: [PATCH 006/115] add note about regression test --- sphinx_automodapi/tests/test_automodapi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx_automodapi/tests/test_automodapi.py b/sphinx_automodapi/tests/test_automodapi.py index 21f6e1d..4aa40a0 100644 --- a/sphinx_automodapi/tests/test_automodapi.py +++ b/sphinx_automodapi/tests/test_automodapi.py @@ -364,6 +364,7 @@ def test_am_replacer_skip_stdlib(tmpdir): """ Tests using the ":skip:" option in an ".. automodapi::" that skips objects imported from the standard library. + This is a regression test for #141 """ with open(tmpdir.join('index.rst').strpath, 'w') as f: From 4ae1ae4357d6ba04f53dd2360449c8e1f6afc26a Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 29 Dec 2021 09:25:17 -0500 Subject: [PATCH 007/115] Ignore distutils DeprecationWarning from Sphinx --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index fdd19cc..0dfbcc6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,6 +43,7 @@ filterwarnings = ignore:The `docutils\.parsers\.rst\.directive\.html` module will be removed:DeprecationWarning ignore:'contextfunction' is renamed to 'pass_context':DeprecationWarning ignore:'environmentfilter' is renamed to 'pass_environment':DeprecationWarning + ignore:distutils Version classes are deprecated:DeprecationWarning [flake8] max-line-length = 125 From b355d3075f782214fca91bab21bc13c25772039e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 29 Dec 2021 09:30:14 -0500 Subject: [PATCH 008/115] Update CHANGES.rst --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 62b20ed..53fa563 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes in sphinx-automodapi 0.15.0 (unreleased) ------------------- +- Fixed issue with ``:skip:`` introduced by ``:include:`` feature. [#142] + 0.14.0 (2021-12-22) ------------------- From a9177d460c8c1130ee630a6d3c541324b43f213b Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Wed, 29 Dec 2021 12:56:36 -0500 Subject: [PATCH 009/115] add one more validation that non-local names get skipped --- sphinx_automodapi/tests/test_automodapi.py | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sphinx_automodapi/tests/test_automodapi.py b/sphinx_automodapi/tests/test_automodapi.py index 4aa40a0..72e52fd 100644 --- a/sphinx_automodapi/tests/test_automodapi.py +++ b/sphinx_automodapi/tests/test_automodapi.py @@ -378,6 +378,56 @@ def test_am_replacer_skip_stdlib(tmpdir): assert result == am_replacer_skip_stdlib_expected +am_replacer_include_stdlib_str = """ +This comes before + +.. automodapi:: sphinx_automodapi.tests.example_module.stdlib + :include: add + :allowed-package-names: pathlib, datetime, sphinx_automodapi + +This comes after +""" + +am_replacer_include_stdlib_expected = """ +This comes before + + +sphinx_automodapi.tests.example_module.stdlib Module +---------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.stdlib + +Functions +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.stdlib + :functions-only: + :toctree: api + :skip: Path,time + :allowed-package-names: pathlib,datetime,sphinx_automodapi + + +This comes after +""".format(empty='') + + +def test_am_replacer_include_stdlib(tmpdir): + """ + Tests using the ":include: option in an ".. automodapi::" + in the presence of objects imported from the standard library. + """ + + with open(tmpdir.join('index.rst').strpath, 'w') as f: + f.write(am_replacer_include_stdlib_str.format(options='')) + + run_sphinx_in_tmpdir(tmpdir) + + with open(tmpdir.join('index.rst.automodapi').strpath) as f: + result = f.read() + + assert result == am_replacer_include_stdlib_expected + + am_replacer_include_str = """ This comes before From 77c1b9eac198d3efe76a6fd93cb160418b879c83 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 12 Jan 2022 13:17:55 -0500 Subject: [PATCH 010/115] Finalize change log for 0.14.1 --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 53fa563..4cad8d3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changes in sphinx-automodapi ============================ -0.15.0 (unreleased) +0.14.1 (2022-01-12) ------------------- - Fixed issue with ``:skip:`` introduced by ``:include:`` feature. [#142] From 995549c39eadb761c7c77fb5a1056d335f9bbd3e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 12 Jan 2022 13:31:15 -0500 Subject: [PATCH 011/115] Back to dev: 0.15.dev [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4cad8d3..e4ff835 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.15.0 (unreleased) +------------------- + 0.14.1 (2022-01-12) ------------------- From c4821079296463dd006371b86320daa96fc085e0 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 1 Mar 2022 09:05:20 -0500 Subject: [PATCH 012/115] TST: Use windows-2019 until Microsoft fix windows-latest env --- .github/workflows/ci_workflows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 5243ad2..4609281 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: [ main ] - tags: + tags: '*' workflow_dispatch: schedule: # Monthly cron @@ -57,13 +57,13 @@ jobs: toxenv: py39-test-sphinxdev # Windows - just the oldest, stable, and dev - - os: windows-latest + - os: windows-2019 python-version: 3.7 toxenv: py37-test-sphinx24 - - os: windows-latest + - os: windows-2019 python-version: 3.8 toxenv: py38-test-sphinx43-clocale - - os: windows-latest + - os: windows-2019 python-version: 3.9 toxenv: py39-test-sphinxdev From 50f21ed1a089a45f715109cd10f29a743bfbe20e Mon Sep 17 00:00:00 2001 From: "Pey Lian Lim (Github)" <2090236+pllim@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:47:26 -0400 Subject: [PATCH 013/115] TST: Pin Jinja2 for older Sphinx --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 7f51209..b85e8ee 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,9 @@ isolated_build = true changedir = .tmp/{envname} deps = sphinx24: sphinx==2.4.* + sphinx24: Jinja2==3.0.3 sphinx35: sphinx==3.5.* + sphinx35: Jinja2==3.0.3 sphinx40: sphinx==4.0.* sphinx41: sphinx==4.1.* sphinx42: sphinx==4.2.* From 3194e0a8c290ab81bec37a553ed60cf8473cb52b Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Wed, 20 Apr 2022 14:51:38 +0200 Subject: [PATCH 014/115] Use generated version for __version__ --- .gitignore | 1 + pyproject.toml | 4 ++++ setup.py | 3 +-- sphinx_automodapi/__init__.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8f9b3ad..60842bf 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ __pycache__ # Other generated files MANIFEST +sphinx_automodapi/version.py # Sphinx _build diff --git a/pyproject.toml b/pyproject.toml index 590e0b1..e06fcb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,3 +3,7 @@ requires = ["setuptools>=30.3.0", "setuptools_scm", "wheel"] build-backend = 'setuptools.build_meta' + + +[tool.setuptools_scm] +write_to = "sphinx_automodapi/version.py" diff --git a/setup.py b/setup.py index 21f6163..beda28e 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import os from setuptools import setup -setup(use_scm_version={'write_to': os.path.join('sphinx_automodapi', 'version.py')}) +setup() diff --git a/sphinx_automodapi/__init__.py b/sphinx_automodapi/__init__.py index b5e195e..e0fcb47 100644 --- a/sphinx_automodapi/__init__.py +++ b/sphinx_automodapi/__init__.py @@ -1 +1 @@ -__version__ = '0.14.dev0' +from .version import version as __version__ # noqa From e1d71c5349b43b41c29e378fb29d212350a01ccd Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Wed, 20 Apr 2022 14:53:55 +0200 Subject: [PATCH 015/115] Remove old py2 compat code --- sphinx_automodapi/automodapi.py | 16 ++++--------- sphinx_automodapi/automodsumm.py | 3 +-- sphinx_automodapi/tests/helpers.py | 5 ++-- .../tests/test_autodoc_enhancements.py | 24 ++++--------------- sphinx_automodapi/tests/test_automodapi.py | 8 +------ sphinx_automodapi/tests/test_cases.py | 10 ++++---- sphinx_automodapi/utils.py | 7 ------ 7 files changed, 18 insertions(+), 55 deletions(-) diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index 28cff8a..f993cf5 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -101,7 +101,6 @@ class are included in the generated documentation. Defaults to ``False``. # actually built. import inspect -import io import os import re import sys @@ -112,11 +111,6 @@ class are included in the generated documentation. Defaults to ``False``. __all__ = [] -if sys.version_info[0] == 3: - text_type = str -else: - text_type = unicode # noqa - automod_templ_modheader = """ {modname} {pkgormod} {modhds}{pkgormodhds} @@ -377,14 +371,14 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, if app.config.automodapi_writereprocessed: # sometimes they are unicode, sometimes not, depending on how # sphinx has processed things - if isinstance(newsourcestr, text_type): + if isinstance(newsourcestr, str): ustr = newsourcestr else: ustr = newsourcestr.decode(app.config.source_encoding) if docname is None: - with io.open(os.path.join(app.srcdir, 'unknown.automodapi'), - 'a', encoding='utf8') as f: + with open(os.path.join(app.srcdir, 'unknown.automodapi'), + 'a', encoding='utf8') as f: f.write(u'\n**NEW DOC**\n\n') f.write(ustr) else: @@ -394,8 +388,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, filename = docname + os.path.splitext(env.doc2path(docname))[1] filename += '.automodapi' - with io.open(os.path.join(app.srcdir, filename), 'w', - encoding='utf8') as f: + with open(os.path.join(app.srcdir, filename), 'w', + encoding='utf8') as f: f.write(ustr) return newsourcestr diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 30979cc..bd6d9f1 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -87,7 +87,6 @@ class members that are inherited from a base class. This value can be import inspect import os import re -import io from sphinx.util import logging from sphinx.ext.autosummary import Autosummary @@ -312,7 +311,7 @@ def automodsumm_to_autosummary_lines(fn, app): fullfn = os.path.join(app.builder.env.srcdir, fn) - with io.open(fullfn, encoding='utf8') as fr: + with open(fullfn, encoding='utf8') as fr: # Note: we use __name__ here instead of just writing the module name in # case this extension is bundled into another package from . import automodapi diff --git a/sphinx_automodapi/tests/helpers.py b/sphinx_automodapi/tests/helpers.py index 01b3510..5fb34a0 100644 --- a/sphinx_automodapi/tests/helpers.py +++ b/sphinx_automodapi/tests/helpers.py @@ -2,7 +2,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst import os -import sys from copy import deepcopy from sphinx.cmd.build import build_main @@ -13,8 +12,8 @@ intersphinx_mapping = { - 'python': ('https://docs.python.org/{0}/'.format(sys.version_info[0]), None) - } + 'python': ('https://docs.python.org/3/', None) +} DEFAULT_CONF = {'source_suffix': '.rst', 'master_doc': 'index', diff --git a/sphinx_automodapi/tests/test_autodoc_enhancements.py b/sphinx_automodapi/tests/test_autodoc_enhancements.py index 3f3860c..5e3f6de 100644 --- a/sphinx_automodapi/tests/test_autodoc_enhancements.py +++ b/sphinx_automodapi/tests/test_autodoc_enhancements.py @@ -1,5 +1,3 @@ -import sys - from textwrap import dedent import pytest @@ -15,23 +13,11 @@ def foo(cls): return 'foo' -if sys.version_info[0] < 3: - exec(dedent(""" - class MyClass(object): - __metaclass__ = Meta - @property - def foo(self): - \"\"\"Docstring for MyClass.foo property.\"\"\" - return 'myfoo' - """)) -else: - exec(dedent(""" - class MyClass(metaclass=Meta): - @property - def foo(self): - \"\"\"Docstring for MyClass.foo property.\"\"\" - return 'myfoo' - """)) +class MyClass(metaclass=Meta): + @property + def foo(self): + """Docstring for MyClass.foo property.""" + return 'myfoo' def test_type_attrgetter(): diff --git a/sphinx_automodapi/tests/test_automodapi.py b/sphinx_automodapi/tests/test_automodapi.py index 72e52fd..1cf21e2 100644 --- a/sphinx_automodapi/tests/test_automodapi.py +++ b/sphinx_automodapi/tests/test_automodapi.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst -import sys from copy import copy import pytest @@ -10,11 +9,6 @@ from . import cython_testpackage # noqa from .helpers import run_sphinx_in_tmpdir -if sys.version_info[0] == 2: - from io import open as io_open -else: - io_open = open - def setup_function(func): # This can be replaced with the docutils_namespace context manager once @@ -104,7 +98,7 @@ def test_am_replacer_writereprocessed(tmpdir, writereprocessed): Tests the automodapi_writereprocessed option """ - with io_open(tmpdir.join('index.rst').strpath, 'w', encoding='utf-8') as f: + with open(tmpdir.join('index.rst').strpath, 'w', encoding='utf-8') as f: f.write(am_replacer_repr_str.format(options='')) run_sphinx_in_tmpdir(tmpdir, additional_conf={'automodapi_writereprocessed': writereprocessed}) diff --git a/sphinx_automodapi/tests/test_cases.py b/sphinx_automodapi/tests/test_cases.py index 72f6140..351e388 100644 --- a/sphinx_automodapi/tests/test_cases.py +++ b/sphinx_automodapi/tests/test_cases.py @@ -4,8 +4,6 @@ # We store different cases in the cases sub-directory of the tests directory import os -import io -import sys import glob import shutil from itertools import product @@ -26,8 +24,8 @@ intersphinx_mapping = { - 'python': ('https://docs.python.org/{0}/'.format(sys.version_info[0]), None) - } + 'python': ('https://docs.python.org/3/', None) +} DEFAULT_CONF = {'source_suffix': '.rst', 'master_doc': 'index', @@ -112,8 +110,8 @@ def test_run_full_case(tmpdir, case_dir, parallel): path_relative = os.path.relpath(path_reference, output_dir) path_actual = os.path.join(docs_dir, path_relative) assert os.path.exists(path_actual) - with io.open(path_actual, encoding='utf8') as f: + with open(path_actual, encoding='utf8') as f: actual = f.read() - with io.open(path_reference, encoding='utf8') as f: + with open(path_reference, encoding='utf8') as f: reference = f.read() assert actual.strip() == reference.strip() diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 1716874..f0b1fff 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -9,13 +9,6 @@ __all__ = ['cleanup_whitespace', 'find_mod_objs', 'find_autosummary_in_lines_for_automodsumm'] -if sys.version_info[0] >= 3: - def iteritems(dictionary): - return dictionary.items() -else: - def iteritems(dictionary): - return dictionary.iteritems() - # We use \n instead of os.linesep because even on Windows, the generated files # use \n as the newline character. SPACE_NEWLINE = ' \n' From 377f1e8ef5b2a07fd95a1f09e22e7c80a453797d Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Sun, 31 Jul 2022 21:26:20 +0200 Subject: [PATCH 016/115] Add class with non-ascii members to non-ascii testcase --- .../tests/cases/non_ascii/input/index.rst | 1 + ...tests.example_module.nonascii.NonAscii.rst | 19 ++++++++++++++++++ .../non_ascii/output/index.rst.automodapi | 20 +++++++++++++++++++ .../non_ascii/output/index.rst.automodsumm | 7 +++++++ .../tests/example_module/nonascii.py | 14 +++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst create mode 100644 sphinx_automodapi/tests/example_module/nonascii.py diff --git a/sphinx_automodapi/tests/cases/non_ascii/input/index.rst b/sphinx_automodapi/tests/cases/non_ascii/input/index.rst index a0275eb..dc7cf3b 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/input/index.rst +++ b/sphinx_automodapi/tests/cases/non_ascii/input/index.rst @@ -1,3 +1,4 @@ Ceçi est un exemple qui inclus des charactères non-ASCII .. automodapi:: sphinx_automodapi.tests.example_module.functions +.. automodapi:: sphinx_automodapi.tests.example_module.nonascii diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst new file mode 100644 index 0000000..1ea0c55 --- /dev/null +++ b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst @@ -0,0 +1,19 @@ +NonAscii +======== + +.. currentmodule:: sphinx_automodapi.tests.example_module.nonascii + +.. autoclass:: NonAscii + :show-inheritance: + + .. rubric:: Methods Summary + + .. autosummary:: + + ~NonAscii.get_ß + ~NonAscii.get_äöü + + .. rubric:: Methods Documentation + + .. automethod:: get_ß + .. automethod:: get_äöü diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi index a80b228..f7e71cd 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodapi @@ -12,3 +12,23 @@ Functions .. automodsumm:: sphinx_automodapi.tests.example_module.functions :functions-only: :toctree: api + + +sphinx_automodapi.tests.example_module.nonascii Module +------------------------------------------------------ + +.. automodule:: sphinx_automodapi.tests.example_module.nonascii + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.nonascii + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.nonascii + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index 8aa64a3..fb4ef02 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -6,3 +6,10 @@ add subtract multiply +.. currentmodule:: sphinx_automodapi.tests.example_module.nonascii + +.. autosummary:: + :toctree: api + + NonAscii + diff --git a/sphinx_automodapi/tests/example_module/nonascii.py b/sphinx_automodapi/tests/example_module/nonascii.py new file mode 100644 index 0000000..9cb184a --- /dev/null +++ b/sphinx_automodapi/tests/example_module/nonascii.py @@ -0,0 +1,14 @@ +__all__ = ['NonAscii'] + +class NonAscii(object): + def get_äöü(self): + """ + Return a string with common umlauts like äöüß + """ + return 'äöü' + + def get_ß(self): + """ + Return a string with the eszett symbol + """ + return 'ß' From 1f1c9ab1ae1edca14d30180fe75cf8eecb284dd6 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Sun, 31 Jul 2022 21:28:14 +0200 Subject: [PATCH 017/115] Set default encoding to utf8 Sphinx expects utf8 and this may set to something different by default on Windows. --- sphinx_automodapi/automodsumm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index bd6d9f1..dd2dfc2 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -487,7 +487,7 @@ def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst', new_files.append(fn) - f = open(fn, 'w') + f = open(fn, 'w', encoding='utf8') try: From cf0d5c041ff59d12b600f7f11b39cf474d9cfb1e Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Mon, 1 Aug 2022 22:28:07 +0200 Subject: [PATCH 018/115] Add blank line --- sphinx_automodapi/tests/example_module/nonascii.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx_automodapi/tests/example_module/nonascii.py b/sphinx_automodapi/tests/example_module/nonascii.py index 9cb184a..ccded8e 100644 --- a/sphinx_automodapi/tests/example_module/nonascii.py +++ b/sphinx_automodapi/tests/example_module/nonascii.py @@ -1,5 +1,6 @@ __all__ = ['NonAscii'] + class NonAscii(object): def get_äöü(self): """ From fe3e5cfa707e38a8a3160d395ce5b34286e41861 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Mon, 1 Aug 2022 23:44:01 +0200 Subject: [PATCH 019/115] Set default language to fix warning on readthedocs --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index c453cc2..5dafd40 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,7 +38,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From fd0b599c0eaf75c424c9c707e429df1ab7a633f9 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Tue, 2 Aug 2022 08:48:04 +0200 Subject: [PATCH 020/115] Add empty line --- .../tests/cases/non_ascii/output/index.rst.automodsumm | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index fb4ef02..62138f0 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -6,6 +6,7 @@ add subtract multiply + .. currentmodule:: sphinx_automodapi.tests.example_module.nonascii .. autosummary:: From e58092ddb4477800e93db8e44dae6c2f82595459 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Tue, 2 Aug 2022 08:48:23 +0200 Subject: [PATCH 021/115] Update changelog --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index e4ff835..a99bbf9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes in sphinx-automodapi 0.15.0 (unreleased) ------------------- +- Fixed issue with non-ascii characters in object members on Windows as the default encoding there is not ``utf8`` [#153] + 0.14.1 (2022-01-12) ------------------- From e5a52cfc8f1d6932b2487681db98209c3dd68740 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Tue, 2 Aug 2022 20:02:46 +0200 Subject: [PATCH 022/115] Remove empty line as the tests fail with it --- .../tests/cases/non_ascii/output/index.rst.automodsumm | 1 - 1 file changed, 1 deletion(-) diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index 62138f0..fb4ef02 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -6,7 +6,6 @@ add subtract multiply - .. currentmodule:: sphinx_automodapi.tests.example_module.nonascii .. autosummary:: From 953ce096c66ad3a15ff429146ec652b968e76ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 8 Aug 2022 16:23:12 -0700 Subject: [PATCH 023/115] rephrase changelog [skip ci] --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a99bbf9..0d329c6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Changes in sphinx-automodapi 0.15.0 (unreleased) ------------------- -- Fixed issue with non-ascii characters in object members on Windows as the default encoding there is not ``utf8`` [#153] +- Fixed issue with non-ascii characters in object members when the encoding is not ``utf8`` [#153] 0.14.1 (2022-01-12) ------------------- From 6e476f21476949d3b71dc9df19ab4feb191ac803 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 9 Dec 2022 18:48:42 +0100 Subject: [PATCH 024/115] Add option to set :noindex: (#150) * Add option to set :noindex: Fix #130 * Remove py2 compat code * Add test * Fix package discovery * Cleanup * Include test files * Typos * Comment out language = None Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --- setup.cfg | 2 +- sphinx_automodapi/automodapi.py | 9 +++++++ sphinx_automodapi/automodsumm.py | 4 ++- .../templates/autosummary_core/class.rst | 3 +++ .../tests/duplicated_warning/__init__.py | 0 .../tests/duplicated_warning/docs/conf.py | 11 ++++++++ .../tests/duplicated_warning/docs/foo.rst | 9 +++++++ .../tests/duplicated_warning/docs/index.rst | 19 ++++++++++++++ .../duplicated_warning/duplicated/__init__.py | 6 +++++ .../duplicated/foo/__init__.py | 5 ++++ .../duplicated_warning/duplicated/foo/foo.py | 17 +++++++++++++ .../tests/example_module/abstract_classes.py | 8 +----- sphinx_automodapi/tests/test_cases.py | 25 +++++++++++++++++++ sphinx_automodapi/utils.py | 11 ++++++-- 14 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 sphinx_automodapi/tests/duplicated_warning/__init__.py create mode 100644 sphinx_automodapi/tests/duplicated_warning/docs/conf.py create mode 100644 sphinx_automodapi/tests/duplicated_warning/docs/foo.rst create mode 100644 sphinx_automodapi/tests/duplicated_warning/docs/index.rst create mode 100644 sphinx_automodapi/tests/duplicated_warning/duplicated/__init__.py create mode 100644 sphinx_automodapi/tests/duplicated_warning/duplicated/foo/__init__.py create mode 100644 sphinx_automodapi/tests/duplicated_warning/duplicated/foo/foo.py diff --git a/setup.cfg b/setup.cfg index 0dfbcc6..4886f2c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ test = [options.package_data] sphinx_automodapi = templates/*/*.rst -sphinx_automodapi.tests = cases/*/*.*, cases/*/*/*.*, cases/*/*/*/*.*, cases/*/*/*/*/*.* +sphinx_automodapi.tests = cases/*/*.*, cases/*/*/*.*, cases/*/*/*/*.*, cases/*/*/*/*/*.*, duplicated_warning/docs/* [tool:pytest] minversion = 4.6 diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index f993cf5..a6cd719 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -63,6 +63,10 @@ documentation. The option ``:inherited-members:`` or ``:no-inherited-members:`` allows the user to overrride the global setting. + * ``:noindex:`` + Propagates the ``noindex`` flag to autodoc. Use it to avoid duplicate + objects warnings. + This extension also adds four sphinx configuration options: @@ -239,6 +243,7 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, hds = '-^' allowedpkgnms = [] allowothers = False + noindex = False # look for actual options unknownops = [] @@ -266,6 +271,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, inherited_members = False elif opname == 'include-all-objects': allowothers = True + elif opname == 'noindex': + noindex = True else: unknownops.append(opname) @@ -321,6 +328,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, clsfuncoptions = [] if toctreestr: clsfuncoptions.append(toctreestr) + if noindex: + clsfuncoptions.append(':noindex:') if toskip: clsfuncoptions.append(':skip: ' + ','.join(toskip)) if allowedpkgnms: diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index dd2dfc2..10a71f6 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -124,6 +124,7 @@ class Automodsumm(Autosummary): option_spec['allowed-package-names'] = _str_list_converter option_spec['inherited-members'] = flag option_spec['no-inherited-members'] = flag + option_spec['noindex'] = flag def run(self): env = self.state.document.settings.env @@ -457,7 +458,7 @@ def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst', new_files = [] # write - for name, path, template_name, inherited_mem in sorted(items): + for name, path, template_name, inherited_mem, noindex in sorted(items): if path is None: # The corresponding autosummary:: directive did not have @@ -601,6 +602,7 @@ def get_members_class(obj, typ, include_public=[], else: mod_name, obj_name = '.'.join(parts[:-1]), parts[-1] + ns['noindex'] = noindex ns['fullname'] = name ns['module'] = mod_name ns['objname'] = obj_name diff --git a/sphinx_automodapi/templates/autosummary_core/class.rst b/sphinx_automodapi/templates/autosummary_core/class.rst index 85105fa..198d04b 100644 --- a/sphinx_automodapi/templates/autosummary_core/class.rst +++ b/sphinx_automodapi/templates/autosummary_core/class.rst @@ -9,6 +9,9 @@ .. autoclass:: {{ objname }} :show-inheritance: + {% if noindex -%} + :noindex: + {%- endif %} {% if '__init__' in methods %} {% set caught_result = methods.remove('__init__') %} diff --git a/sphinx_automodapi/tests/duplicated_warning/__init__.py b/sphinx_automodapi/tests/duplicated_warning/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sphinx_automodapi/tests/duplicated_warning/docs/conf.py b/sphinx_automodapi/tests/duplicated_warning/docs/conf.py new file mode 100644 index 0000000..b3a40ef --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/docs/conf.py @@ -0,0 +1,11 @@ +project = 'duplicated' +copyright = '2022, Maximilian Linhoff' +author = 'Maximilian Linhoff' +release = '0.1' + + +extensions = [ + "sphinx_automodapi.automodapi", +] + +html_theme = 'alabaster' diff --git a/sphinx_automodapi/tests/duplicated_warning/docs/foo.rst b/sphinx_automodapi/tests/duplicated_warning/docs/foo.rst new file mode 100644 index 0000000..15c9792 --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/docs/foo.rst @@ -0,0 +1,9 @@ +Foo Submodule +============= + + +API Reference +------------- + +.. automodapi:: sphinx_automodapi.tests.duplicated_warning.duplicated.foo + :noindex: diff --git a/sphinx_automodapi/tests/duplicated_warning/docs/index.rst b/sphinx_automodapi/tests/duplicated_warning/docs/index.rst new file mode 100644 index 0000000..55140c9 --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/docs/index.rst @@ -0,0 +1,19 @@ +.. duplicated documentation master file, created by + sphinx-quickstart on Tue Mar 29 17:11:23 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to duplicated's documentation! +====================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + foo + + +API Reference +------------- + +.. automodapi:: sphinx_automodapi.tests.duplicated_warning.duplicated diff --git a/sphinx_automodapi/tests/duplicated_warning/duplicated/__init__.py b/sphinx_automodapi/tests/duplicated_warning/duplicated/__init__.py new file mode 100644 index 0000000..41d8653 --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/duplicated/__init__.py @@ -0,0 +1,6 @@ +from .foo import Foo + + +__all__ = [ + 'Foo', +] diff --git a/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/__init__.py b/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/__init__.py new file mode 100644 index 0000000..a15a7ef --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/__init__.py @@ -0,0 +1,5 @@ +from .foo import Foo + +__all__ = [ + "Foo", +] diff --git a/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/foo.py b/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/foo.py new file mode 100644 index 0000000..c706ea3 --- /dev/null +++ b/sphinx_automodapi/tests/duplicated_warning/duplicated/foo/foo.py @@ -0,0 +1,17 @@ +__all__ = [ + 'Foo', + 'Bar', + 'baz', +] + + +class Foo: + '''Awesome Foo class''' + + +class Bar: + '''Awesome Bar class''' + + +def baz(): + '''Awesome baz function''' diff --git a/sphinx_automodapi/tests/example_module/abstract_classes.py b/sphinx_automodapi/tests/example_module/abstract_classes.py index a5893c3..af1102d 100644 --- a/sphinx_automodapi/tests/example_module/abstract_classes.py +++ b/sphinx_automodapi/tests/example_module/abstract_classes.py @@ -1,10 +1,4 @@ -try: - # Python 3 - from collections.abc import Sequence -except ImportError: - # Python 2 (this import also works in Python <= 3.7, but will be removed in - # Python 3.8) - from collections import Sequence +from collections.abc import Sequence __all__ = ['SequenceSubclass'] diff --git a/sphinx_automodapi/tests/test_cases.py b/sphinx_automodapi/tests/test_cases.py index 351e388..63b0171 100644 --- a/sphinx_automodapi/tests/test_cases.py +++ b/sphinx_automodapi/tests/test_cases.py @@ -115,3 +115,28 @@ def test_run_full_case(tmpdir, case_dir, parallel): with open(path_reference, encoding='utf8') as f: reference = f.read() assert actual.strip() == reference.strip() + + +def test_duplicated_warning(tmpdir): + input_dir = os.path.join(os.path.dirname(__file__), 'duplicated_warning', 'docs') + docs_dir = tmpdir.mkdir('docs').strpath + + start_dir = os.path.abspath('.') + src_dir = '.' + + for root, dirnames, filenames in os.walk(input_dir): + for filename in filenames: + root_dir = os.path.join(docs_dir, os.path.relpath(root, input_dir)) + ensuredir(root_dir) + input_file = os.path.join(root, filename) + shutil.copy(input_file, root_dir) + + argv = ['-W', '-b', 'html', src_dir, '_build/html'] + + try: + os.chdir(docs_dir) + status = build_main(argv=argv) + finally: + os.chdir(start_dir) + + assert status == 0 diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index f0b1fff..2cab3ad 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -108,7 +108,7 @@ def find_mod_objs(modname, onlylocals=False): def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None): """Find out what items appear in autosummary:: directives in the given lines. - Returns a list of (name, toctree, template, inherited_members) + Returns a list of (name, toctree, template, inherited_members, noindex) where *name* is a name of an object and *toctree* the :toctree: path of the corresponding autosummary directive (relative to the root of the file name), @@ -133,12 +133,14 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$') inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$') no_inherited_members_arg_re = re.compile(r'^\s+:no-inherited-members:\s*$') + noindex_arg_re = re.compile(r'^\s+:noindex:\s*$') documented = [] toctree = None template = None inherited_members = None + noindex = None current_module = module in_autosummary = False base_indent = "" @@ -168,6 +170,11 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) inherited_members = False continue + m = noindex_arg_re.match(line) + if m: + noindex = True + continue + if line.strip().startswith(':'): warn(line) continue # skip options @@ -181,7 +188,7 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) not name.startswith(current_module + '.'): name = "%s.%s" % (current_module, name) documented.append((name, toctree, template, - inherited_members)) + inherited_members, noindex)) continue if not line.strip() or line.startswith(base_indent + " "): From c3339f5cfb6bf905660e0d2e203047e6a6cf5cd2 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 6 Jan 2023 17:40:54 +0100 Subject: [PATCH 025/115] Finalize change log for 0.15.0 --- CHANGES.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0d329c6..eb8213b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,10 +1,13 @@ Changes in sphinx-automodapi ============================ -0.15.0 (unreleased) +0.15.0 (2023-01-06) ------------------- -- Fixed issue with non-ascii characters in object members when the encoding is not ``utf8`` [#153] +- Fixed issue with non-ascii characters in object members when the encoding is + not ``utf8``. [#153] + +- Allow use of ``:noindex:``, propagating this flag to autodoc. [#150] 0.14.1 (2022-01-12) ------------------- From 3f3217741986179b027daf8f12efac8e48299768 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 6 Jan 2023 17:43:31 +0100 Subject: [PATCH 026/115] Pin tox<4 --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 4609281..d85c245 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -89,7 +89,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: choco install graphviz - name: Install tox - run: python -m pip install tox + run: python -m pip install tox<4 - name: Install codecov if: ${{ contains(matrix.toxenv,'-cov') }} run: python -m pip install codecov From 13d0033e51a75d8c2155684b6ae49e67e846592d Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 6 Jan 2023 17:44:59 +0100 Subject: [PATCH 027/115] Need quotes for pinned version --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index d85c245..9df00bb 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -89,7 +89,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: choco install graphviz - name: Install tox - run: python -m pip install tox<4 + run: python -m pip install "tox<4" - name: Install codecov if: ${{ contains(matrix.toxenv,'-cov') }} run: python -m pip install codecov From 0479bd44141aea00862632e868378363d1c682b0 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Fri, 20 Jan 2023 15:46:59 +0100 Subject: [PATCH 028/115] Updates for tox and sphinx (#157) * Updates for tox and sphinx * what a mess * Remove -W for tests * Ignore progress_message deprecation from Sphinx * Put -W back and see what happens * Bump workflow versions * No clocale for Windows * No longer need to ignore progress_message * Nope still need it * I don't care about Apple products Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --- .github/workflows/ci_workflows.yml | 28 +++++++++++++++++----------- setup.cfg | 3 +++ tox.ini | 7 +++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 9df00bb..30465d0 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -44,11 +44,17 @@ jobs: - os: ubuntu-latest python-version: '3.10' toxenv: py310-test-sphinxdev + - os: ubuntu-latest + python-version: '3.11' + toxenv: py310-test-sphinx53 + - os: ubuntu-latest + python-version: '3.11' + toxenv: py310-test-sphinx61 # MacOS X - just the oldest, stable, and dev - - os: macos-latest - python-version: 3.7 - toxenv: py37-test-sphinx24 + #- os: macos-latest + # python-version: 3.7 + # toxenv: py37-test-sphinx24 - os: macos-latest python-version: 3.8 toxenv: py38-test-sphinx43-clocale @@ -57,22 +63,22 @@ jobs: toxenv: py39-test-sphinxdev # Windows - just the oldest, stable, and dev - - os: windows-2019 + - os: windows-latest python-version: 3.7 toxenv: py37-test-sphinx24 - - os: windows-2019 + - os: windows-latest python-version: 3.8 - toxenv: py38-test-sphinx43-clocale - - os: windows-2019 + toxenv: py38-test-sphinx43 + - os: windows-latest python-version: 3.9 toxenv: py39-test-sphinxdev steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install graphviz on Linux @@ -89,7 +95,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: choco install graphviz - name: Install tox - run: python -m pip install "tox<4" + run: python -m pip install tox - name: Install codecov if: ${{ contains(matrix.toxenv,'-cov') }} run: python -m pip install codecov @@ -97,6 +103,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: file: ./coverage.xml diff --git a/setup.cfg b/setup.cfg index 4886f2c..e711d88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,9 @@ filterwarnings = ignore:'contextfunction' is renamed to 'pass_context':DeprecationWarning ignore:'environmentfilter' is renamed to 'pass_environment':DeprecationWarning ignore:distutils Version classes are deprecated:DeprecationWarning + ignore:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning + ignore:The alias 'sphinx\.util\.SkipProgressMessage' is deprecated + ignore:The alias 'sphinx\.util\.progress_message' is deprecated [flake8] max-line-length = 125 diff --git a/tox.ini b/tox.ini index b85e8ee..7e4c94a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310}-test-sphinx{24,35,40,41,42,43,dev}{,-cov}{-clocale,} +envlist = py{37,38,39,310,311}-test-sphinx{24,35,40,41,42,43,53,60,61,dev}{,-cov}{-clocale,} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -15,6 +15,9 @@ deps = sphinx41: sphinx==4.1.* sphinx42: sphinx==4.2.* sphinx43: sphinx==4.3.* + sphinx53: sphinx==5.3.* + sphinx60: sphinx==6.0.* + sphinx61: sphinx==6.1.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = test: test @@ -23,7 +26,7 @@ commands = !cov: pytest --pyargs sphinx_automodapi cov: pytest --pyargs sphinx_automodapi --cov sphinx_automodapi --cov-config={toxinidir}/setup.cfg {posargs} cov: coverage xml -o {toxinidir}/coverage.xml -passenv = HOME WINDIR LC_ALL LC_CTYPE LANG CC CI +passenv = HOME, WINDIR, LC_ALL, LC_CTYPE, LANG, CC, CI setenv = cov: CFLAGS = --coverage -fno-inline-functions -O0 clocale: LC_CTYPE=C From 5c322ad6fc911158f0f805506e3edf3b6b523070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sim=C3=A3o=20Afonso=20=40=20Powertools=20Tech?= Date: Tue, 31 Jan 2023 17:09:53 +0000 Subject: [PATCH 029/115] Silence spurious warning on autosummary config --- sphinx_automodapi/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 2cab3ad..57c68cd 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -134,6 +134,7 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$') no_inherited_members_arg_re = re.compile(r'^\s+:no-inherited-members:\s*$') noindex_arg_re = re.compile(r'^\s+:noindex:\s*$') + other_options_re = re.compile(r'^\s+:nosignatures:\s*$') documented = [] @@ -176,8 +177,10 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) continue if line.strip().startswith(':'): - warn(line) - continue # skip options + if other_options_re.match(line): + continue # skip known options + else: + warn(line) # warn about unknown options m = autosummary_item_re.match(line) if m: From c95784f5eb437bd4a270c72d6ddd289bfa22909c Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:13:08 -0500 Subject: [PATCH 030/115] Ignore DeprecationWarning Deprecated call to pkg_resources.declare_namespace('sphinxcontrib') --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index e711d88..bcc51c5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,6 +47,7 @@ filterwarnings = ignore:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning ignore:The alias 'sphinx\.util\.SkipProgressMessage' is deprecated ignore:The alias 'sphinx\.util\.progress_message' is deprecated + ignore:Deprecated call to.*pkg_resources\.declare_namespace:DeprecationWarning [flake8] max-line-length = 125 From 222a702d0fc02a262d63410c42b45bdb60ff46b1 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Mon, 13 Mar 2023 17:22:51 -0400 Subject: [PATCH 031/115] Preparing v0.15.0 release --- .github/workflows/publish.yml | 4 ++-- CHANGES.rst | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ab895a1..7ba5796 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,10 +13,10 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/CHANGES.rst b/CHANGES.rst index eb8213b..d5ec942 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,11 @@ Changes in sphinx-automodapi ============================ -0.15.0 (2023-01-06) +0.15.0 (2023-03-13) ------------------- +- Silenced spurious warnings on configuring ``:nosignatures:``. [#158] + - Fixed issue with non-ascii characters in object members when the encoding is not ``utf8``. [#153] From 56d85b75641eec172603cf82142fb7410a4cabb3 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Mon, 13 Mar 2023 17:25:40 -0400 Subject: [PATCH 032/115] Cancel duplicate CI workflow --- .github/workflows/ci_workflows.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 30465d0..ad69913 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -10,6 +10,10 @@ on: # Monthly cron - cron: '0 8 1 * *' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: runs-on: ${{ matrix.os }} From 8b2dbcfb19369e16795cbf628aa05457849f7837 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Mon, 13 Mar 2023 17:52:25 -0400 Subject: [PATCH 033/115] Back to dev: 0.16.dev [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d5ec942..2c321ff 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.16.0 (unreleased) +------------------- + 0.15.0 (2023-03-13) ------------------- From b1ee7f5247e279b5bde357fd0830cec261b5b32e Mon Sep 17 00:00:00 2001 From: Conor MacBride Date: Thu, 13 Apr 2023 22:54:28 +0100 Subject: [PATCH 034/115] Remove PyPI codecov --- .github/workflows/ci_workflows.yml | 3 --- setup.cfg | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index ad69913..9c7adc6 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -100,9 +100,6 @@ jobs: run: choco install graphviz - name: Install tox run: python -m pip install tox - - name: Install codecov - if: ${{ contains(matrix.toxenv,'-cov') }} - run: python -m pip install codecov - name: Run tox run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov diff --git a/setup.cfg b/setup.cfg index bcc51c5..db8e168 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,7 +27,6 @@ test = pytest pytest-cov cython - codecov coverage [options.package_data] From bea8587fc013226cea9ea56db63e0ea320527411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 13 Apr 2023 15:48:47 -0700 Subject: [PATCH 035/115] CI: don't cancel jobs with failure --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 9c7adc6..33f1199 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -18,7 +18,7 @@ jobs: tests: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: include: - name: Code style checks From 8ba873d1df33e298cdf6e09eaa874fb7da94ade3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 13 Apr 2023 15:52:14 -0700 Subject: [PATCH 036/115] CI: changing frequency of cron to be weekly --- .github/workflows/ci_workflows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 33f1199..d1b446d 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -7,8 +7,8 @@ on: tags: '*' workflow_dispatch: schedule: - # Monthly cron - - cron: '0 8 1 * *' + # Weekly cron + - cron: '0 8 * * 1' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 5e09fd5397434d41df06970a5b1f0699a49a44c2 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 13 Apr 2023 20:08:20 -0400 Subject: [PATCH 037/115] Ignore alabaster.css_t warning from https://github.com/sphinx-doc/alabaster/issues/203 --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index db8e168..1090973 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,6 +47,7 @@ filterwarnings = ignore:The alias 'sphinx\.util\.SkipProgressMessage' is deprecated ignore:The alias 'sphinx\.util\.progress_message' is deprecated ignore:Deprecated call to.*pkg_resources\.declare_namespace:DeprecationWarning + ignore:.*suffix for Jinja templates is deprecated [flake8] max-line-length = 125 From d7e4d80f879868dfcc631ccbde0cea22aecf5aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 19 Apr 2023 17:53:39 -0700 Subject: [PATCH 038/115] MAINT: ignoring pip deprecation issued for old pythons --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 1090973..b2013c0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,6 +48,8 @@ filterwarnings = ignore:The alias 'sphinx\.util\.progress_message' is deprecated ignore:Deprecated call to.*pkg_resources\.declare_namespace:DeprecationWarning ignore:.*suffix for Jinja templates is deprecated + # pip 23.1 issue: + ignore:pkg_resources is deprecated as an API:DeprecationWarning [flake8] max-line-length = 125 From ab7c9806188bff4efc27517085c9168d6c61f88e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Sat, 3 Jun 2023 15:12:44 -0400 Subject: [PATCH 039/115] Update .readthedocs.yml --- .readthedocs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 6ddecd0..8ebaf5e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,13 +4,17 @@ version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.11" + sphinx: builder: html configuration: docs/conf.py fail_on_warning: true python: - version: 3.8 install: - method: pip path: . From d494d380a3c8f09e64f1a3370e2fcf9beedf709f Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Sat, 3 Jun 2023 15:32:37 -0400 Subject: [PATCH 040/115] DOC: Fix RTD build --- .readthedocs.yml | 2 ++ setup.cfg | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 8ebaf5e..dcaaaba 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -18,6 +18,8 @@ python: install: - method: pip path: . + extra_requirements: + - rtd # Don't build any extra formats formats: [] diff --git a/setup.cfg b/setup.cfg index b2013c0..5d7a16b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,7 @@ zip_safe = False packages = find: python_requires = >=3.7 install_requires = - sphinx>=2 + sphinx>=4 [options.extras_require] test = @@ -28,6 +28,10 @@ test = pytest-cov cython coverage +rtd = + # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463 + sphinx<7 + sphinx-rtd-theme [options.package_data] sphinx_automodapi = templates/*/*.rst From 7c299aa39c2b97d90c57c57c6293f185d98325b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 14 Jun 2023 13:25:53 -0700 Subject: [PATCH 041/115] Fix: remove ignore of reverted deprecation --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5d7a16b..12774e1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,7 +51,6 @@ filterwarnings = ignore:The alias 'sphinx\.util\.SkipProgressMessage' is deprecated ignore:The alias 'sphinx\.util\.progress_message' is deprecated ignore:Deprecated call to.*pkg_resources\.declare_namespace:DeprecationWarning - ignore:.*suffix for Jinja templates is deprecated # pip 23.1 issue: ignore:pkg_resources is deprecated as an API:DeprecationWarning From 62ba0ae0f6111f4ff8563bc34bcf134c48fbe887 Mon Sep 17 00:00:00 2001 From: "Albert Y. Shih" Date: Wed, 9 Aug 2023 20:27:40 -0400 Subject: [PATCH 042/115] Accommodate newer Sphinx versions that use pathlib --- sphinx_automodapi/automodsumm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 10a71f6..06054ae 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -635,7 +635,7 @@ def get_members_class(obj, typ, include_public=[], # An important subtlety here is that the path we pass in has # to be relative to the file being generated, so we have to # figure out the right number of '..'s - ndirsback = path.replace(base_path, '').count(os.sep) + ndirsback = path.replace(str(base_path), '').count(os.sep) ref_file_rel_segments = ['..'] * ndirsback ref_file_rel_segments.append(mod_name_dir) ref_file_rel_segments.append('references.txt') From 5d6ab8138110fbb521d8b6e586ae13f1a7621759 Mon Sep 17 00:00:00 2001 From: "Albert Y. Shih" Date: Wed, 9 Aug 2023 18:37:42 -0400 Subject: [PATCH 043/115] Fix broken inheritance-diagram links due to the smart resolver --- sphinx_automodapi/automodsumm.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 06054ae..ec99ce8 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -90,7 +90,7 @@ class members that are inherited from a base class. This value can be from sphinx.util import logging from sphinx.ext.autosummary import Autosummary -from sphinx.ext.inheritance_diagram import InheritanceDiagram +from sphinx.ext.inheritance_diagram import InheritanceDiagram, InheritanceGraph, try_import from docutils.parsers.rst.directives import flag from .utils import find_mod_objs, cleanup_whitespace @@ -242,6 +242,33 @@ def run(self): self.arguments = oldargs +# sphinx.ext.inheritance_diagram generates a list of class full names and +# generates a mapping from class full names to documentation URLs. However, the +# smart resolver in sphinx-automodapi causes the generated mapping to be instead +# from class documented name to documentation URLs. The class documented name +# can be different from the class full name if the class is not documented where +# it is defined, but rather at some other location where it is imported. In +# such situations, the code will fail to find the URL that for the class. + +# The following code monkey-patches the method that receives the mapping and +# converts the keys from class documented names to class full names. + +old_generate_dot = InheritanceGraph.generate_dot + + +def patched_generate_dot(self, name, urls={}, env=None, + graph_attrs={}, node_attrs={}, edge_attrs={}): + # Make a new mapping dictionary that uses class full names by importing each + # class documented name + fullname_urls = {self.class_name(try_import(name), 0, None): url + for name, url in urls.items() if try_import(name) is not None} + return old_generate_dot(self, name, urls=fullname_urls, env=env, + graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs) + + +InheritanceGraph.generate_dot = patched_generate_dot + + # <---------------------automodsumm generation stuff--------------------------> def process_automodsumm_generation(app): env = app.builder.env From e9112338961959d4da354a8b9a89b70bc048d99e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 10 Aug 2023 11:53:14 -0400 Subject: [PATCH 044/115] TST: Update matrix --- .github/workflows/ci_workflows.yml | 44 +++++++++++------------------- tox.ini | 14 +++------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index d1b446d..c03a8b9 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -29,53 +29,41 @@ jobs: # Linux - test different Sphinx versions - os: ubuntu-latest python-version: 3.7 - toxenv: py37-test-sphinx24 + toxenv: py37-test-sphinx40 - os: ubuntu-latest python-version: 3.8 - toxenv: py38-test-sphinx35 - - os: ubuntu-latest - python-version: 3.8 - toxenv: py38-test-sphinx40 - - os: ubuntu-latest - python-version: 3.9 - toxenv: py39-test-sphinx41 + toxenv: py38-test-sphinx53 - os: ubuntu-latest python-version: 3.9 - toxenv: py39-test-sphinx42 + toxenv: py39-test-sphinx62 - os: ubuntu-latest python-version: '3.10' - toxenv: py310-test-sphinx43-cov-clocale - - os: ubuntu-latest - python-version: '3.10' - toxenv: py310-test-sphinxdev + toxenv: py310-test-sphinx70 - os: ubuntu-latest python-version: '3.11' - toxenv: py310-test-sphinx53 + toxenv: py311-test-sphinx71-cov-clocale - os: ubuntu-latest python-version: '3.11' - toxenv: py310-test-sphinx61 + toxenv: py311-test-sphinxdev - # MacOS X - just the oldest, stable, and dev - #- os: macos-latest - # python-version: 3.7 - # toxenv: py37-test-sphinx24 + # MacOS X - just the stable and dev - os: macos-latest - python-version: 3.8 - toxenv: py38-test-sphinx43-clocale + python-version: '3.10' + toxenv: py310-test-sphinx71-clocale - os: macos-latest - python-version: 3.9 - toxenv: py39-test-sphinxdev + python-version: '3.11' + toxenv: py311-test-sphinxdev # Windows - just the oldest, stable, and dev - os: windows-latest python-version: 3.7 - toxenv: py37-test-sphinx24 + toxenv: py37-test-sphinx40 - os: windows-latest - python-version: 3.8 - toxenv: py38-test-sphinx43 + python-version: '3.10' + toxenv: py310-test-sphinx71 - os: windows-latest - python-version: 3.9 - toxenv: py39-test-sphinxdev + python-version: '3.11' + toxenv: py311-test-sphinxdev steps: - uses: actions/checkout@v3 diff --git a/tox.ini b/tox.ini index 7e4c94a..f20571a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310,311}-test-sphinx{24,35,40,41,42,43,53,60,61,dev}{,-cov}{-clocale,} +envlist = py{37,38,39,310,311}-test-sphinx{40,53,62,70,71,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -7,17 +7,11 @@ isolated_build = true [testenv] changedir = .tmp/{envname} deps = - sphinx24: sphinx==2.4.* - sphinx24: Jinja2==3.0.3 - sphinx35: sphinx==3.5.* - sphinx35: Jinja2==3.0.3 sphinx40: sphinx==4.0.* - sphinx41: sphinx==4.1.* - sphinx42: sphinx==4.2.* - sphinx43: sphinx==4.3.* sphinx53: sphinx==5.3.* - sphinx60: sphinx==6.0.* - sphinx61: sphinx==6.1.* + sphinx62: sphinx==6.2.* + sphinx70: sphinx==7.0.* + sphinx71: sphinx==7.1.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = test: test From 2da9fb16483b5d07f4b06c5d5a8b25921bf2f112 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:34:34 -0400 Subject: [PATCH 045/115] Populate change log and update RTD config --- .readthedocs.yml | 4 ++++ CHANGES.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index dcaaaba..93f9723 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,6 +8,9 @@ build: os: ubuntu-22.04 tools: python: "3.11" + jobs: + post_checkout: + - git fetch --shallow-since=2023-01-01 || true sphinx: builder: html @@ -15,6 +18,7 @@ sphinx: fail_on_warning: true python: + system_packages: false install: - method: pip path: . diff --git a/CHANGES.rst b/CHANGES.rst index 2c321ff..035c19c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,10 @@ Changes in sphinx-automodapi 0.16.0 (unreleased) ------------------- +- Fixed broken inheritance-diagram links due to the smart resolver. [#172] + +- Minimum supported Sphinx version is now 4. [#170] + 0.15.0 (2023-03-13) ------------------- From 680bf31315f49d9caa16f121b8dde6e5a3a382a0 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:37:25 -0400 Subject: [PATCH 046/115] TST: Add Python 3.12 TST: Install setuptools for tests in Python 3.12 --- .github/workflows/ci_workflows.yml | 4 ++-- setup.cfg | 1 + tox.ini | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index c03a8b9..db355e4 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -43,8 +43,8 @@ jobs: python-version: '3.11' toxenv: py311-test-sphinx71-cov-clocale - os: ubuntu-latest - python-version: '3.11' - toxenv: py311-test-sphinxdev + python-version: '3.12-dev' + toxenv: py312-test-sphinxdev # MacOS X - just the stable and dev - os: macos-latest diff --git a/setup.cfg b/setup.cfg index 12774e1..efb9aaa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,6 +28,7 @@ test = pytest-cov cython coverage + setuptools;python_version>='3.12' rtd = # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463 sphinx<7 diff --git a/tox.ini b/tox.ini index f20571a..4ec899f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310,311}-test-sphinx{40,53,62,70,71,dev}{-cov}{-clocale} +envlist = py{37,38,39,310,311,312}-test-sphinx{40,53,62,70,71,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true From 2b660201e0fc5ff759718675b14e0aff24264d49 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:23:54 -0400 Subject: [PATCH 047/115] Finalizing change log for 0.16.0 --- CHANGES.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 035c19c..5f2d75d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,11 +1,13 @@ Changes in sphinx-automodapi ============================ -0.16.0 (unreleased) +0.16.0 (2023-08-17) ------------------- - Fixed broken inheritance-diagram links due to the smart resolver. [#172] +- Compatibility with Sphinx 7.2. [#172] + - Minimum supported Sphinx version is now 4. [#170] 0.15.0 (2023-03-13) From dc6b69fb132250ed50fad145024ae17723108a47 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:33:13 -0400 Subject: [PATCH 048/115] Back to dev: v0.17 [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 5f2d75d..0ae248c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.17.0 (unreleased) +------------------- + 0.16.0 (2023-08-17) ------------------- From 62fc358ac0b97d067100a277aec230d1e28cf83d Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:50:53 -0400 Subject: [PATCH 049/115] MNT: Drop Python 3.7 TST: Test against Sphinx 7.2 instead of 7.1 --- .github/workflows/ci_workflows.yml | 18 +++++++++--------- CHANGES.rst | 2 ++ setup.cfg | 2 +- tox.ini | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index db355e4..e6018c1 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -27,12 +27,12 @@ jobs: toxenv: codestyle # Linux - test different Sphinx versions - - os: ubuntu-latest - python-version: 3.7 - toxenv: py37-test-sphinx40 - os: ubuntu-latest python-version: 3.8 - toxenv: py38-test-sphinx53 + toxenv: py38-test-sphinx40 + - os: ubuntu-latest + python-version: 3.9 + toxenv: py39-test-sphinx53 - os: ubuntu-latest python-version: 3.9 toxenv: py39-test-sphinx62 @@ -41,7 +41,7 @@ jobs: toxenv: py310-test-sphinx70 - os: ubuntu-latest python-version: '3.11' - toxenv: py311-test-sphinx71-cov-clocale + toxenv: py311-test-sphinx72-cov-clocale - os: ubuntu-latest python-version: '3.12-dev' toxenv: py312-test-sphinxdev @@ -49,18 +49,18 @@ jobs: # MacOS X - just the stable and dev - os: macos-latest python-version: '3.10' - toxenv: py310-test-sphinx71-clocale + toxenv: py310-test-sphinx72-clocale - os: macos-latest python-version: '3.11' toxenv: py311-test-sphinxdev # Windows - just the oldest, stable, and dev - os: windows-latest - python-version: 3.7 - toxenv: py37-test-sphinx40 + python-version: 3.8 + toxenv: py38-test-sphinx40 - os: windows-latest python-version: '3.10' - toxenv: py310-test-sphinx71 + toxenv: py310-test-sphinx72 - os: windows-latest python-version: '3.11' toxenv: py311-test-sphinxdev diff --git a/CHANGES.rst b/CHANGES.rst index 0ae248c..f8bb685 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes in sphinx-automodapi 0.17.0 (unreleased) ------------------- +- Minimum supported Python version is now 3.8. [#177] + 0.16.0 (2023-08-17) ------------------- diff --git a/setup.cfg b/setup.cfg index efb9aaa..5a915e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,7 +18,7 @@ classifiers = [options] zip_safe = False packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = sphinx>=4 diff --git a/tox.ini b/tox.ini index 4ec899f..3387a0c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{37,38,39,310,311,312}-test-sphinx{40,53,62,70,71,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312}-test-sphinx{40,53,62,70,72,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -11,7 +11,7 @@ deps = sphinx53: sphinx==5.3.* sphinx62: sphinx==6.2.* sphinx70: sphinx==7.0.* - sphinx71: sphinx==7.1.* + sphinx72: sphinx==7.2.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = test: test From 2806ce1a042888ceff4181559ea8fbf2b01addd9 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:48:14 -0400 Subject: [PATCH 050/115] TST: Update matrix more --- .github/workflows/ci_workflows.yml | 6 +++--- tox.ini | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index e6018c1..8fa258c 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -32,13 +32,13 @@ jobs: toxenv: py38-test-sphinx40 - os: ubuntu-latest python-version: 3.9 - toxenv: py39-test-sphinx53 + toxenv: py39-test-sphinx62 - os: ubuntu-latest python-version: 3.9 - toxenv: py39-test-sphinx62 + toxenv: py39-test-sphinx70 - os: ubuntu-latest python-version: '3.10' - toxenv: py310-test-sphinx70 + toxenv: py310-test-sphinx71 - os: ubuntu-latest python-version: '3.11' toxenv: py311-test-sphinx72-cov-clocale diff --git a/tox.ini b/tox.ini index 3387a0c..b611583 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312}-test-sphinx{40,53,62,70,72,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312}-test-sphinx{40,62,70,71,72,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -7,10 +7,10 @@ isolated_build = true [testenv] changedir = .tmp/{envname} deps = - sphinx40: sphinx==4.0.* - sphinx53: sphinx==5.3.* + sphinx40: sphinx==4.0.0 sphinx62: sphinx==6.2.* sphinx70: sphinx==7.0.* + sphinx71: sphinx==7.1.* sphinx72: sphinx==7.2.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = From ff5233730a90d96cea9a071565a7c0d202d0d1ca Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:28:41 -0400 Subject: [PATCH 051/115] TST: Add back sphinx53 --- .github/workflows/ci_workflows.yml | 3 +++ tox.ini | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 8fa258c..9de9127 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -30,6 +30,9 @@ jobs: - os: ubuntu-latest python-version: 3.8 toxenv: py38-test-sphinx40 + - os: ubuntu-latest + python-version: 3.8 + toxenv: py38-test-sphinx53 - os: ubuntu-latest python-version: 3.9 toxenv: py39-test-sphinx62 diff --git a/tox.ini b/tox.ini index b611583..66f222f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312}-test-sphinx{40,62,70,71,72,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312}-test-sphinx{40,53,62,70,71,72,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -8,6 +8,7 @@ isolated_build = true changedir = .tmp/{envname} deps = sphinx40: sphinx==4.0.0 + sphinx53: sphinx==5.3.* sphinx62: sphinx==6.2.* sphinx70: sphinx==7.0.* sphinx71: sphinx==7.1.* From 8497ebcf8e70b262eefc3534dd03ffb74bb31971 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:43:32 -0400 Subject: [PATCH 052/115] TST: Use sphinx_oldest in tox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Brigitta Sipőcz --- .github/workflows/ci_workflows.yml | 2 +- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 9de9127..a968a0c 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -29,7 +29,7 @@ jobs: # Linux - test different Sphinx versions - os: ubuntu-latest python-version: 3.8 - toxenv: py38-test-sphinx40 + toxenv: py38-test-sphinx_oldest - os: ubuntu-latest python-version: 3.8 toxenv: py38-test-sphinx53 diff --git a/tox.ini b/tox.ini index 66f222f..12ca6fc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312}-test-sphinx{40,53,62,70,71,72,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312}-test-sphinx{_oldest,53,62,70,71,72,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -7,7 +7,7 @@ isolated_build = true [testenv] changedir = .tmp/{envname} deps = - sphinx40: sphinx==4.0.0 + sphinx_oldest: sphinx==4.0.0 sphinx53: sphinx==5.3.* sphinx62: sphinx==6.2.* sphinx70: sphinx==7.0.* From 9a65b219e436c6528215d55dd15252cfcdbec245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 28 Aug 2023 16:03:24 -0700 Subject: [PATCH 053/115] CI: fix environment name --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index a968a0c..5ed76b0 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -60,7 +60,7 @@ jobs: # Windows - just the oldest, stable, and dev - os: windows-latest python-version: 3.8 - toxenv: py38-test-sphinx40 + toxenv: py38-test-sphinx_oldest - os: windows-latest python-version: '3.10' toxenv: py310-test-sphinx72 From 8fc38e5f6302f06a4ed739aeddce349b128b9cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 29 Aug 2023 16:13:33 -0700 Subject: [PATCH 054/115] CI: remove deprecated/removed RTD config --- .readthedocs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 93f9723..c85d6b6 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -18,7 +18,6 @@ sphinx: fail_on_warning: true python: - system_packages: false install: - method: pip path: . From 426f441a3216c57088c6b4a692a66c95c11f9990 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:02:55 -0400 Subject: [PATCH 055/115] TST: Use Python 3.12 stable --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 5ed76b0..43da9d3 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -46,7 +46,7 @@ jobs: python-version: '3.11' toxenv: py311-test-sphinx72-cov-clocale - os: ubuntu-latest - python-version: '3.12-dev' + python-version: '3.12' toxenv: py312-test-sphinxdev # MacOS X - just the stable and dev From 0224f7b90136a8b23663530e62e272eb0744d37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 18 Dec 2023 22:10:51 -0800 Subject: [PATCH 056/115] CI: update actions' version --- .github/workflows/ci_workflows.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index a968a0c..8ce4d50 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -69,11 +69,11 @@ jobs: toxenv: py311-test-sphinxdev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install graphviz on Linux diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7ba5796..6d9d91f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,10 +13,10 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.8 From 3e25cc730927091f55a9a8213d4972e8c565df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 18 Dec 2023 22:12:44 -0800 Subject: [PATCH 057/115] CI: switch to use stable 3.12 --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 8ce4d50..002dcc7 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -46,7 +46,7 @@ jobs: python-version: '3.11' toxenv: py311-test-sphinx72-cov-clocale - os: ubuntu-latest - python-version: '3.12-dev' + python-version: '3.12' toxenv: py312-test-sphinxdev # MacOS X - just the stable and dev From af0d17afb4c0c45dd11872b7e221c2a1524a57a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 18 Dec 2023 22:23:42 -0800 Subject: [PATCH 058/115] CI: remove deprecated/removed RTD config --- .readthedocs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 93f9723..c85d6b6 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -18,7 +18,6 @@ sphinx: fail_on_warning: true python: - system_packages: false install: - method: pip path: . From 7c57ce13320e8b0448e75e4d8300748a914fa2cb Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:01:45 -0500 Subject: [PATCH 059/115] Create dependabot.yml [ci skip] --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e4a49c6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows" # Location of package manifests + schedule: + interval: "weekly" From 2a09c8033690279c6afbbd5164d768561b854cac Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Sat, 3 Jun 2023 20:21:26 +0200 Subject: [PATCH 060/115] Always use __dict__ and ignore __slots__ on classes --- sphinx_automodapi/automodsumm.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index ec99ce8..1677ba9 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -555,25 +555,11 @@ def get_members_class(obj, typ, include_public=[], items = [] # using dir gets all of the attributes, including the elements - # from the base class, otherwise use __slots__ or __dict__ + # from the base class, otherwise use __dict__ if include_base: names = dir(obj) else: - # Classes deriving from an ABC using the `abc` module will - # have an empty `__slots__` attribute in Python 3, unless - # other slots were declared along the inheritance chain. If - # the ABC-derived class has empty slots, we'll use the - # class `__dict__` instead. - declares_slots = ( - hasattr(obj, '__slots__') and - not (issubclass(type(obj), abc.ABCMeta) and - len(obj.__slots__) == 0) - ) - - if declares_slots: - names = tuple(getattr(obj, '__slots__')) - else: - names = getattr(obj, '__dict__').keys() + names = getattr(obj, '__dict__').keys() for name in names: try: From d5ae502fd904af3dbe92206ce9f08f014d9c896d Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Sat, 3 Jun 2023 21:22:38 +0200 Subject: [PATCH 061/115] abc module unused --- sphinx_automodapi/automodsumm.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 1677ba9..ecdd3fe 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -83,7 +83,6 @@ class members that are inherited from a base class. This value can be .. _sphinx.ext.inheritance_diagram: http://sphinx-doc.org/latest/ext/inheritance.html """ -import abc import inspect import os import re From 29ed8b48409f24d147784e7426d9f148fdd29a1d Mon Sep 17 00:00:00 2001 From: Kyle D Fawcett Date: Tue, 19 Dec 2023 10:33:00 -0500 Subject: [PATCH 062/115] TST: test classes that use __slots__ --- sphinx_automodapi/tests/cases/slots/README.md | 1 + .../tests/cases/slots/input/index.rst | 1 + ...ests.example_module.slots.DerivedParam.rst | 17 ++++ ....example_module.slots.DerivedSlotParam.rst | 27 ++++++ ...pi.tests.example_module.slots.SlotDict.rst | 27 ++++++ .../cases/slots/output/index.rst.automodapi | 19 ++++ .../cases/slots/output/index.rst.automodsumm | 8 ++ .../tests/example_module/slots.py | 91 +++++++++++++++++++ 8 files changed, 191 insertions(+) create mode 100644 sphinx_automodapi/tests/cases/slots/README.md create mode 100644 sphinx_automodapi/tests/cases/slots/input/index.rst create mode 100644 sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedParam.rst create mode 100644 sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst create mode 100644 sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst create mode 100644 sphinx_automodapi/tests/cases/slots/output/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/slots/output/index.rst.automodsumm create mode 100644 sphinx_automodapi/tests/example_module/slots.py diff --git a/sphinx_automodapi/tests/cases/slots/README.md b/sphinx_automodapi/tests/cases/slots/README.md new file mode 100644 index 0000000..1b95d31 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/README.md @@ -0,0 +1 @@ +Test classes that put attributes in `__slots__`. \ No newline at end of file diff --git a/sphinx_automodapi/tests/cases/slots/input/index.rst b/sphinx_automodapi/tests/cases/slots/input/index.rst new file mode 100644 index 0000000..fdf9586 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/input/index.rst @@ -0,0 +1 @@ +.. automodapi:: sphinx_automodapi.tests.example_module.slots diff --git a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedParam.rst b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedParam.rst new file mode 100644 index 0000000..bf65bf4 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedParam.rst @@ -0,0 +1,17 @@ +DerivedParam +============ + +.. currentmodule:: sphinx_automodapi.tests.example_module.slots + +.. autoclass:: DerivedParam + :show-inheritance: + + .. rubric:: Methods Summary + + .. autosummary:: + + ~DerivedParam.derived_from_slot_class_method + + .. rubric:: Methods Documentation + + .. automethod:: derived_from_slot_class_method diff --git a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst new file mode 100644 index 0000000..cfe6df9 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst @@ -0,0 +1,27 @@ +DerivedSlotParam +================ + +.. currentmodule:: sphinx_automodapi.tests.example_module.slots + +.. autoclass:: DerivedSlotParam + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~DerivedSlotParam.extra_param + + .. rubric:: Methods Summary + + .. autosummary:: + + ~DerivedSlotParam.derived_from_slot_class_method + + .. rubric:: Attributes Documentation + + .. autoattribute:: extra_param + + .. rubric:: Methods Documentation + + .. automethod:: derived_from_slot_class_method diff --git a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst new file mode 100644 index 0000000..4db68a8 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst @@ -0,0 +1,27 @@ +SlotDict +======== + +.. currentmodule:: sphinx_automodapi.tests.example_module.slots + +.. autoclass:: SlotDict + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~SlotDict.param + + .. rubric:: Methods Summary + + .. autosummary:: + + ~SlotDict.my_method + + .. rubric:: Attributes Documentation + + .. autoattribute:: param + + .. rubric:: Methods Documentation + + .. automethod:: my_method diff --git a/sphinx_automodapi/tests/cases/slots/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/slots/output/index.rst.automodapi new file mode 100644 index 0000000..487ab9f --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/output/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.slots Module +--------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.slots + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.slots + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.slots + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/slots/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/slots/output/index.rst.automodsumm new file mode 100644 index 0000000..83b7aa7 --- /dev/null +++ b/sphinx_automodapi/tests/cases/slots/output/index.rst.automodsumm @@ -0,0 +1,8 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.slots + +.. autosummary:: + :toctree: api + + SlotDict + DerivedParam + DerivedSlotParam diff --git a/sphinx_automodapi/tests/example_module/slots.py b/sphinx_automodapi/tests/example_module/slots.py new file mode 100644 index 0000000..8e6e95a --- /dev/null +++ b/sphinx_automodapi/tests/example_module/slots.py @@ -0,0 +1,91 @@ +"""Test classes containing slots""" +from __future__ import annotations + +__all__ = ['SlotDict', 'DerivedParam', 'DerivedSlotParam',] + + +class SlotDict(object): + """ + A class that uses __slots__ and __dict__ for its attribute namespace. + """ + __slots__ = ('param', '__dict__',) + + def __init__(self, param: str, other_param: str): + """ + Initializes a SlotDict object. + + Parameters + ---------- + my_param : str + My parameter + """ + self.param = param + self.other_param = other_param + + def my_method(self): + """ + Prints the class's parameters. + """ + print(f"param: {self.param}") + print(f"other_param: {self.other_param}") + + +class DerivedParam(SlotDict): + """ + Extends SlotDict by adding an extra parameter + """ + def __init__(self, param: str, other_param: str, extra_param: str): + """ + Initializes a DerivedParam object. + + Parameters + ---------- + param : str + A parameter + other_param : str + Another parameter + extra_param : str + An extra parameter + """ + super(DerivedParam, self).__init__(param, other_param) + self.extra_param = extra_param + + def derived_from_slot_class_method(self): + """ + Prints the DerivedParam parameters. + """ + print(f"param: {self.param}") + print(f"other_param: {self.other_param}") + print(f"dict_param: {self.extra_param}") + + +class DerivedSlotParam(SlotDict): + """ + Extends SlotDict by adding a slot parameter + """ + + __slots__ = ('extra_param',) + + def __init__(self, param: str, other_param: str, extra_param: str): + """ + Initializes a DerivedParam object. + + Parameters + ---------- + param : str + A parameter + other_param : str + Another parameter + extra_param : str + An extra parameter + """ + super(DerivedSlotParam, self).__init__(param, other_param) + self.extra_param = extra_param + + def derived_from_slot_class_method(self): + """ + Prints the DerivedParam parameters. + """ + print(f"param: {self.param}") + print(f"other_param: {self.other_param}") + print(f"extra_param: {self.extra_param}") From 472cd4a36ebea845fc37c36e286de01ee6a08ee6 Mon Sep 17 00:00:00 2001 From: Kyle D Fawcett Date: Tue, 19 Dec 2023 13:05:43 -0500 Subject: [PATCH 063/115] update change log --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index f8bb685..86a0ec7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes in sphinx-automodapi 0.17.0 (unreleased) ------------------- +- Fixes fixes issue where ``__slots__`` hides class variables [#168] + - Minimum supported Python version is now 3.8. [#177] 0.16.0 (2023-08-17) From e00be6f0d64d23f1176fcd075ef35141b21d5181 Mon Sep 17 00:00:00 2001 From: kylefawcett <45832007+kylefawcett@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:55:29 -0500 Subject: [PATCH 064/115] Update CHANGES.rst Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 86a0ec7..a7a3e75 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Changes in sphinx-automodapi 0.17.0 (unreleased) ------------------- -- Fixes fixes issue where ``__slots__`` hides class variables [#168] +- Fixes fixes issue where ``__slots__`` hides class variables [#181] - Minimum supported Python version is now 3.8. [#177] From fc31e65cb7ac1def2269690487fc1def3734d6af Mon Sep 17 00:00:00 2001 From: Kyle D Fawcett Date: Thu, 21 Dec 2023 14:31:42 -0500 Subject: [PATCH 065/115] make slots example more consistent with python nomenclature --- ....example_module.slots.DerivedSlotParam.rst | 4 +- ...pi.tests.example_module.slots.SlotDict.rst | 6 +- .../tests/example_module/slots.py | 65 +++++++++++++------ 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst index cfe6df9..3a2438c 100644 --- a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst +++ b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.DerivedSlotParam.rst @@ -10,7 +10,7 @@ DerivedSlotParam .. autosummary:: - ~DerivedSlotParam.extra_param + ~DerivedSlotParam.extra_attr .. rubric:: Methods Summary @@ -20,7 +20,7 @@ DerivedSlotParam .. rubric:: Attributes Documentation - .. autoattribute:: extra_param + .. autoattribute:: extra_attr .. rubric:: Methods Documentation diff --git a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst index 4db68a8..ccdf348 100644 --- a/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst +++ b/sphinx_automodapi/tests/cases/slots/output/api/sphinx_automodapi.tests.example_module.slots.SlotDict.rst @@ -10,7 +10,8 @@ SlotDict .. autosummary:: - ~SlotDict.param + ~SlotDict.class_attr + ~SlotDict.instance_attr .. rubric:: Methods Summary @@ -20,7 +21,8 @@ SlotDict .. rubric:: Attributes Documentation - .. autoattribute:: param + .. autoattribute:: class_attr + .. autoattribute:: instance_attr .. rubric:: Methods Documentation diff --git a/sphinx_automodapi/tests/example_module/slots.py b/sphinx_automodapi/tests/example_module/slots.py index 8e6e95a..ee9e0fd 100644 --- a/sphinx_automodapi/tests/example_module/slots.py +++ b/sphinx_automodapi/tests/example_module/slots.py @@ -1,4 +1,12 @@ -"""Test classes containing slots""" +"""Test classes containing __slots__ + +Instance attributes named in ``__slots__`` can be introspected and are listed +in the Attributes section of the class documentation. Class attributes are +listed in the same section of the generated docs so docstrings should be used +to distinguish class attributes vs instance attributes. Regular instance +attributes are dynamically inserted into ``__dict__`` and cannot be reliably +introspected so they're not included in the documentation. +""" from __future__ import annotations __all__ = ['SlotDict', 'DerivedParam', 'DerivedSlotParam',] @@ -8,7 +16,13 @@ class SlotDict(object): """ A class that uses __slots__ and __dict__ for its attribute namespace. """ - __slots__ = ('param', '__dict__',) + __slots__ = { + "instance_attr": "instance attribute docstring can be added here", + "__dict__": None, # Allows additional instance attributes to be added + } + + class_attr = "class attribute value" + """(class attr) this is a class attribute.""" def __init__(self, param: str, other_param: str): """ @@ -16,18 +30,29 @@ def __init__(self, param: str, other_param: str): Parameters ---------- - my_param : str - My parameter + param : str + A parameter + other_param : str + Another parameter """ - self.param = param - self.other_param = other_param + + self.instance_attr = param + """Instance attributes declared in slots can also define their docstring + here + """ + + if other_param is not None: + self.other_attr = other_param + """This instance attribute is dynamic (not declared in a slot) so + it's not included in the docs + """ def my_method(self): """ - Prints the class's parameters. + Prints the SlotDict parameters. """ - print(f"param: {self.param}") - print(f"other_param: {self.other_param}") + print(f"instance_attr: {self.instance_attr}") + print(f"other_attr: {self.other_attr}") class DerivedParam(SlotDict): @@ -48,15 +73,15 @@ def __init__(self, param: str, other_param: str, extra_param: str): An extra parameter """ super(DerivedParam, self).__init__(param, other_param) - self.extra_param = extra_param + self.extra_attr = extra_param def derived_from_slot_class_method(self): """ Prints the DerivedParam parameters. """ - print(f"param: {self.param}") - print(f"other_param: {self.other_param}") - print(f"dict_param: {self.extra_param}") + print(f"instance_attr: {self.instance_attr}") + print(f"other_attr: {self.other_attr}") + print(f"extra_attr: {self.extra_attr}") class DerivedSlotParam(SlotDict): @@ -64,11 +89,11 @@ class DerivedSlotParam(SlotDict): Extends SlotDict by adding a slot parameter """ - __slots__ = ('extra_param',) + __slots__ = ('extra_attr',) def __init__(self, param: str, other_param: str, extra_param: str): """ - Initializes a DerivedParam object. + Initializes a DerivedSlotParam object. Parameters ---------- @@ -80,12 +105,12 @@ def __init__(self, param: str, other_param: str, extra_param: str): An extra parameter """ super(DerivedSlotParam, self).__init__(param, other_param) - self.extra_param = extra_param + self.extra_attr = extra_param def derived_from_slot_class_method(self): """ - Prints the DerivedParam parameters. + Prints the DerivedSlotParam parameters. """ - print(f"param: {self.param}") - print(f"other_param: {self.other_param}") - print(f"extra_param: {self.extra_param}") + print(f"instance_attr: {self.instance_attr}") + print(f"other_attr: {self.other_attr}") + print(f"extra_attr: {self.extra_attr}") From d58f35ff6d8f083aa07cfc656768bd3f24de7636 Mon Sep 17 00:00:00 2001 From: Kyle D Fawcett Date: Thu, 21 Dec 2023 14:33:13 -0500 Subject: [PATCH 066/115] TST: add basic coverage test for slots example --- sphinx_automodapi/tests/test_cases.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sphinx_automodapi/tests/test_cases.py b/sphinx_automodapi/tests/test_cases.py index 63b0171..0ffa4c8 100644 --- a/sphinx_automodapi/tests/test_cases.py +++ b/sphinx_automodapi/tests/test_cases.py @@ -140,3 +140,13 @@ def test_duplicated_warning(tmpdir): os.chdir(start_dir) assert status == 0 + + +def test_slots_example(): + """Basic tests for slots example module""" + from sphinx_automodapi.tests.example_module.slots import ( + SlotDict, DerivedParam, DerivedSlotParam + ) + SlotDict('param', 'other_param').my_method() + DerivedParam('param', 'other_param', 'extra_param').derived_from_slot_class_method() + DerivedSlotParam('param', 'other_param', 'extra_param').derived_from_slot_class_method() From 5904a172dd457b113b8067902a29d44a768f68f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 26 Jan 2024 19:52:38 -0800 Subject: [PATCH 067/115] DOC: fixup changelog --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a7a3e75..0e98011 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Changes in sphinx-automodapi 0.17.0 (unreleased) ------------------- -- Fixes fixes issue where ``__slots__`` hides class variables [#181] +- Fixes issue where ``__slots__`` hides class variables. [#181] - Minimum supported Python version is now 3.8. [#177] From 033e0070bd982868a9f9fe1245182571dd4d1b64 Mon Sep 17 00:00:00 2001 From: Luke Davis Date: Sun, 24 May 2020 19:18:20 -0600 Subject: [PATCH 068/115] Add automodsumm_included_members option --- sphinx_automodapi/automodapi.py | 8 +++++++- sphinx_automodapi/automodsumm.py | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index a6cd719..f216bf9 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -68,7 +68,7 @@ objects warnings. -This extension also adds four sphinx configuration options: +This extension also adds five sphinx configuration options: * ``automodapi_inheritance_diagram`` Should be a boolean that indicates whether to show inheritance diagrams @@ -93,6 +93,12 @@ Should be a bool and if ``True`` members that a class inherits from a base class are included in the generated documentation. Defaults to ``False``. +* ``automodsumm_included_members`` + A list of strings containing the names of hidden class members that should be + included in the documentation. This is most commonly used to add special class + methods like ``__getitem__`` and ``__setitem__``. Defaults to + ``['__init__', '__call__']``. + .. _automodule: http://sphinx-doc.org/latest/ext/autodoc.html?highlight=automodule#directive-automodule """ diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index ecdd3fe..b927a16 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -46,7 +46,7 @@ in the generated documentation. The flags ``:inherited-members:`` or ``:no-inherited-members:`` allows overrriding this global setting. -This extension also adds two sphinx configuration options: +This extension also adds three sphinx configuration options: * ``automodsumm_writereprocessed`` Should be a bool, and if ``True``, will cause `automodsumm`_ to write files @@ -62,6 +62,12 @@ class members that are inherited from a base class. This value can be ``:inherited-members:`` or ``:no-inherited-members:`` options. Defaults to ``False``. +* ``automodsumm_included_members`` + A list of strings containing the names of hidden class members that should be + included in the documentation. This is most commonly used to add special class + methods like ``__getitem__`` and ``__setitem__``. Defaults to + ``['__init__', '__call__']``. + .. _sphinx.ext.autosummary: http://sphinx-doc.org/latest/ext/autosummary.html .. _autosummary: http://sphinx-doc.org/latest/ext/autosummary.html#directive-autosummary @@ -295,7 +301,8 @@ def process_automodsumm_generation(app): generate_automodsumm_docs( lines, sfn, app=app, builder=app.builder, base_path=app.srcdir, - inherited_members=app.config.automodsumm_inherited_members) + inherited_members=app.config.automodsumm_inherited_members, + included_members=app.config.automodsumm_included_members) # _automodsummrex = re.compile(r'^(\s*)\.\. automodsumm::\s*([A-Za-z0-9_.]+)\s*' @@ -432,7 +439,8 @@ def automodsumm_to_autosummary_lines(fn, app): def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst', base_path=None, builder=None, template_dir=None, - inherited_members=False): + inherited_members=False, + included_members=('__init__', '__call__')): """ This function is adapted from `sphinx.ext.autosummary.generate.generate_autosummmary_docs` to @@ -593,11 +601,10 @@ def get_members_class(obj, typ, include_public=[], # use default value include_base = inherited_members - api_class_methods = ['__init__', '__call__'] ns['members'] = get_members_class(obj, None, include_base=include_base) ns['methods'], ns['all_methods'] = \ - get_members_class(obj, 'method', api_class_methods, + get_members_class(obj, 'method', included_members, include_base=include_base) ns['attributes'], ns['all_attributes'] = \ get_members_class(obj, 'attribute', @@ -676,6 +683,8 @@ def setup(app): app.add_config_value('automodsumm_writereprocessed', False, True) app.add_config_value('automodsumm_inherited_members', False, 'env') + app.add_config_value( + 'automodsumm_included_members', ['__init__', '__call__'], 'env') return {'parallel_read_safe': True, 'parallel_write_safe': True} From 25b3e5f07becbcd8fce94d19373f765fbc59dab2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 05:30:26 +0000 Subject: [PATCH 069/115] Bump codecov/codecov-action from 3 to 4 in /.github/workflows Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index db70579..47100e6 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -95,6 +95,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml From bb6d65ee942068eba79076cccf7861110d9c6007 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Wed, 14 Feb 2024 13:40:18 +0100 Subject: [PATCH 070/115] Fix nonascii object names --- ...ascii.NonAscii\303\204\303\266\303\274\303\237.rst" | 10 +++++----- .../tests/cases/non_ascii/output/index.rst.automodsumm | 2 +- sphinx_automodapi/tests/example_module/nonascii.py | 4 ++-- sphinx_automodapi/utils.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) rename sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst => "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" (65%) diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" similarity index 65% rename from sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst rename to "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" index 1ea0c55..f4e8056 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst +++ "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" @@ -1,17 +1,17 @@ -NonAscii -======== +NonAsciiÄöüß +============ .. currentmodule:: sphinx_automodapi.tests.example_module.nonascii -.. autoclass:: NonAscii +.. autoclass:: NonAsciiÄöüß :show-inheritance: .. rubric:: Methods Summary .. autosummary:: - ~NonAscii.get_ß - ~NonAscii.get_äöü + ~NonAsciiÄöüß.get_ß + ~NonAsciiÄöüß.get_äöü .. rubric:: Methods Documentation diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index fb4ef02..d0cc103 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -11,5 +11,5 @@ .. autosummary:: :toctree: api - NonAscii + NonAsciiÄöüß diff --git a/sphinx_automodapi/tests/example_module/nonascii.py b/sphinx_automodapi/tests/example_module/nonascii.py index ccded8e..7fa4f1a 100644 --- a/sphinx_automodapi/tests/example_module/nonascii.py +++ b/sphinx_automodapi/tests/example_module/nonascii.py @@ -1,7 +1,7 @@ -__all__ = ['NonAscii'] +__all__ = ['NonAsciiÄöüß'] -class NonAscii(object): +class NonAsciiÄöüß(object): def get_äöü(self): """ Return a string with common umlauts like äöüß diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 57c68cd..4512cf9 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -125,10 +125,10 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) """ autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*') automodule_re = re.compile( - r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$') + r'^\s*\.\.\s+automodule::\s*([A-Za-zäüöÄÜÖß0-9_.]+)\s*$') module_re = re.compile( - r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$') - autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?') + r'^\s*\.\.\s+(current)?module::\s*([a-zA-ZäüöÄÜÖß0-9_.]+)\s*$') + autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-ZäüöÄÜÖß][a-zA-ZäüöÄÜÖß0-9_.]*)\s*.*?') toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$') template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$') inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$') From 511f6de231fe298d9d48e21271cf10cfe577a1d8 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Wed, 14 Feb 2024 14:07:52 +0100 Subject: [PATCH 071/115] Set another open dialog with encoding utf8 to try to fix errors on Windows --- sphinx_automodapi/automodsumm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index b927a16..323c184 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -291,7 +291,7 @@ def process_automodsumm_generation(app): if app.config.automodsumm_writereprocessed: if lines: # empty list means no automodsumm entry is in the file outfn = os.path.join(app.srcdir, sfn) + '.automodsumm' - with open(outfn, 'w') as f: + with open(outfn, 'w', encoding='utf8') as f: for l in lines: # noqa: E741 f.write(l) f.write('\n') From f111d36fef67feb8780e384d454a9018666a2ed5 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Wed, 14 Feb 2024 19:59:59 +0100 Subject: [PATCH 072/115] Update changelog --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 0e98011..ade6af6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,8 @@ Changes in sphinx-automodapi - Minimum supported Python version is now 3.8. [#177] +- Fixed issue with non-ascii characters in object names [#184] + 0.16.0 (2023-08-17) ------------------- From 4d78a2cf5b96c3edb1afd1862e95abd325b47fed Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:11:53 -0500 Subject: [PATCH 073/115] Add period at the end of sentence --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index ade6af6..38427f1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,7 @@ Changes in sphinx-automodapi - Minimum supported Python version is now 3.8. [#177] -- Fixed issue with non-ascii characters in object names [#184] +- Fixed issue with non-ascii characters in object names. [#184] 0.16.0 (2023-08-17) ------------------- From 5cb1818309dc54d3680f0474dac96faa1700bb72 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Thu, 15 Feb 2024 08:27:39 +0100 Subject: [PATCH 074/115] Ensure @bsipocz name is handled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Brigitta Sipőcz --- ...ascii.NonAscii\303\204\303\266\303\274\303\237.rst" | 10 +++++----- .../tests/cases/non_ascii/output/index.rst.automodsumm | 2 +- sphinx_automodapi/tests/example_module/nonascii.py | 4 ++-- sphinx_automodapi/utils.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git "a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" index f4e8056..caab61b 100644 --- "a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" +++ "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" @@ -1,17 +1,17 @@ -NonAsciiÄöüß -============ +NonAsciiÄöüßő +============= .. currentmodule:: sphinx_automodapi.tests.example_module.nonascii -.. autoclass:: NonAsciiÄöüß +.. autoclass:: NonAsciiÄöüßő :show-inheritance: .. rubric:: Methods Summary .. autosummary:: - ~NonAsciiÄöüß.get_ß - ~NonAsciiÄöüß.get_äöü + ~NonAsciiÄöüßő.get_ß + ~NonAsciiÄöüßő.get_äöü .. rubric:: Methods Documentation diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index d0cc103..1d99fca 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -11,5 +11,5 @@ .. autosummary:: :toctree: api - NonAsciiÄöüß + NonAsciiÄöüßő diff --git a/sphinx_automodapi/tests/example_module/nonascii.py b/sphinx_automodapi/tests/example_module/nonascii.py index 7fa4f1a..4928b78 100644 --- a/sphinx_automodapi/tests/example_module/nonascii.py +++ b/sphinx_automodapi/tests/example_module/nonascii.py @@ -1,7 +1,7 @@ -__all__ = ['NonAsciiÄöüß'] +__all__ = ['NonAsciiÄöüßő'] -class NonAsciiÄöüß(object): +class NonAsciiÄöüßő(object): def get_äöü(self): """ Return a string with common umlauts like äöüß diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 4512cf9..6934124 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -125,10 +125,10 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) """ autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*') automodule_re = re.compile( - r'^\s*\.\.\s+automodule::\s*([A-Za-zäüöÄÜÖß0-9_.]+)\s*$') + r'^\s*\.\.\s+automodule::\s*([A-Za-zäüöÄÜÖßő0-9_.]+)\s*$') module_re = re.compile( - r'^\s*\.\.\s+(current)?module::\s*([a-zA-ZäüöÄÜÖß0-9_.]+)\s*$') - autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-ZäüöÄÜÖß][a-zA-ZäüöÄÜÖß0-9_.]*)\s*.*?') + r'^\s*\.\.\s+(current)?module::\s*([a-zA-ZäüöÄÜÖßő0-9_.]+)\s*$') + autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-ZäüöÄÜÖßő][a-zA-ZäüöÄÜÖßő0-9_.]*)\s*.*?') toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$') template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$') inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$') From 5ab68d0d3f5c90bb1fd2b260e457ae7ba2091226 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Thu, 15 Feb 2024 08:37:37 +0100 Subject: [PATCH 075/115] Also update filename --- ...nonascii.NonAscii\303\204\303\266\303\274\303\237\305\221.rst" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" => "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237\305\221.rst" (100%) diff --git "a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237\305\221.rst" similarity index 100% rename from "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" rename to "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237\305\221.rst" From e5cb71b9b5a33d4fe26e2b9fe7130577bbff2207 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:57:16 -0500 Subject: [PATCH 076/115] Finalize change log for 0.17.0 --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 38427f1..da9365a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changes in sphinx-automodapi ============================ -0.17.0 (unreleased) +0.17.0 (2024-02-22) ------------------- - Fixes issue where ``__slots__`` hides class variables. [#181] From a2218c6493fc15435b938ba8c45e4dbe4bc9f42c Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:28:15 -0500 Subject: [PATCH 077/115] Back to dev: v0.18.dev [ci skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index da9365a..6c0ca46 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.18.0 (unreleased) +------------------- + 0.17.0 (2024-02-22) ------------------- From 9f5f57d20516e6a498e10f317583787e8b0ab31e Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:31:01 -0500 Subject: [PATCH 078/115] Create check_milestone.yml [ci skip] --- .github/workflows/check_milestone.yml | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/check_milestone.yml diff --git a/.github/workflows/check_milestone.yml b/.github/workflows/check_milestone.yml new file mode 100644 index 0000000..2a6bf44 --- /dev/null +++ b/.github/workflows/check_milestone.yml @@ -0,0 +1,34 @@ +name: Check PR milestone + +on: + # So it cannot be skipped. + pull_request_target: + types: [opened, synchronize, milestoned, demilestoned] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + # https://stackoverflow.com/questions/69434370/how-can-i-get-the-latest-pr-data-specifically-milestones-when-running-yaml-jobs + milestone_checker: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + if: github.repository == 'astropy/sphinx-automodapi' + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { data } = await github.request("GET /repos/{owner}/{repo}/pulls/{pr}", { + owner: context.repo.owner, + repo: context.repo.repo, + pr: context.payload.pull_request.number + }); + if (data.milestone) { + core.info(`This pull request has a milestone set: ${data.milestone.title}`); + } else { + core.setFailed(`A maintainer needs to set the milestone for this pull request.`); + } From e7c3b5c620b28eaef711692335d481e097f2dfc4 Mon Sep 17 00:00:00 2001 From: Nathaniel Starkman Date: Mon, 22 Apr 2024 11:50:57 -0400 Subject: [PATCH 079/115] Add sort option to automodsumm (#182) * Add sort option to automodsumm * address review comments * improve import * test * Ensure sort is done also in automodsumm file writing --------- Signed-off-by: nstarman Co-authored-by: Marten Henric van Kerkwijk --- sphinx_automodapi/automodapi.py | 10 +++++ sphinx_automodapi/automodsumm.py | 18 ++++++-- sphinx_automodapi/tests/test_automodsumm.py | 48 +++++++++++++++++++++ sphinx_automodapi/utils.py | 11 +++-- 4 files changed, 79 insertions(+), 8 deletions(-) diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index f216bf9..eae0803 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -67,6 +67,11 @@ Propagates the ``noindex`` flag to autodoc. Use it to avoid duplicate objects warnings. + * ``:sort:`` + If the module contains ``__all__``, sort the module's objects + alphabetically (if ``__all__`` is not present, the objects are found + using `dir`, which always gives a sorted list). + This extension also adds five sphinx configuration options: @@ -250,6 +255,7 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, allowedpkgnms = [] allowothers = False noindex = False + sort = False # look for actual options unknownops = [] @@ -279,6 +285,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, allowothers = True elif opname == 'noindex': noindex = True + elif opname == 'sort': + sort = True else: unknownops.append(opname) @@ -336,6 +344,8 @@ def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, clsfuncoptions.append(toctreestr) if noindex: clsfuncoptions.append(':noindex:') + if sort: + clsfuncoptions.append(':sort:') if toskip: clsfuncoptions.append(':skip: ' + ','.join(toskip)) if allowedpkgnms: diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 323c184..2ddb478 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -46,6 +46,12 @@ in the generated documentation. The flags ``:inherited-members:`` or ``:no-inherited-members:`` allows overrriding this global setting. + * ``:sort:`` + If the module contains ``__all__``, sort the module's objects + alphabetically (if ``__all__`` is not present, the objects are found + using `dir`, which always gives a sorted list). + + This extension also adds three sphinx configuration options: * ``automodsumm_writereprocessed`` @@ -130,6 +136,7 @@ class Automodsumm(Autosummary): option_spec['inherited-members'] = flag option_spec['no-inherited-members'] = flag option_spec['noindex'] = flag + option_spec['sort'] = flag def run(self): env = self.state.document.settings.env @@ -138,7 +145,7 @@ def run(self): nodelist = [] try: - localnames, fqns, objs = find_mod_objs(modname) + localnames, fqns, objs = find_mod_objs(modname, sort='sort' in self.options) except ImportError: logger.warning("Couldn't import module " + modname) return [] @@ -380,12 +387,12 @@ def automodsumm_to_autosummary_lines(fn, app): opssecs, remainders)): allindent = i1 + (' ' if i2 is None else i2) - # filter out functions-only, classes-only, and ariables-only + # filter out functions-only, classes-only, variables-only, and sort # options if present. oplines = ops.split('\n') toskip = [] allowedpkgnms = [] - funcsonly = clssonly = varsonly = False + funcsonly = clssonly = varsonly = sort = False for i, ln in reversed(list(enumerate(oplines))): if ':functions-only:' in ln: funcsonly = True @@ -402,6 +409,9 @@ def automodsumm_to_autosummary_lines(fn, app): if ':allowed-package-names:' in ln: allowedpkgnms.extend(_str_list_converter(ln.replace(':allowed-package-names:', ''))) del oplines[i] + if ':sort:' in ln: + sort = True + del oplines[i] if [funcsonly, clssonly, varsonly].count(True) > 1: msg = ('Defined more than one of functions-only, classes-only, ' 'and variables-only. Skipping this directive.') @@ -419,7 +429,7 @@ def automodsumm_to_autosummary_lines(fn, app): newlines.extend(oplines) ols = True if len(allowedpkgnms) == 0 else allowedpkgnms - for nm, fqn, obj in zip(*find_mod_objs(modnm, onlylocals=ols)): + for nm, fqn, obj in zip(*find_mod_objs(modnm, onlylocals=ols, sort=sort)): if nm in toskip: continue if funcsonly and not inspect.isroutine(obj): diff --git a/sphinx_automodapi/tests/test_automodsumm.py b/sphinx_automodapi/tests/test_automodsumm.py index fe14e9f..3922faa 100644 --- a/sphinx_automodapi/tests/test_automodsumm.py +++ b/sphinx_automodapi/tests/test_automodsumm.py @@ -201,3 +201,51 @@ def test_ams_cython(tmpdir, cython_testpackage): # noqa result = f.read() assert result == ams_cython_expected + + +# ============================================================================= + +CLASS_RST = """ +:orphan: + +.. currentmodule:: {mod} + +.. autoclass:: {cls} +""".strip() + +sorted_str = """ +Before + +.. automodsumm:: sphinx_automodapi.tests.example_module.classes + :sort: + +And After +""" + +sorted_expected = """\ +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autosummary:: + + Egg + Spam + +""" + + +def test_sort(tmpdir): + with open(tmpdir.join("index.rst").strpath, "w") as f: + f.write(sorted_str) + + apidir = tmpdir.mkdir('api') + mod = 'sphinx_automodapi.tests.example_module.classes' + for cls in "Spam", "Egg": + with open(apidir.join(f'{mod}.{cls}.rst').strpath, 'w') as f: + f.write(CLASS_RST.format(mod=mod, cls=cls)) + + run_sphinx_in_tmpdir(tmpdir) + + with open(tmpdir.join("index.rst.automodsumm").strpath) as f: + result = f.read() + + assert result == sorted_expected diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 6934124..1763fcb 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -1,7 +1,7 @@ -import inspect import sys import re import os +from inspect import ismodule from warnings import warn from sphinx.ext.autosummary.generate import find_autosummary_in_docstring @@ -37,7 +37,7 @@ def cleanup_whitespace(text): return text -def find_mod_objs(modname, onlylocals=False): +def find_mod_objs(modname, onlylocals=False, sort=False): """ Returns all the public attributes of a module referenced by name. .. note:: @@ -78,11 +78,14 @@ def find_mod_objs(modname, onlylocals=False): # define their own __getattr__ and __dir__. if hasattr(mod, '__all__'): pkgitems = [(k, getattr(mod, k)) for k in mod.__all__] + # Optionally sort the items alphabetically + if sort: + pkgitems.sort() + else: - pkgitems = [(k, getattr(mod, k)) for k in dir(mod) if k[0] != '_'] + pkgitems = [(k, getattr(mod, k)) for k in dir(mod) if k[0] != "_"] # filter out modules and pull the names and objs out - ismodule = inspect.ismodule localnames = [k for k, v in pkgitems if not ismodule(v)] objs = [v for k, v in pkgitems if not ismodule(v)] From d671dd5ffaadd71869a4db8c3879855645bdb522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 13 Aug 2024 14:16:59 -0700 Subject: [PATCH 080/115] MAINT: adding sphinx 8.0.x to the testing matrix --- .github/workflows/ci_workflows.yml | 7 +++++-- tox.ini | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 47100e6..d1e84cb 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -45,6 +45,9 @@ jobs: - os: ubuntu-latest python-version: '3.11' toxenv: py311-test-sphinx72-cov-clocale + - os: ubuntu-latest + python-version: '3.12' + toxenv: py312-test-sphinx80 - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-sphinxdev @@ -52,7 +55,7 @@ jobs: # MacOS X - just the stable and dev - os: macos-latest python-version: '3.10' - toxenv: py310-test-sphinx72-clocale + toxenv: py310-test-sphinx80-clocale - os: macos-latest python-version: '3.11' toxenv: py311-test-sphinxdev @@ -63,7 +66,7 @@ jobs: toxenv: py38-test-sphinx_oldest - os: windows-latest python-version: '3.10' - toxenv: py310-test-sphinx72 + toxenv: py310-test-sphinx80 - os: windows-latest python-version: '3.11' toxenv: py311-test-sphinxdev diff --git a/tox.ini b/tox.ini index 12ca6fc..c320e6b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312}-test-sphinx{_oldest,53,62,70,71,72,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312}-test-sphinx{_oldest,53,62,70,71,72,80,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -13,6 +13,7 @@ deps = sphinx70: sphinx==7.0.* sphinx71: sphinx==7.1.* sphinx72: sphinx==7.2.* + sphinx80: sphinx==8.0.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = test: test From 1775419e667c17b00d7a00a3ef9945d5086ffa45 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 11 Sep 2024 12:41:20 +0100 Subject: [PATCH 081/115] Added regression test for importing a class from a private submodule into a public one --- .../tests/cases/public_from_private/README.md | 2 ++ .../cases/public_from_private/input/index.rst | 1 + ...pi.tests.example_module.public.Camelot.rst | 7 +++++++ .../output/index.rst.automodapi | 19 +++++++++++++++++++ .../output/index.rst.automodsumm | 7 +++++++ .../tests/example_module/_private.py | 4 ++++ .../tests/example_module/public.py | 1 + 7 files changed, 41 insertions(+) create mode 100644 sphinx_automodapi/tests/cases/public_from_private/README.md create mode 100644 sphinx_automodapi/tests/cases/public_from_private/input/index.rst create mode 100644 sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Camelot.rst create mode 100644 sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm create mode 100644 sphinx_automodapi/tests/example_module/_private.py create mode 100644 sphinx_automodapi/tests/example_module/public.py diff --git a/sphinx_automodapi/tests/cases/public_from_private/README.md b/sphinx_automodapi/tests/cases/public_from_private/README.md new file mode 100644 index 0000000..0381ea2 --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/README.md @@ -0,0 +1,2 @@ +Importing a class from a private submodule to a public submodule +at the same level of hierarchy in the module. diff --git a/sphinx_automodapi/tests/cases/public_from_private/input/index.rst b/sphinx_automodapi/tests/cases/public_from_private/input/index.rst new file mode 100644 index 0000000..37d01fa --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/input/index.rst @@ -0,0 +1 @@ +.. automodapi:: sphinx_automodapi.tests.example_module.public diff --git a/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Camelot.rst b/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Camelot.rst new file mode 100644 index 0000000..becaa5a --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Camelot.rst @@ -0,0 +1,7 @@ +Camelot +======= + +.. currentmodule:: sphinx_automodapi.tests.example_module.public + +.. autoclass:: Camelot + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodapi new file mode 100644 index 0000000..d285595 --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.public Module +---------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.public + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.public + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.public + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm new file mode 100644 index 0000000..6792f70 --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm @@ -0,0 +1,7 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.public + +.. autosummary:: + :toctree: api + + Camelot + diff --git a/sphinx_automodapi/tests/example_module/_private.py b/sphinx_automodapi/tests/example_module/_private.py new file mode 100644 index 0000000..d10c9db --- /dev/null +++ b/sphinx_automodapi/tests/example_module/_private.py @@ -0,0 +1,4 @@ +class Camelot: + """ + It's a silly place anyway + """ diff --git a/sphinx_automodapi/tests/example_module/public.py b/sphinx_automodapi/tests/example_module/public.py new file mode 100644 index 0000000..1d27c5c --- /dev/null +++ b/sphinx_automodapi/tests/example_module/public.py @@ -0,0 +1 @@ +from ._private import Camelot From baa2716c7bf616bda97cc68b7f99c85a5d94e418 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 11 Sep 2024 12:58:58 +0100 Subject: [PATCH 082/115] __all__ should take precedence over onlylocals for determining what is public --- sphinx_automodapi/tests/example_module/public.py | 4 ++++ sphinx_automodapi/utils.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sphinx_automodapi/tests/example_module/public.py b/sphinx_automodapi/tests/example_module/public.py index 1d27c5c..2de6180 100644 --- a/sphinx_automodapi/tests/example_module/public.py +++ b/sphinx_automodapi/tests/example_module/public.py @@ -1 +1,5 @@ from ._private import Camelot + +__all__ = [ + 'Camelot' +] diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 1763fcb..38e7be4 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -50,9 +50,11 @@ def find_mod_objs(modname, onlylocals=False, sort=False): modname : str The name of the module to search. onlylocals : bool or list - If True, only attributes that are either members of `modname` OR one of + If `True`, only attributes that are either members of `modname` OR one of its modules or subpackages will be included. If a list, only members of packages in the list are included. If `False`, selection is done. + This option is ignored if a module defines __all__ - in that case, __all__ + is used to determine whether objects are public. Returns ------- @@ -81,7 +83,7 @@ def find_mod_objs(modname, onlylocals=False, sort=False): # Optionally sort the items alphabetically if sort: pkgitems.sort() - + onlylocals = False else: pkgitems = [(k, getattr(mod, k)) for k in dir(mod) if k[0] != "_"] From c7e52e156b8bb00eec8a5ee41cdcaa7f80b263ed Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Wed, 11 Sep 2024 13:02:35 +0100 Subject: [PATCH 083/115] Added changelog entry --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 6c0ca46..a7fdad5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changes in sphinx-automodapi 0.18.0 (unreleased) ------------------- +- Fixed an issue where items defined in ``__all__`` but originally imported + from elsewhere, e.g. a private module, were not documented. [#190] + 0.17.0 (2024-02-22) ------------------- From 23d4849a92f581813fef248aedf116af14624ee2 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 12 Sep 2024 10:08:06 +0100 Subject: [PATCH 084/115] Add missing {posargs} in tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c320e6b..c0e74f2 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ extras = test: test commands = pip freeze - !cov: pytest --pyargs sphinx_automodapi + !cov: pytest --pyargs sphinx_automodapi {posargs} cov: pytest --pyargs sphinx_automodapi --cov sphinx_automodapi --cov-config={toxinidir}/setup.cfg {posargs} cov: coverage xml -o {toxinidir}/coverage.xml passenv = HOME, WINDIR, LC_ALL, LC_CTYPE, LANG, CC, CI From 76731714765961d3e03ddcb63e1720e9e1a462a5 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 12 Sep 2024 10:09:24 +0100 Subject: [PATCH 085/115] Include a class imported from a public submodule too --- .../sphinx_automodapi.tests.example_module.public.Spam.rst | 7 +++++++ .../cases/public_from_private/output/index.rst.automodsumm | 2 +- sphinx_automodapi/tests/example_module/public.py | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Spam.rst diff --git a/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Spam.rst b/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Spam.rst new file mode 100644 index 0000000..bf19304 --- /dev/null +++ b/sphinx_automodapi/tests/cases/public_from_private/output/api/sphinx_automodapi.tests.example_module.public.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module.public + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm index 6792f70..7eade32 100644 --- a/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/public_from_private/output/index.rst.automodsumm @@ -4,4 +4,4 @@ :toctree: api Camelot - + Spam diff --git a/sphinx_automodapi/tests/example_module/public.py b/sphinx_automodapi/tests/example_module/public.py index 2de6180..035a9b2 100644 --- a/sphinx_automodapi/tests/example_module/public.py +++ b/sphinx_automodapi/tests/example_module/public.py @@ -1,5 +1,7 @@ from ._private import Camelot +from .classes import Spam __all__ = [ - 'Camelot' + 'Camelot', + 'Spam' ] From e07759cb6e97f69856201602627e89a3311969a3 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 13 Sep 2024 13:22:46 +0100 Subject: [PATCH 086/115] Finalizing change log for 0.18.0 --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a7fdad5..18d131d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changes in sphinx-automodapi ============================ -0.18.0 (unreleased) +0.18.0 (2024-09-13) ------------------- - Fixed an issue where items defined in ``__all__`` but originally imported From 4dfa3fcc2f31ea2a58bd42eb015b2244bbb09fec Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 13 Sep 2024 13:23:40 +0100 Subject: [PATCH 087/115] Back to development: v0.19.dev --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 18d131d..afd5391 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,9 @@ Changes in sphinx-automodapi ============================ +0.19.0 (unreleased) +------------------- + 0.18.0 (2024-09-13) ------------------- From 7cdd1c875a8c5d6bbff3686eb0f98873e1a8bb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 25 Sep 2024 13:06:50 -0700 Subject: [PATCH 088/115] MAINT: adding python 3.13 to the tests --- .github/workflows/ci_workflows.yml | 13 +++++++------ tox.ini | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index d1e84cb..c62ca70 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -49,16 +49,16 @@ jobs: python-version: '3.12' toxenv: py312-test-sphinx80 - os: ubuntu-latest - python-version: '3.12' - toxenv: py312-test-sphinxdev + python-version: '3.13' + toxenv: py313-test-sphinxdev # MacOS X - just the stable and dev - os: macos-latest python-version: '3.10' toxenv: py310-test-sphinx80-clocale - os: macos-latest - python-version: '3.11' - toxenv: py311-test-sphinxdev + python-version: '3.13' + toxenv: py313-test-sphinxdev # Windows - just the oldest, stable, and dev - os: windows-latest @@ -68,8 +68,8 @@ jobs: python-version: '3.10' toxenv: py310-test-sphinx80 - os: windows-latest - python-version: '3.11' - toxenv: py311-test-sphinxdev + python-version: '3.13' + toxenv: py313-test-sphinxdev steps: - uses: actions/checkout@v4 @@ -79,6 +79,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install graphviz on Linux if: startsWith(matrix.os, 'ubuntu') run: | diff --git a/tox.ini b/tox.ini index c0e74f2..dcf8ab5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312}-test-sphinx{_oldest,53,62,70,71,72,80,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312,313}-test-sphinx{_oldest,53,62,70,71,72,80,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true From 62bc6af6e37d48e53c44b54796617de549a8ad46 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:48:18 -0400 Subject: [PATCH 089/115] MNT: Use hash for Action workflow versions and update if needed --- .github/workflows/check_milestone.yml | 2 +- .github/workflows/ci_workflows.yml | 6 +++--- .github/workflows/publish.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check_milestone.yml b/.github/workflows/check_milestone.yml index 2a6bf44..e302ddc 100644 --- a/.github/workflows/check_milestone.yml +++ b/.github/workflows/check_milestone.yml @@ -17,7 +17,7 @@ jobs: milestone_checker: runs-on: ubuntu-latest steps: - - uses: actions/github-script@v7 + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 if: github.repository == 'astropy/sphinx-automodapi' with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index c62ca70..8f8138a 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -72,11 +72,11 @@ jobs: toxenv: py313-test-sphinxdev steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -99,6 +99,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6d9d91f..fd60c2e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,10 +13,10 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: 3.8 @@ -45,7 +45,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2 with: user: __token__ password: ${{ secrets.pypi_password }} From 594fc1248ee2411c1455205612b69b6ab0fbc95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 27 Sep 2024 09:53:39 -0700 Subject: [PATCH 090/115] CI: changing to monthly dependabot --- .github/dependabot.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e4a49c6..f715e38 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,13 @@ version: 2 updates: - - package-ecosystem: "github-actions" # See documentation for possible values - directory: ".github/workflows" # Location of package manifests + - package-ecosystem: "github-actions" + directory: "/" schedule: - interval: "weekly" + interval: "monthly" + groups: + actions: + patterns: + - "*" + labels: + - "no-changelog-entry-needed" From c625c1dc7cab88488399e86c7ac8f5ac8f758497 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 05:52:03 +0000 Subject: [PATCH 091/115] Bump the actions group with 4 updates Bumps the actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-python](https://github.com/actions/setup-python), [codecov/codecov-action](https://github.com/codecov/codecov-action) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `actions/checkout` from 4.2.0 to 4.2.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683) Updates `actions/setup-python` from 5.2.0 to 5.3.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/f677139bbe7f9c59b41e40162b753c062f5d49a3...0b93645e9fea7318ecaed2b359559ac225c90a2b) Updates `codecov/codecov-action` from 4.5.0 to 4.6.0 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/e28ff129e5465c2c0dcc6f003fc735cb6ae0c673...b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238) Updates `pypa/gh-action-pypi-publish` from 1.10.2 to 1.11.0 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/897895f1e160c830e369f9779632ebc134688e1b...fb13cb306901256ace3dab689990e13a5550ffaa) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 6 +++--- .github/workflows/publish.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 8f8138a..0dac5aa 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -72,11 +72,11 @@ jobs: toxenv: py313-test-sphinxdev steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -99,6 +99,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fd60c2e..5bcf90c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,10 +13,10 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: 3.8 @@ -45,7 +45,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2 + uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # v1.11.0 with: user: __token__ password: ${{ secrets.pypi_password }} From 3724b4491f5af024c612cad01122c1ef462b31ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 05:53:49 +0000 Subject: [PATCH 092/115] Bump the actions group with 2 updates Bumps the actions group with 2 updates: [codecov/codecov-action](https://github.com/codecov/codecov-action) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `codecov/codecov-action` from 4.6.0 to 5.0.7 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238...015f24e6818733317a2da2edd6290ab26238649a) Updates `pypa/gh-action-pypi-publish` from 1.11.0 to 1.12.2 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/fb13cb306901256ace3dab689990e13a5550ffaa...15c56dba361d8335944d31a2ecd17d700fc7bcbc) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 0dac5aa..8f28c41 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -99,6 +99,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5bcf90c..36f5910 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # v1.11.0 + uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 with: user: __token__ password: ${{ secrets.pypi_password }} From a9a640d7808c6507cd07aa160d943f55bfc778b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 05:06:49 +0000 Subject: [PATCH 093/115] Bump the actions group with 2 updates Bumps the actions group with 2 updates: [codecov/codecov-action](https://github.com/codecov/codecov-action) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `codecov/codecov-action` from 5.0.7 to 5.1.2 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/015f24e6818733317a2da2edd6290ab26238649a...1e68e06f1dbfde0e4cefc87efeba9e4643565303) Updates `pypa/gh-action-pypi-publish` from 1.12.2 to 1.12.3 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/15c56dba361d8335944d31a2ecd17d700fc7bcbc...67339c736fd9354cd4f8cb0b744f2b82a74b5c70) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 8f28c41..8cb5281 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -99,6 +99,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 + uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 36f5910..95dbec0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 + uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 with: user: __token__ password: ${{ secrets.pypi_password }} From 77a0e2962c39f720a3d0c2c63c8ec2213b947c54 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:40:50 -0500 Subject: [PATCH 094/115] Compatibility with Sphinx 8.2, minor clean up (#196) * MNT: Remove unnecessary try-except * DEP: Require packaging * Compat with sphinx 8.2 --- setup.cfg | 1 + sphinx_automodapi/automodsumm.py | 38 +++++++++++++++++++------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/setup.cfg b/setup.cfg index 5a915e6..a4eec45 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,6 +20,7 @@ zip_safe = False packages = find: python_requires = >=3.8 install_requires = + packaging sphinx>=4 [options.extras_require] diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 2ddb478..42bf292 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -99,16 +99,19 @@ class members that are inherited from a base class. This value can be import os import re +import sphinx +from docutils.parsers.rst.directives import flag +from packaging.version import Version from sphinx.util import logging from sphinx.ext.autosummary import Autosummary from sphinx.ext.inheritance_diagram import InheritanceDiagram, InheritanceGraph, try_import -from docutils.parsers.rst.directives import flag from .utils import find_mod_objs, cleanup_whitespace __all__ = ['Automoddiagram', 'Automodsumm', 'automodsumm_to_autosummary_lines', 'generate_automodsumm_docs', 'process_automodsumm_generation'] logger = logging.getLogger(__name__) +SPHINX_LT_8_2 = Version(sphinx.__version__) < Version("8.2.dev") def _str_list_converter(argument): @@ -267,15 +270,24 @@ def run(self): old_generate_dot = InheritanceGraph.generate_dot - -def patched_generate_dot(self, name, urls={}, env=None, - graph_attrs={}, node_attrs={}, edge_attrs={}): - # Make a new mapping dictionary that uses class full names by importing each - # class documented name - fullname_urls = {self.class_name(try_import(name), 0, None): url - for name, url in urls.items() if try_import(name) is not None} - return old_generate_dot(self, name, urls=fullname_urls, env=env, - graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs) +if SPHINX_LT_8_2: + def patched_generate_dot(self, name, urls={}, env=None, + graph_attrs={}, node_attrs={}, edge_attrs={}): + # Make a new mapping dictionary that uses class full names by importing each + # class documented name + fullname_urls = {self.class_name(try_import(name), 0, None): url + for name, url in urls.items() if try_import(name) is not None} + return old_generate_dot(self, name, urls=fullname_urls, env=env, + graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs) +else: + def patched_generate_dot(self, name, urls={}, config=None, + graph_attrs={}, node_attrs={}, edge_attrs={}): + # Make a new mapping dictionary that uses class full names by importing each + # class documented name + fullname_urls = {self.class_name(try_import(name), 0, None): url + for name, url in urls.items() if try_import(name) is not None} + return old_generate_dot(self, name, urls=fullname_urls, config=config, + graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs) InheritanceGraph.generate_dot = patched_generate_dot @@ -532,9 +544,7 @@ def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst', new_files.append(fn) - f = open(fn, 'w', encoding='utf8') - - try: + with open(fn, 'w', encoding='utf8') as f: doc = get_documenter(app, obj, parent) @@ -672,8 +682,6 @@ def get_members_class(obj, typ, include_public=[], rendered = template.render(**ns) f.write(cleanup_whitespace(rendered)) - finally: - f.close() def setup(app): From 6077184769cb0d6a8a9cd8ae58af05cb58303f7c Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Fri, 10 Jan 2025 14:06:58 -0500 Subject: [PATCH 095/115] Modify to allow for autoproperty --- sphinx_automodapi/automodsumm.py | 24 ++++++++++++++----- .../templates/autosummary_core/class.rst | 12 ++++++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 42bf292..49459d7 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -321,7 +321,8 @@ def process_automodsumm_generation(app): lines, sfn, app=app, builder=app.builder, base_path=app.srcdir, inherited_members=app.config.automodsumm_inherited_members, - included_members=app.config.automodsumm_included_members) + included_members=app.config.automodsumm_included_members, + properties_are_attributes=app.config.automodsumm_properties_are_attributes) # _automodsummrex = re.compile(r'^(\s*)\.\. automodsumm::\s*([A-Za-z0-9_.]+)\s*' @@ -462,7 +463,8 @@ def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst', base_path=None, builder=None, template_dir=None, inherited_members=False, - included_members=('__init__', '__call__')): + included_members=('__init__', '__call__'), + *, properties_are_attributes=True): """ This function is adapted from `sphinx.ext.autosummary.generate.generate_autosummmary_docs` to @@ -595,10 +597,10 @@ def get_members_class(obj, typ, include_public=[], continue if typ is None or documenter.objtype == typ: items.append(name) - elif typ == 'attribute' and documenter.objtype == 'property': - # In Sphinx 2.0 and above, properties have a separate - # objtype, but we treat them the same here. - items.append(name) + # elif typ == 'attribute' and documenter.objtype == 'property': + # # In Sphinx 2.0 and above, properties have a separate + # # objtype, but we treat them the same here. + # items.append(name) public = [x for x in items if x in include_public or not x.startswith('_')] return public, items @@ -629,6 +631,15 @@ def get_members_class(obj, typ, include_public=[], ns['attributes'], ns['all_attributes'] = \ get_members_class(obj, 'attribute', include_base=include_base) + public_properties, all_properties = \ + get_members_class(obj, 'property', + include_base=include_base) + if properties_are_attributes: + ns['attributes'].extend(public_properties) + ns['all_attributes'].extend(all_properties) + else: + ns['properties'] = public_properties + ns['all_properties'] = all_properties ns['methods'].sort() ns['attributes'].sort() @@ -703,6 +714,7 @@ def setup(app): app.add_config_value('automodsumm_inherited_members', False, 'env') app.add_config_value( 'automodsumm_included_members', ['__init__', '__call__'], 'env') + app.add_config_value('automodsumm_properties_are_attributes', True, 'env') return {'parallel_read_safe': True, 'parallel_write_safe': True} diff --git a/sphinx_automodapi/templates/autosummary_core/class.rst b/sphinx_automodapi/templates/autosummary_core/class.rst index 198d04b..0c0c57f 100644 --- a/sphinx_automodapi/templates/autosummary_core/class.rst +++ b/sphinx_automodapi/templates/autosummary_core/class.rst @@ -18,7 +18,7 @@ {% endif %} {% block attributes_summary %} - {% if attributes %} + {% if attributes or properties %} .. rubric:: Attributes Summary @@ -27,6 +27,10 @@ ~{{ name }}.{{ item }} {%- endfor %} + {% for item in properties %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} {% endblock %} @@ -44,7 +48,7 @@ {% endblock %} {% block attributes_documentation %} - {% if attributes %} + {% if attributes or properties%} .. rubric:: Attributes Documentation @@ -52,6 +56,10 @@ .. autoattribute:: {{ item }} {%- endfor %} + {% for item in properties %} + .. autoproperty:: {{ item }} + {%- endfor %} + {% endif %} {% endblock %} From 53499bb980c4677868e5157aa4db79e4c39725d9 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Fri, 10 Jan 2025 14:22:41 -0500 Subject: [PATCH 096/115] Add property-attribute tests to current test case --- ...dule.abstract_classes.SequenceSubclass.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...dule.abstract_classes.SequenceSubclass.rst | 27 ++++++++++++ .../index.rst.automodapi | 19 +++++++++ .../index.rst.automodsumm | 6 +++ ...nx_automodapi.tests.example_module.Egg.rst | 0 ...x_automodapi.tests.example_module.Spam.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...nx_automodapi.tests.example_module.Egg.rst | 29 +++++++++++++ ...x_automodapi.tests.example_module.Spam.rst | 0 .../index.rst.automodapi | 21 ++++++++++ .../index.rst.automodsumm | 7 ++++ ...odapi.tests.example_module.classes.Egg.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...odapi.tests.example_module.classes.Egg.rst | 29 +++++++++++++ .../index.rst.automodapi | 21 ++++++++++ .../index.rst.automodsumm | 6 +++ ...odapi.tests.example_module.classes.Egg.rst | 0 ...dapi.tests.example_module.classes.Spam.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...odapi.tests.example_module.classes.Egg.rst | 29 +++++++++++++ ...dapi.tests.example_module.classes.Spam.rst | 7 ++++ .../index.rst.automodapi | 19 +++++++++ .../index.rst.automodsumm | 7 ++++ ...odapi.tests.example_module.classes.Egg.rst | 0 ...dapi.tests.example_module.classes.Spam.rst | 0 ...tests.example_module.other_classes.Foo.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...odapi.tests.example_module.classes.Egg.rst | 29 +++++++++++++ ...dapi.tests.example_module.classes.Spam.rst | 19 +++++++++ ...tests.example_module.other_classes.Foo.rst | 17 ++++++++ .../index.rst.automodapi | 41 +++++++++++++++++++ .../index.rst.automodsumm | 14 +++++++ ...nx_automodapi.tests.example_module.Egg.rst | 0 ...x_automodapi.tests.example_module.Spam.rst | 0 ...nx_automodapi.tests.example_module.add.rst | 0 ...tomodapi.tests.example_module.multiply.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...nx_automodapi.tests.example_module.Egg.rst | 29 +++++++++++++ ...x_automodapi.tests.example_module.Spam.rst | 0 ...nx_automodapi.tests.example_module.add.rst | 0 ...tomodapi.tests.example_module.multiply.rst | 0 .../index.rst.automodapi | 26 ++++++++++++ .../index.rst.automodsumm | 0 ...nx_automodapi.tests.example_module.Egg.rst | 0 ....tests.example_module.FUNNY_WALK_STEPS.rst | 0 ...dapi.tests.example_module.PARROT_STATE.rst | 0 ...x_automodapi.tests.example_module.Spam.rst | 7 ++++ ...nx_automodapi.tests.example_module.add.rst | 0 ...tomodapi.tests.example_module.multiply.rst | 0 .../index.rst.automodapi | 0 .../index.rst.automodsumm | 0 ...nx_automodapi.tests.example_module.Egg.rst | 29 +++++++++++++ ....tests.example_module.FUNNY_WALK_STEPS.rst | 6 +++ ...dapi.tests.example_module.PARROT_STATE.rst | 6 +++ ...x_automodapi.tests.example_module.Spam.rst | 7 ++++ ...nx_automodapi.tests.example_module.add.rst | 6 +++ ...tomodapi.tests.example_module.multiply.rst | 6 +++ .../index.rst.automodapi | 33 +++++++++++++++ .../index.rst.automodsumm | 22 ++++++++++ ...nx_automodapi.tests.example_module.Egg.rst | 0 ...x_automodapi.tests.example_module.Spam.rst | 7 ++++ ...nx_automodapi.tests.example_module.add.rst | 6 +++ ...tomodapi.tests.example_module.multiply.rst | 6 +++ .../index.rst.automodapi | 0 .../output_prop_is_attr/index.rst.automodsumm | 15 +++++++ ...nx_automodapi.tests.example_module.Egg.rst | 29 +++++++++++++ ...x_automodapi.tests.example_module.Spam.rst | 7 ++++ ...nx_automodapi.tests.example_module.add.rst | 6 +++ ...tomodapi.tests.example_module.multiply.rst | 6 +++ .../index.rst.automodapi | 19 +++++++++ .../index.rst.automodsumm | 15 +++++++ sphinx_automodapi/tests/test_cases.py | 14 +++++-- 79 files changed, 650 insertions(+), 4 deletions(-) rename sphinx_automodapi/tests/cases/abstract_classes/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst (100%) rename sphinx_automodapi/tests/cases/abstract_classes/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/abstract_classes/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst create mode 100644 sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/allowed_names/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Egg.rst (100%) rename sphinx_automodapi/tests/cases/allowed_names/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Spam.rst (100%) rename sphinx_automodapi/tests/cases/allowed_names/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/allowed_names/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst rename sphinx_automodapi/tests/cases/{mixed_toplevel/output => allowed_names/output_prop_is_not_attr}/api/sphinx_automodapi.tests.example_module.Spam.rst (100%) create mode 100644 sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/classes_no_inherit/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.classes.Egg.rst (100%) rename sphinx_automodapi/tests/cases/classes_no_inherit/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/classes_no_inherit/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst create mode 100644 sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/classes_with_inherit/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.classes.Egg.rst (100%) rename sphinx_automodapi/tests/cases/classes_with_inherit/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.classes.Spam.rst (100%) rename sphinx_automodapi/tests/cases/classes_with_inherit/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/classes_with_inherit/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst create mode 100644 sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst create mode 100644 sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/inherited_members/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.classes.Egg.rst (100%) rename sphinx_automodapi/tests/cases/inherited_members/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.classes.Spam.rst (100%) rename sphinx_automodapi/tests/cases/inherited_members/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst (100%) rename sphinx_automodapi/tests/cases/inherited_members/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/inherited_members/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst create mode 100644 sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst create mode 100644 sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst create mode 100644 sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/mixed_toplevel/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Egg.rst (100%) rename sphinx_automodapi/tests/cases/{mixed_toplevel_all_objects/output => mixed_toplevel/output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Spam.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.add.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.multiply.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst rename sphinx_automodapi/tests/cases/{mixed_toplevel_nodiagram/output => mixed_toplevel/output_prop_is_not_attr}/api/sphinx_automodapi.tests.example_module.Spam.rst (100%) rename sphinx_automodapi/tests/cases/{mixed_toplevel_all_objects/output => mixed_toplevel/output_prop_is_not_attr}/api/sphinx_automodapi.tests.example_module.add.rst (100%) rename sphinx_automodapi/tests/cases/{mixed_toplevel_all_objects/output => mixed_toplevel/output_prop_is_not_attr}/api/sphinx_automodapi.tests.example_module.multiply.rst (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodapi rename sphinx_automodapi/tests/cases/{mixed_toplevel_nodiagram/output => mixed_toplevel/output_prop_is_not_attr}/index.rst.automodsumm (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Egg.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst rename sphinx_automodapi/tests/cases/{mixed_toplevel_nodiagram/output => mixed_toplevel_all_objects/output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.add.rst (100%) rename sphinx_automodapi/tests/cases/{mixed_toplevel_nodiagram/output => mixed_toplevel_all_objects/output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.multiply.rst (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/{output => output_prop_is_attr}/index.rst.automodapi (100%) rename sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/{output => output_prop_is_attr}/index.rst.automodsumm (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodsumm rename sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/{output => output_prop_is_attr}/api/sphinx_automodapi.tests.example_module.Egg.rst (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst rename sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/{output => output_prop_is_attr}/index.rst.automodapi (100%) create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodsumm create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst similarity index 100% rename from sphinx_automodapi/tests/cases/abstract_classes/output/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst rename to sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/abstract_classes/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst new file mode 100644 index 0000000..d9ec7cf --- /dev/null +++ b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.abstract_classes.SequenceSubclass.rst @@ -0,0 +1,27 @@ +SequenceSubclass +================ + +.. currentmodule:: sphinx_automodapi.tests.example_module.abstract_classes + +.. autoclass:: SequenceSubclass + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~SequenceSubclass.my_property + + .. rubric:: Methods Summary + + .. autosummary:: + + ~SequenceSubclass.my_method + + .. rubric:: Attributes Documentation + + .. autoproperty:: my_property + + .. rubric:: Methods Documentation + + .. automethod:: my_method diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..4bdc13b --- /dev/null +++ b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.abstract_classes Module +-------------------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.abstract_classes + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.abstract_classes + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.abstract_classes + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..b280f1d --- /dev/null +++ b/sphinx_automodapi/tests/cases/abstract_classes/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,6 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.abstract_classes + +.. autosummary:: + :toctree: api + + SequenceSubclass diff --git a/sphinx_automodapi/tests/cases/allowed_names/output/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/allowed_names/output/api/sphinx_automodapi.tests.example_module.Egg.rst rename to sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst diff --git a/sphinx_automodapi/tests/cases/allowed_names/output/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/allowed_names/output/api/sphinx_automodapi.tests.example_module.Spam.rst rename to sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst diff --git a/sphinx_automodapi/tests/cases/allowed_names/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/allowed_names/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/allowed_names/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/allowed_names/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/allowed_names/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst new file mode 100644 index 0000000..f8d762a --- /dev/null +++ b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Spam.rst rename to sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst diff --git a/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..aed3523 --- /dev/null +++ b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,21 @@ + +sphinx_automodapi.tests.example_module Package +---------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :classes-only: + :toctree: api + :allowed-package-names: sphinx_automodapi.tests.example_module.classes + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module + :private-bases: + :parts: 1 + :allowed-package-names: sphinx_automodapi.tests.example_module.classes diff --git a/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..1710307 --- /dev/null +++ b/sphinx_automodapi/tests/cases/allowed_names/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,7 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + Egg + Spam diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/classes_no_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst rename to sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/classes_no_inherit/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst new file mode 100644 index 0000000..07638af --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..79a2621 --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,21 @@ + +sphinx_automodapi.tests.example_module.classes Module +----------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.classes + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.classes + :classes-only: + :toctree: api + :skip: Spam + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.classes + :private-bases: + :parts: 1 + :skip: Spam diff --git a/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..966572f --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_no_inherit/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,6 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autosummary:: + :toctree: api + + Egg diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst rename to sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/classes_with_inherit/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst rename to sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/classes_with_inherit/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst new file mode 100644 index 0000000..07638af --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst new file mode 100644 index 0000000..b635876 --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..467c878 --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.classes Module +----------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.classes + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.classes + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.classes + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..22da840 --- /dev/null +++ b/sphinx_automodapi/tests/cases/classes_with_inherit/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,7 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autosummary:: + :toctree: api + + Spam + Egg diff --git a/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Egg.rst rename to sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst diff --git a/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.classes.Spam.rst rename to sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst diff --git a/sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst similarity index 100% rename from sphinx_automodapi/tests/cases/inherited_members/output/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst rename to sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst diff --git a/sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/inherited_members/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/inherited_members/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst new file mode 100644 index 0000000..07638af --- /dev/null +++ b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst new file mode 100644 index 0000000..e37d6b2 --- /dev/null +++ b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.classes.Spam.rst @@ -0,0 +1,19 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autoclass:: Spam + :show-inheritance: + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Spam.buy + ~Spam.eat + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst new file mode 100644 index 0000000..80e8330 --- /dev/null +++ b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.other_classes.Foo.rst @@ -0,0 +1,17 @@ +Foo +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module.other_classes + +.. autoclass:: Foo + :show-inheritance: + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Foo.hmm + + .. rubric:: Methods Documentation + + .. automethod:: hmm diff --git a/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..dc0e6ff --- /dev/null +++ b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,41 @@ + +sphinx_automodapi.tests.example_module.classes Module +----------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.classes + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.classes + :classes-only: + :toctree: api + :inherited-members: + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.classes + :private-bases: + :parts: 1 + + + +sphinx_automodapi.tests.example_module.other_classes Module +----------------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.other_classes + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.other_classes + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.other_classes + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..51a0974 --- /dev/null +++ b/sphinx_automodapi/tests/cases/inherited_members/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,14 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autosummary:: + :toctree: api + :inherited-members: + + Spam + Egg +.. currentmodule:: sphinx_automodapi.tests.example_module.other_classes + +.. autosummary:: + :toctree: api + + Foo diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.Egg.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Spam.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.add.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/api/sphinx_automodapi.tests.example_module.multiply.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst new file mode 100644 index 0000000..f8d762a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Spam.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.add.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.multiply.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..2821ea1 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,26 @@ + +sphinx_automodapi.tests.example_module Package +---------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module + +Functions +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :functions-only: + :toctree: api + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/mixed_toplevel/output_prop_is_not_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.Egg.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst new file mode 100644 index 0000000..6d769e7 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.add.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.multiply.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/index.rst.automodsumm similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output/index.rst.automodsumm rename to sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_attr/index.rst.automodsumm diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst new file mode 100644 index 0000000..f8d762a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst new file mode 100644 index 0000000..11fa366 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.FUNNY_WALK_STEPS.rst @@ -0,0 +1,6 @@ +FUNNY_WALK_STEPS +================ + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autodata:: FUNNY_WALK_STEPS diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst new file mode 100644 index 0000000..f720dbd --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.PARROT_STATE.rst @@ -0,0 +1,6 @@ +PARROT_STATE +============ + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autodata:: PARROT_STATE diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst new file mode 100644 index 0000000..6d769e7 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst new file mode 100644 index 0000000..7b2b01a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst @@ -0,0 +1,6 @@ +add +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: add diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst new file mode 100644 index 0000000..41e5e00 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst @@ -0,0 +1,6 @@ +multiply +======== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: multiply diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..76ea9e4 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,33 @@ + +sphinx_automodapi.tests.example_module Package +---------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module + +Functions +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :functions-only: + :toctree: api + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :classes-only: + :toctree: api + +Variables +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :variables-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..cc706fe --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_all_objects/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,22 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + add + multiply + subtract +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + Egg + Spam +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + FUNNY_WALK_STEPS + PARROT_STATE diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/api/sphinx_automodapi.tests.example_module.Egg.rst rename to sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Egg.rst diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst new file mode 100644 index 0000000..6d769e7 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst new file mode 100644 index 0000000..7b2b01a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.add.rst @@ -0,0 +1,6 @@ +add +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: add diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst new file mode 100644 index 0000000..41e5e00 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.multiply.rst @@ -0,0 +1,6 @@ +multiply +======== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: multiply diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodapi similarity index 100% rename from sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output/index.rst.automodapi rename to sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodapi diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodsumm new file mode 100644 index 0000000..86235af --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_attr/index.rst.automodsumm @@ -0,0 +1,15 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + add + multiply + subtract +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + Egg + Spam diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst new file mode 100644 index 0000000..f8d762a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Egg.rst @@ -0,0 +1,29 @@ +Egg +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Egg + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~Egg.weight + + .. rubric:: Methods Summary + + .. autosummary:: + + ~Egg.buy + ~Egg.eat + + .. rubric:: Attributes Documentation + + .. autoproperty:: weight + + .. rubric:: Methods Documentation + + .. automethod:: buy + .. automethod:: eat diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst new file mode 100644 index 0000000..6d769e7 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.Spam.rst @@ -0,0 +1,7 @@ +Spam +==== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autoclass:: Spam + :show-inheritance: diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst new file mode 100644 index 0000000..7b2b01a --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.add.rst @@ -0,0 +1,6 @@ +add +=== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: add diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst new file mode 100644 index 0000000..41e5e00 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.multiply.rst @@ -0,0 +1,6 @@ +multiply +======== + +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autofunction:: multiply diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..f602813 --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module Package +---------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module + +Functions +^^^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :functions-only: + :toctree: api + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module + :classes-only: + :toctree: api diff --git a/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..86235af --- /dev/null +++ b/sphinx_automodapi/tests/cases/mixed_toplevel_nodiagram/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,15 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + add + multiply + subtract +.. currentmodule:: sphinx_automodapi.tests.example_module + +.. autosummary:: + :toctree: api + + Egg + Spam diff --git a/sphinx_automodapi/tests/test_cases.py b/sphinx_automodapi/tests/test_cases.py index 0ffa4c8..487c904 100644 --- a/sphinx_automodapi/tests/test_cases.py +++ b/sphinx_automodapi/tests/test_cases.py @@ -21,6 +21,7 @@ CASES_DIRS = glob.glob(os.path.join(CASES_ROOT, '*')) PARALLEL = {False, True} +PROP_ATTR = {True, False} intersphinx_mapping = { @@ -58,18 +59,23 @@ def teardown_function(func): roles._roles = func._roles -@pytest.mark.parametrize(('case_dir', 'parallel'), product(CASES_DIRS, PARALLEL)) -def test_run_full_case(tmpdir, case_dir, parallel): +@pytest.mark.parametrize(('case_dir', 'parallel', 'prop_attr'), product(CASES_DIRS, PARALLEL, PROP_ATTR)) +def test_run_full_case(tmpdir, case_dir, parallel, prop_attr): input_dir = os.path.join(case_dir, 'input') - output_dir = os.path.join(case_dir, 'output') + + output_folder = "output_prop_is_attr" if prop_attr else "output_prop_is_not_attr" + output_dir = os.path.join(case_dir, output_folder) + if not os.path.isdir(output_dir): + output_dir = os.path.join(case_dir, 'output') docs_dir = tmpdir.mkdir('docs').strpath conf = deepcopy(DEFAULT_CONF) conf.update({'automodapi_toctreedirnm': 'api', 'automodapi_writereprocessed': True, - 'automodsumm_writereprocessed': True}) + 'automodsumm_writereprocessed': True, + 'automodsumm_properties_are_attributes': prop_attr}) if os.path.basename(case_dir) in ('mixed_toplevel', 'mixed_toplevel_all_objects', From 80641efd87da018dbbc4a77c984b8ea91c4aeb45 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Fri, 10 Jan 2025 14:38:21 -0500 Subject: [PATCH 097/115] Add test case that mixes attributes with properties --- .../tests/cases/attribute_class/README.md | 2 ++ .../cases/attribute_class/input/index.rst | 1 + ...ule.attribute_class.ClassWithAttribute.rst | 29 +++++++++++++++++ .../output_prop_is_attr/index.rst.automodapi | 19 ++++++++++++ .../output_prop_is_attr/index.rst.automodsumm | 6 ++++ ...ule.attribute_class.ClassWithAttribute.rst | 31 +++++++++++++++++++ .../index.rst.automodapi | 19 ++++++++++++ .../index.rst.automodsumm | 6 ++++ .../tests/example_module/attribute_class.py | 12 +++++++ 9 files changed, 125 insertions(+) create mode 100644 sphinx_automodapi/tests/cases/attribute_class/README.md create mode 100644 sphinx_automodapi/tests/cases/attribute_class/input/index.rst create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodsumm create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodapi create mode 100644 sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodsumm create mode 100644 sphinx_automodapi/tests/example_module/attribute_class.py diff --git a/sphinx_automodapi/tests/cases/attribute_class/README.md b/sphinx_automodapi/tests/cases/attribute_class/README.md new file mode 100644 index 0000000..36c45c6 --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/README.md @@ -0,0 +1,2 @@ +This example is to make sure that classes can have attributes and properties +and they can be distiguished if ``automodsumm_properties_are_attributes = False`` diff --git a/sphinx_automodapi/tests/cases/attribute_class/input/index.rst b/sphinx_automodapi/tests/cases/attribute_class/input/index.rst new file mode 100644 index 0000000..aaea6f9 --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/input/index.rst @@ -0,0 +1 @@ +.. automodapi:: sphinx_automodapi.tests.example_module.attribute_class diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst new file mode 100644 index 0000000..45e84a5 --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst @@ -0,0 +1,29 @@ +ClassWithAttribute +================== + +.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class + +.. autoclass:: ClassWithAttribute + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~ClassWithAttribute.my_attribute + ~ClassWithAttribute.my_property + + .. rubric:: Methods Summary + + .. autosummary:: + + ~ClassWithAttribute.my_method + + .. rubric:: Attributes Documentation + + .. autoattribute:: my_attribute + .. autoattribute:: my_property + + .. rubric:: Methods Documentation + + .. automethod:: my_method diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodapi new file mode 100644 index 0000000..941dcac --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.attribute_class Module +------------------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.attribute_class + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.attribute_class + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.attribute_class + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodsumm new file mode 100644 index 0000000..9aafd6b --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_attr/index.rst.automodsumm @@ -0,0 +1,6 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class + +.. autosummary:: + :toctree: api + + ClassWithAttribute diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst new file mode 100644 index 0000000..3a418d4 --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/api/sphinx_automodapi.tests.example_module.attribute_class.ClassWithAttribute.rst @@ -0,0 +1,31 @@ +ClassWithAttribute +================== + +.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class + +.. autoclass:: ClassWithAttribute + :show-inheritance: + + .. rubric:: Attributes Summary + + .. autosummary:: + + ~ClassWithAttribute.my_attribute + + ~ClassWithAttribute.my_property + + .. rubric:: Methods Summary + + .. autosummary:: + + ~ClassWithAttribute.my_method + + .. rubric:: Attributes Documentation + + .. autoattribute:: my_attribute + + .. autoproperty:: my_property + + .. rubric:: Methods Documentation + + .. automethod:: my_method diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodapi b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodapi new file mode 100644 index 0000000..941dcac --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodapi @@ -0,0 +1,19 @@ + +sphinx_automodapi.tests.example_module.attribute_class Module +------------------------------------------------------------- + +.. automodule:: sphinx_automodapi.tests.example_module.attribute_class + +Classes +^^^^^^^ + +.. automodsumm:: sphinx_automodapi.tests.example_module.attribute_class + :classes-only: + :toctree: api + +Class Inheritance Diagram +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automod-diagram:: sphinx_automodapi.tests.example_module.attribute_class + :private-bases: + :parts: 1 diff --git a/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodsumm b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodsumm new file mode 100644 index 0000000..9aafd6b --- /dev/null +++ b/sphinx_automodapi/tests/cases/attribute_class/output_prop_is_not_attr/index.rst.automodsumm @@ -0,0 +1,6 @@ +.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class + +.. autosummary:: + :toctree: api + + ClassWithAttribute diff --git a/sphinx_automodapi/tests/example_module/attribute_class.py b/sphinx_automodapi/tests/example_module/attribute_class.py new file mode 100644 index 0000000..cc625f7 --- /dev/null +++ b/sphinx_automodapi/tests/example_module/attribute_class.py @@ -0,0 +1,12 @@ +class ClassWithAttribute(object): + """A class with an attribute.""" + my_attribute = 1 + + def my_method(self): + """A method.""" + pass + + @property + def my_property(self): + """A property.""" + return 1 From 84ee7c1365614373abb59bf939379d42d7155b7e Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Fri, 10 Jan 2025 14:40:06 -0500 Subject: [PATCH 098/115] Update documentation with new option --- sphinx_automodapi/automodapi.py | 5 +++++ sphinx_automodapi/automodsumm.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sphinx_automodapi/automodapi.py b/sphinx_automodapi/automodapi.py index eae0803..fdb49d5 100644 --- a/sphinx_automodapi/automodapi.py +++ b/sphinx_automodapi/automodapi.py @@ -104,6 +104,11 @@ class are included in the generated documentation. Defaults to ``False``. methods like ``__getitem__`` and ``__setitem__``. Defaults to ``['__init__', '__call__']``. +* ``automodsumm_properties_are_attributes`` + Should be a bool and if ``True`` properties are treated as attributes in the + documentation meaning that no property specific documentation is generated. + Defaults to ``True``. + .. _automodule: http://sphinx-doc.org/latest/ext/autodoc.html?highlight=automodule#directive-automodule """ diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 49459d7..268a0a7 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -74,6 +74,11 @@ class members that are inherited from a base class. This value can be methods like ``__getitem__`` and ``__setitem__``. Defaults to ``['__init__', '__call__']``. +* ``automodsumm_properties_are_attributes`` + Should be a bool and if ``True`` properties are treated as attributes in the + documentation meaning that no property specific documentation is generated. + Defaults to ``True``. + .. _sphinx.ext.autosummary: http://sphinx-doc.org/latest/ext/autosummary.html .. _autosummary: http://sphinx-doc.org/latest/ext/autosummary.html#directive-autosummary From 09aeffb80e789988b19c957129f76850638effa4 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Fri, 10 Jan 2025 14:52:50 -0500 Subject: [PATCH 099/115] Add changelog entry --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index afd5391..eb5c304 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,10 @@ Changes in sphinx-automodapi 0.19.0 (unreleased) ------------------- +- Add ``automodsumm_properties_are_attributes`` configuration to control if + class properties are treated with ``autoattribute`` or ``autoproperty``. + [#197] + 0.18.0 (2024-09-13) ------------------- From 2e3fc6c48a96c202d45d8d38a0e702ec5bbd6c49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 05:44:18 +0000 Subject: [PATCH 100/115] Bump the actions group with 3 updates Bumps the actions group with 3 updates: [actions/setup-python](https://github.com/actions/setup-python), [codecov/codecov-action](https://github.com/codecov/codecov-action) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `actions/setup-python` from 5.3.0 to 5.4.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/0b93645e9fea7318ecaed2b359559ac225c90a2b...42375524e23c412d93fb67b49958b491fce71c38) Updates `codecov/codecov-action` from 5.1.2 to 5.3.1 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/1e68e06f1dbfde0e4cefc87efeba9e4643565303...13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3) Updates `pypa/gh-action-pypi-publish` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/67339c736fd9354cd4f8cb0b744f2b82a74b5c70...76f52bc884231f62b9a034ebfe128415bbaabdfc) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 8cb5281..a8e07ca 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -76,7 +76,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -99,6 +99,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 95dbec0..f46a52b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: 3.8 @@ -45,7 +45,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 with: user: __token__ password: ${{ secrets.pypi_password }} From 3bd9e9c7a363b9a7646762fad29d7ab59e4766ff Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:39:37 -0500 Subject: [PATCH 101/115] DOC: Unpin outdated RTD sphinx maxversion (#199) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * MNT: Update test matrix, build infra * Fix typo in MANIFEST Co-authored-by: Brigitta Sipőcz --------- Co-authored-by: Brigitta Sipőcz --- .github/workflows/ci_workflows.yml | 9 ++++++--- .github/workflows/publish.yml | 2 +- .readthedocs.yml | 2 +- LICENSE.rst | 2 +- MANIFEST.in | 1 + pyproject.toml | 4 ++-- setup.cfg | 4 +--- setup.py | 5 ----- tox.ini | 3 ++- 9 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index a8e07ca..43a106d 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -48,14 +48,17 @@ jobs: - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-sphinx80 + - os: ubuntu-latest + python-version: '3.12' + toxenv: py312-test-sphinx81 - os: ubuntu-latest python-version: '3.13' toxenv: py313-test-sphinxdev # MacOS X - just the stable and dev - os: macos-latest - python-version: '3.10' - toxenv: py310-test-sphinx80-clocale + python-version: '3.11' + toxenv: py311-test-sphinx81-clocale - os: macos-latest python-version: '3.13' toxenv: py313-test-sphinxdev @@ -66,7 +69,7 @@ jobs: toxenv: py38-test-sphinx_oldest - os: windows-latest python-version: '3.10' - toxenv: py310-test-sphinx80 + toxenv: py310-test-sphinx81 - os: windows-latest python-version: '3.13' toxenv: py313-test-sphinxdev diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f46a52b..5bdb24a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: - python-version: 3.8 + python-version: "3.12" - name: Install dependencies run: | diff --git a/.readthedocs.yml b/.readthedocs.yml index c85d6b6..5109e33 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,7 +7,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.12" jobs: post_checkout: - git fetch --shallow-since=2023-01-01 || true diff --git a/LICENSE.rst b/LICENSE.rst index 4f6e337..ecbe4fc 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,4 +1,4 @@ -Copyright (c) 2014-2016, Astropy Developers +Copyright (c) 2014-2025, Astropy Developers All rights reserved. diff --git a/MANIFEST.in b/MANIFEST.in index 6f1d2ae..1637fde 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include CHANGES.rst include LICENSE.rst include setup.cfg +include pyproject.toml exclude *.pyc *.o prune build diff --git a/pyproject.toml b/pyproject.toml index e06fcb3..9765e29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [build-system] requires = ["setuptools>=30.3.0", - "setuptools_scm", + "setuptools_scm>=8.0.0", "wheel"] build-backend = 'setuptools.build_meta' [tool.setuptools_scm] -write_to = "sphinx_automodapi/version.py" +version_file = "sphinx_automodapi/version.py" diff --git a/setup.cfg b/setup.cfg index a4eec45..6f619d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,7 @@ author_email = astropy.team@gmail.com license = BSD 3-Clause License url = https://github.com/astropy/sphinx-automodapi classifiers = - Development Status :: 3 - Alpha + Development Status :: 5 - Production/Stable Intended Audience :: Developers Programming Language :: Python Programming Language :: Python :: 3 @@ -31,8 +31,6 @@ test = coverage setuptools;python_version>='3.12' rtd = - # https://github.com/readthedocs/sphinx_rtd_theme/issues/1463 - sphinx<7 sphinx-rtd-theme [options.package_data] diff --git a/setup.py b/setup.py deleted file mode 100644 index beda28e..0000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - -setup() diff --git a/tox.ini b/tox.ini index dcf8ab5..aa8bf3b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310,311,312,313}-test-sphinx{_oldest,53,62,70,71,72,80,dev}{-cov}{-clocale} +envlist = py{38,39,310,311,312,313}-test-sphinx{_oldest,53,62,70,71,72,80,81,dev}{-cov}{-clocale} requires = pip >= 18.0 setuptools >= 30.3.0 isolated_build = true @@ -14,6 +14,7 @@ deps = sphinx71: sphinx==7.1.* sphinx72: sphinx==7.2.* sphinx80: sphinx==8.0.* + sphinx81: sphinx==8.1.* sphinxdev: git+https://github.com/sphinx-doc/sphinx.git extras = test: test From 84f4f295e7a8d99886c19094c3469ef34c8ecb15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 05:19:54 +0000 Subject: [PATCH 102/115] Bump codecov/codecov-action from 5.3.1 to 5.4.0 in the actions group Bumps the actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `codecov/codecov-action` from 5.3.1 to 5.4.0 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3...0565863a31f2c772f9f0395002a31e3f06189574) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 43a106d..faa4e20 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -102,6 +102,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 + uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 with: file: ./coverage.xml From c5d3b7fe1928fae6fb463279ee41ca86bafd96d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 05:32:36 +0000 Subject: [PATCH 103/115] Bump actions/setup-python from 5.4.0 to 5.5.0 in the actions group Bumps the actions group with 1 update: [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/setup-python` from 5.4.0 to 5.5.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/42375524e23c412d93fb67b49958b491fce71c38...8d9ed9ac5c53483de85588cdf95a591a75ab9f55) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 5.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index faa4e20..23dbcf4 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5bdb24a..12494ba 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 with: python-version: "3.12" From 27ce711ac71f1b1ac61717fcd5bab5a736b85ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 16 Apr 2025 10:33:28 -0700 Subject: [PATCH 104/115] MAINT: exclude bots from release notes --- .github/release.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d1e098 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - pre-commit-ci From 5a5d9ced88c01476867be314e5388dc7201c64f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 16 Apr 2025 10:56:48 -0700 Subject: [PATCH 105/115] MAINT: adding mailmap to cleanup duplicates --- .mailmap | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..9371398 --- /dev/null +++ b/.mailmap @@ -0,0 +1,12 @@ +Brigitta Sipőcz +Brigitta Sipőcz +David Pérez-Suárez +E. Madison Bray +E. Madison Bray +Kyle D Fawcett <45832007+kylefawcett@users.noreply.github.com> +Hans Moritz Günther +Marco Rossi +Matt Davis +P. L. Lim <2090236+pllim@users.noreply.github.com> +Simon Conseil +Stuart Mumford \ No newline at end of file From be65dd11cd7abb8e535c1fc9fe62068f2d67c452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 17 Apr 2025 12:59:29 -0700 Subject: [PATCH 106/115] CI: install actual test dependencies from config rather than manually listing them --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 12494ba..52ac615 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,7 +40,7 @@ jobs: cd .. python -m venv testenv testenv/bin/pip install pip -U - testenv/bin/pip install pytest cython sphinx-automodapi/dist/*.whl + testenv/bin/pip install sphinx-automodapi/dist/*.whl[test] testenv/bin/pytest sphinx-automodapi/sphinx_automodapi/tests - name: Publish distribution 📦 to PyPI From 6a95b555b921a9b9632f27a7dbfc438ee20a9acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 17 Apr 2025 13:47:22 -0700 Subject: [PATCH 107/115] CI: hacking around wildchar --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 52ac615..7663137 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,7 +40,7 @@ jobs: cd .. python -m venv testenv testenv/bin/pip install pip -U - testenv/bin/pip install sphinx-automodapi/dist/*.whl[test] + testenv/bin/pip install $(ls sphinx-automodapi/dist/*.whl)[test] testenv/bin/pytest sphinx-automodapi/sphinx_automodapi/tests - name: Publish distribution 📦 to PyPI From 58f82096ab8e528d08a13a8613d16b939d0fbb50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 17 Apr 2025 11:21:11 -0700 Subject: [PATCH 108/115] Finalizing changelog for v0.19.0 --- CHANGES.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index eb5c304..618d084 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,13 +1,15 @@ Changes in sphinx-automodapi ============================ -0.19.0 (unreleased) +0.19.0 (2025-04-17) ------------------- - Add ``automodsumm_properties_are_attributes`` configuration to control if class properties are treated with ``autoattribute`` or ``autoproperty``. [#197] +- Fixes compatibility with Sphinx 8.2. [#196] + 0.18.0 (2024-09-13) ------------------- From ed5f54cc3daf2eac34cada71cd318c8858c30a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 17 Apr 2025 11:24:15 -0700 Subject: [PATCH 109/115] Back to development: v0.20.0.dev --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 618d084..07c5d15 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,11 @@ Changes in sphinx-automodapi ============================ +0.20.0 (unreleased) +------------------- + +- No changes yet + 0.19.0 (2025-04-17) ------------------- From ccdfd2bd881fb261e8e337f68c0f4288998f6906 Mon Sep 17 00:00:00 2001 From: "csaba.nemes" Date: Wed, 23 Sep 2020 16:28:45 +0200 Subject: [PATCH 110/115] add support for datalcass fields with no default value --- sphinx_automodapi/autodoc_enhancements.py | 9 ++++++++- sphinx_automodapi/automodsumm.py | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sphinx_automodapi/autodoc_enhancements.py b/sphinx_automodapi/autodoc_enhancements.py index 7721043..4b75f9e 100644 --- a/sphinx_automodapi/autodoc_enhancements.py +++ b/sphinx_automodapi/autodoc_enhancements.py @@ -1,6 +1,8 @@ """ Miscellaneous enhancements to help autodoc along. """ +import dataclasses + from sphinx.ext.autodoc import AttributeDocumenter __all__ = [] @@ -58,7 +60,12 @@ def type_object_attrgetter(obj, attr, *defargs): return base.__dict__[attr] break - return getattr(obj, attr, *defargs) + try: + return getattr(obj, attr, *defargs) + except AttributeError: + # for dataclasses, get the attribute from the __dataclass_fields__ + if dataclasses.is_dataclass(obj): + return obj.__dataclass_fields__[attr].name def setup(app): diff --git a/sphinx_automodapi/automodsumm.py b/sphinx_automodapi/automodsumm.py index 268a0a7..a98bd20 100644 --- a/sphinx_automodapi/automodsumm.py +++ b/sphinx_automodapi/automodsumm.py @@ -103,6 +103,7 @@ class members that are inherited from a base class. This value can be import inspect import os import re +import dataclasses import sphinx from docutils.parsers.rst.directives import flag @@ -595,11 +596,22 @@ def get_members_class(obj, typ, include_public=[], else: names = getattr(obj, '__dict__').keys() + # add dataclass_field names for dataclass classes + if dataclasses.is_dataclass(obj): + dataclass_fieldnames = getattr(obj, '__dataclass_fields__').keys() + names = list(set(list(names) + list(dataclass_fieldnames))) + for name in names: try: documenter = get_documenter(app, safe_getattr(obj, name), obj) except AttributeError: - continue + # for dataclasses try to get the attribute from the __dataclass_fields__ + if dataclasses.is_dataclass(obj): + try: + attr = obj.__dataclass_fields__[name] + documenter = get_documenter(app, attr, obj) + except KeyError: + continue if typ is None or documenter.objtype == typ: items.append(name) # elif typ == 'attribute' and documenter.objtype == 'property': From 2365af06a15267719ecc0051f646132711006511 Mon Sep 17 00:00:00 2001 From: "csaba.nemes" Date: Wed, 23 Sep 2020 16:41:08 +0200 Subject: [PATCH 111/115] add test, raise original AttributeError if dataclass field not found --- sphinx_automodapi/autodoc_enhancements.py | 11 +++++++++-- .../tests/test_autodoc_enhancements.py | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/sphinx_automodapi/autodoc_enhancements.py b/sphinx_automodapi/autodoc_enhancements.py index 4b75f9e..84ec880 100644 --- a/sphinx_automodapi/autodoc_enhancements.py +++ b/sphinx_automodapi/autodoc_enhancements.py @@ -62,10 +62,17 @@ def type_object_attrgetter(obj, attr, *defargs): try: return getattr(obj, attr, *defargs) - except AttributeError: + except AttributeError as e: # for dataclasses, get the attribute from the __dataclass_fields__ if dataclasses.is_dataclass(obj): - return obj.__dataclass_fields__[attr].name + if attr in obj.__dataclass_fields__: + return obj.__dataclass_fields__[attr].name + else: + # raise original AttributeError + raise e + else: + # raise original AttributeError + raise e def setup(app): diff --git a/sphinx_automodapi/tests/test_autodoc_enhancements.py b/sphinx_automodapi/tests/test_autodoc_enhancements.py index 5e3f6de..e60380a 100644 --- a/sphinx_automodapi/tests/test_autodoc_enhancements.py +++ b/sphinx_automodapi/tests/test_autodoc_enhancements.py @@ -41,3 +41,20 @@ def test_type_attrgetter(): assert type_object_attrgetter(MyClass, 'susy', 'default') == 'default' assert type_object_attrgetter(MyClass, '__dict__') == MyClass.__dict__ + + +def test_type_attrgetter_for_dataclass(): + """ + This tests the attribute getter for non-default dataclass fields + """ + import dataclasses + + @dataclasses.dataclass + class MyDataclass: + foo: int + bar: str = "bar value" + + with pytest.raises(AttributeError): + getattr(MyDataclass, 'foo') + assert type_object_attrgetter(MyDataclass, 'foo') == 'foo' + assert getattr(MyDataclass, 'bar') == 'bar value' From e4bea83eadaa0180eb242cdefcaaf07f77e8d37b Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Mon, 28 Apr 2025 07:17:40 -0400 Subject: [PATCH 112/115] Clean up exceptions and conditionals --- sphinx_automodapi/autodoc_enhancements.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sphinx_automodapi/autodoc_enhancements.py b/sphinx_automodapi/autodoc_enhancements.py index 84ec880..e5f304b 100644 --- a/sphinx_automodapi/autodoc_enhancements.py +++ b/sphinx_automodapi/autodoc_enhancements.py @@ -62,17 +62,12 @@ def type_object_attrgetter(obj, attr, *defargs): try: return getattr(obj, attr, *defargs) - except AttributeError as e: + except AttributeError: # for dataclasses, get the attribute from the __dataclass_fields__ - if dataclasses.is_dataclass(obj): - if attr in obj.__dataclass_fields__: - return obj.__dataclass_fields__[attr].name - else: - # raise original AttributeError - raise e + if dataclasses.is_dataclass(obj) and attr in obj.__dataclass_fields__: + return obj.__dataclass_fields__[attr].name else: - # raise original AttributeError - raise e + raise def setup(app): From ec44299749ef054d012285dc1886a196dea13c55 Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Mon, 28 Apr 2025 07:31:17 -0400 Subject: [PATCH 113/115] Don't treat name of field as default value --- sphinx_automodapi/autodoc_enhancements.py | 2 +- sphinx_automodapi/tests/test_autodoc_enhancements.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx_automodapi/autodoc_enhancements.py b/sphinx_automodapi/autodoc_enhancements.py index e5f304b..8350638 100644 --- a/sphinx_automodapi/autodoc_enhancements.py +++ b/sphinx_automodapi/autodoc_enhancements.py @@ -65,7 +65,7 @@ def type_object_attrgetter(obj, attr, *defargs): except AttributeError: # for dataclasses, get the attribute from the __dataclass_fields__ if dataclasses.is_dataclass(obj) and attr in obj.__dataclass_fields__: - return obj.__dataclass_fields__[attr].name + return obj.__dataclass_fields__[attr].default else: raise diff --git a/sphinx_automodapi/tests/test_autodoc_enhancements.py b/sphinx_automodapi/tests/test_autodoc_enhancements.py index e60380a..bd1fc36 100644 --- a/sphinx_automodapi/tests/test_autodoc_enhancements.py +++ b/sphinx_automodapi/tests/test_autodoc_enhancements.py @@ -56,5 +56,5 @@ class MyDataclass: with pytest.raises(AttributeError): getattr(MyDataclass, 'foo') - assert type_object_attrgetter(MyDataclass, 'foo') == 'foo' + assert type_object_attrgetter(MyDataclass, 'foo') == dataclasses.MISSING assert getattr(MyDataclass, 'bar') == 'bar value' From b3c725f28b99904982865188b73d2433b18e2911 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 05:56:46 +0000 Subject: [PATCH 114/115] Bump the actions group with 2 updates Bumps the actions group with 2 updates: [actions/setup-python](https://github.com/actions/setup-python) and [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `actions/setup-python` from 5.5.0 to 5.6.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/8d9ed9ac5c53483de85588cdf95a591a75ab9f55...a26af69be951a213d495a4c3e4e4022e16d87065) Updates `codecov/codecov-action` from 5.4.0 to 5.4.2 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/0565863a31f2c772f9f0395002a31e3f06189574...ad3126e916f78f00edff4ed0317cf185271ccc2d) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 5.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: codecov/codecov-action dependency-version: 5.4.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 4 ++-- .github/workflows/publish.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 23dbcf4..678fdba 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -102,6 +102,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0 + uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2 with: file: ./coverage.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7663137..aaf879d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.12" From b8701617620e88c7e8a27d1f81a34ed181a6957e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 06:02:35 +0000 Subject: [PATCH 115/115] Bump codecov/codecov-action from 5.4.2 to 5.4.3 in the actions group Bumps the actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `codecov/codecov-action` from 5.4.2 to 5.4.3 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/ad3126e916f78f00edff4ed0317cf185271ccc2d...18283e04ce6e62d37312384ff67231eb8fd56d24) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 5.4.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 678fdba..fd4a238 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -102,6 +102,6 @@ jobs: run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2 + uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 with: file: ./coverage.xml