From 3a72a6b56c2a193441c755e61f41a977e6a6e7fe Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:07 +0200 Subject: [PATCH 1/7] Add python version requirement to setup.py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index eed8907d..a8a307e8 100644 --- a/setup.py +++ b/setup.py @@ -57,5 +57,6 @@ "breathe-apidoc = breathe.apidoc:main", ], }, + python_requires='>=3.7', install_requires=requires, ) From 54766e924928492d486e0e0948997a917076f516 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:07 +0200 Subject: [PATCH 2/7] Bump Python to >= 3.7 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index bfc11d78..ac701eb5 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,7 @@ branch. Requirements ------------ -Breathe requires Python 3.6+, Sphinx 4.0+ and Doxygen 1.8+. +Breathe requires Python 3.7+, Sphinx 4.0+ and Doxygen 1.8+. Mailing List Archives --------------------- From b361bfcb53139aaa482bc803cf501bb0cd9dec80 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:07 +0200 Subject: [PATCH 3/7] Update GH Action to current release --- .github/workflows/documentation.yml | 8 ++++---- .github/workflows/lint.yml | 6 +++--- .github/workflows/unit_tests.yml | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e4ede026..f69712c0 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -6,8 +6,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 + - uses: actions/checkout@v4 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} @@ -15,7 +15,7 @@ jobs: ${{ runner.os }}-pip- - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 - name: install dependencies run: | @@ -39,7 +39,7 @@ jobs: make html rm documentation/build/html/.buildinfo - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: docs build artifacts path: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5134e533..df95dfb2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,15 +6,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 + - uses: actions/checkout@v4 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 - name: install dependencies run: | diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 7a797984..4cb17e6a 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -36,15 +36,15 @@ jobs: sphinx-version: '6.1.3' steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 + - uses: actions/checkout@v4 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} From da1502e8e141fda1962b1bfdf1b6c680c911efdf Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:08 +0200 Subject: [PATCH 4/7] Update dependencies & GH Actions * Drop EOL python 3.7 * Remove sphinx <4.3 * Add latest sphinx 6.2 * Add sphinx 7 * Ad python 3.11 * Refactor GH Actions unit-test: allow tests to fail --- .github/workflows/unit_tests.yml | 49 ++++++++++++++++++-------------- README.rst | 2 +- requirements/development.txt | 2 +- requirements/production.txt | 10 +++---- setup.py | 10 +++---- tests/test_renderer.py | 1 - 6 files changed, 39 insertions(+), 35 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 4cb17e6a..e9a71fa3 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -7,34 +7,39 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] sphinx-version: - - '4.0.3' - - '4.1.2' - - '4.2.0' - '4.3.2' - '4.5.0' - '5.0.2' - '5.1.1' - '5.3.0' - '6.1.3' - - git+https://github.com/sphinx-doc/sphinx.git@master - exclude: - # avoid bug in following configurations - # sphinx/util/typing.py:37: in - # from types import Union as types_Union - # ImportError: cannot import name 'Union' from 'types' + - '6.2.1' + - '7.0.1' + - '7.1.2' + experimental: [ false ] # experimental = false => test must pass + include: + # Tests with '7.2.6' currently fail. + - python-version: '3.9' + sphinx-version: '7.2.6' + experimental: true - python-version: '3.10' - sphinx-version: '4.0.3' + sphinx-version: '7.2.6' + experimental: true + - python-version: '3.11' + sphinx-version: '7.2.6' + experimental: true + - python-version: '3.9' + sphinx-version: git+https://github.com/sphinx-doc/sphinx.git@master + experimental: true - python-version: '3.10' - sphinx-version: '4.1.2' - - # Sphinx has removed support for Python 3.7, Breathe will follow. - - python-version: '3.7' sphinx-version: git+https://github.com/sphinx-doc/sphinx.git@master - - python-version: '3.7' - sphinx-version: '6.1.3' - + experimental: true + - python-version: '3.11' + sphinx-version: git+https://github.com/sphinx-doc/sphinx.git@master + experimental: true + continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v4 - uses: actions/cache@v3 @@ -48,6 +53,10 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: install dependencies + run: | + pip install -r requirements/development.txt + - name: install sphinx from PyPI or from git run: | if echo "${{ matrix.sphinx-version }}"|grep -q git; then @@ -56,9 +65,5 @@ jobs: pip install -Iv Sphinx==${{ matrix.sphinx-version }} fi - - name: install dependencies - run: | - pip install -r requirements/development.txt - - name: run the unit tests run: make dev-test diff --git a/README.rst b/README.rst index ac701eb5..cdb7be03 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,7 @@ branch. Requirements ------------ -Breathe requires Python 3.7+, Sphinx 4.0+ and Doxygen 1.8+. +Breathe requires Python 3.8+, Sphinx 4.3+ and Doxygen 1.9+. Mailing List Archives --------------------- diff --git a/requirements/development.txt b/requirements/development.txt index 35b1c56d..5be05195 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -5,7 +5,7 @@ pip-tools>=0.3.5 pytest mypy>=0.900 -types-docutils>=0.14,<0.18 +types-docutils>=0.16,<0.21 types-Pygments black==22.3.0 diff --git a/requirements/production.txt b/requirements/production.txt index 816dbe45..915c42f3 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,5 +1,5 @@ -docutils>=0.12 -Jinja2>=2.7.3 -MarkupSafe>=0.23 -Pygments>=1.6 -Sphinx>=4.0,!=5.0.0 +docutils>=0.16 +Jinja2>=2.10 +MarkupSafe>=2.0 +Pygments>=2.0 +Sphinx>=4.3,!=5.0.0 diff --git a/setup.py b/setup.py index a8a307e8..84cddc5c 100644 --- a/setup.py +++ b/setup.py @@ -14,13 +14,13 @@ long_desc = """ Breathe is an extension to reStructuredText and Sphinx to be able to read and - render `Doxygen `__ xml output. + render `Doxygen `__ xml output. """ -requires = ["Sphinx>=4.0,!=5.0.0", "docutils>=0.12"] +requires = ["Sphinx>=4.3,!=5.0.0", "docutils>=0.16"] -if sys.version_info < (3, 7): - print("ERROR: Sphinx requires at least Python 3.7 to run.") +if sys.version_info < (3, 8): + print("ERROR: Sphinx requires at least Python 3.8 to run.") sys.exit(1) @@ -57,6 +57,6 @@ "breathe-apidoc = breathe.apidoc:main", ], }, - python_requires='>=3.7', + python_requires='>=3.8', install_requires=requires, ) diff --git a/tests/test_renderer.py b/tests/test_renderer.py index a858c65d..6dc1e17d 100644 --- a/tests/test_renderer.py +++ b/tests/test_renderer.py @@ -23,7 +23,6 @@ sphinx_test_tempdir, rootdir, ) -from sphinx.testing.path import path sphinx.locale.init([], "") From 50967392f98c254b85718637c64f206a632552a2 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:08 +0200 Subject: [PATCH 5/7] Remove legacy code sphinx <4 --- breathe/renderer/sphinxrenderer.py | 2 -- tests/test_renderer.py | 29 ++++++++--------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/breathe/renderer/sphinxrenderer.py b/breathe/renderer/sphinxrenderer.py index dff0c982..8d1afa21 100644 --- a/breathe/renderer/sphinxrenderer.py +++ b/breathe/renderer/sphinxrenderer.py @@ -701,8 +701,6 @@ def content(contentnode): n = declarator[0] newStyle = True # the new style was introduced in Sphinx v4 - if sphinx.version_info[0] < 4: - newStyle = False # but only for the C and C++ domains if self.get_domain() and self.get_domain() not in ("c", "cpp"): newStyle = False diff --git a/tests/test_renderer.py b/tests/test_renderer.py index 6dc1e17d..fed6fc1d 100644 --- a/tests/test_renderer.py +++ b/tests/test_renderer.py @@ -329,21 +329,15 @@ def test_render_func(app): ) signature = find_node(render(app, member_def), "desc_signature") assert signature.astext().startswith("void") - if sphinx.version_info[0] < 4: - assert find_node(signature, "desc_name")[0] == "foo" - else: - n = find_node(signature, "desc_name")[0] - assert isinstance(n, sphinx.addnodes.desc_sig_name) - assert len(n) == 1 - assert n[0] == "foo" + n = find_node(signature, "desc_name")[0] + assert isinstance(n, sphinx.addnodes.desc_sig_name) + assert len(n) == 1 + assert n[0] == "foo" params = find_node(signature, "desc_parameterlist") assert len(params) == 1 param = params[0] - if sphinx.version_info[0] < 4: - assert param[0] == "int" - else: - assert isinstance(param[0], sphinx.addnodes.desc_sig_keyword_type) - assert param[0][0] == "int" + assert isinstance(param[0], sphinx.addnodes.desc_sig_keyword_type) + assert param[0][0] == "int" def test_render_typedef(app): @@ -372,15 +366,8 @@ def test_render_c_function_typedef(app): ) signature = find_node(render(app, member_def, domain="c"), "desc_signature") assert signature.astext().startswith("typedef void *") - if sphinx.version_info[0] < 4: - params = find_node(signature, "desc_parameterlist") - assert len(params) == 2 - assert params[0].astext() == "float" - assert params[1].astext() == "int" - else: - # the use of desc_parameterlist in this case was not correct, - # it should only be used for a top-level function - pass + # the use of desc_parameterlist in this case was not correct, + # it should only be used for a top-level function def test_render_using_alias(app): From b37a69c5e73747c570be39950f958fa289a637cf Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Wed, 27 Sep 2023 01:12:08 +0200 Subject: [PATCH 6/7] Remove legacy code sphinx <4.3 --- breathe/renderer/sphinxrenderer.py | 46 ++---------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/breathe/renderer/sphinxrenderer.py b/breathe/renderer/sphinxrenderer.py index 8d1afa21..16761db2 100644 --- a/breathe/renderer/sphinxrenderer.py +++ b/breathe/renderer/sphinxrenderer.py @@ -907,47 +907,6 @@ def pullup(node, typ, dest): fieldList.extend(fl) fieldLists = [fieldList] - # collapse retvals into a single return field - if len(fieldLists) != 0 and sphinx.version_info[0:2] < (4, 3): - others: List[nodes.field] = [] - retvals: List[nodes.field] = [] - f: nodes.field - fn: nodes.field_name - fb: nodes.field_body - for f in fieldLists[0]: - fn, fb = f - assert len(fn) == 1 - if fn.astext().startswith("returns "): - retvals.append(f) - else: - others.append(f) - if len(retvals) != 0: - items: List[nodes.paragraph] = [] - for fn, fb in retvals: - # we created the retvals before, so we made this prefix - assert fn.astext().startswith("returns ") - val = nodes.strong("", fn.astext()[8:]) - # assumption from visit_docparamlist: fb is a single paragraph or nothing - assert len(fb) <= 1, fb - bodyNodes = [val, nodes.Text(" -- ")] - if len(fb) == 1: - assert isinstance(fb[0], nodes.paragraph) - bodyNodes.extend(fb[0]) - items.append(nodes.paragraph("", "", *bodyNodes)) - # only make a bullet list if there are multiple retvals - body: Node - if len(items) == 1: - body = items[0] - else: - body = nodes.bullet_list() - for i in items: - body.append(nodes.list_item("", i)) - fRetvals = nodes.field( - "", nodes.field_name("", "returns"), nodes.field_body("", body) - ) - fl = nodes.field_list("", *others, fRetvals) - fieldLists = [fl] - if self.app.config.breathe_order_parameters_first: return detailed + fieldLists + admonitions else: @@ -2246,7 +2205,7 @@ def visit_templateparam( dom = "cpp" appendDeclName = True if insertDeclNameByParsing: - if dom == "cpp" and sphinx.version_info >= (4, 1, 0): + if dom == "cpp": parser = cpp.DefinitionParser( "".join(n.astext() for n in nodelist), location=self.state.state_machine.get_source_and_line(), @@ -2311,8 +2270,7 @@ def visit_docparamlist(self, node) -> List[Node]: "param": "param", "exception": "throws", "templateparam": "tparam", - # retval support available on Sphinx >= 4.3 - "retval": "returns" if sphinx.version_info[0:2] < (4, 3) else "retval", + "retval": "retval", } # https://docutils.sourceforge.io/docs/ref/doctree.html#field-list From e4f97a993fde7a7bc6e3d4c4069a019dfc448efc Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Tue, 30 Jul 2024 03:05:43 +0100 Subject: [PATCH 7/7] post-merge --- .github/workflows/unit_tests.yml | 4 ---- pyproject.toml | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 915ebf7b..0c95b400 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -33,10 +33,6 @@ jobs: run: | pip install ".[test]" - - name: install dependencies - run: | - pip install -r requirements/development.txt - - name: install sphinx from PyPI or from git run: | if echo "${{ matrix.sphinx-version }}"|grep -q git; then diff --git a/pyproject.toml b/pyproject.toml index 1f21f7a5..d686bd5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,10 +45,10 @@ classifiers = [ ] dependencies = [ "Sphinx>=5.0.2", - "docutils>=0.12", - "Jinja2>=2.7.3", - "MarkupSafe>=0.23", - "Pygments>=1.6", + "docutils>=0.16", + "Jinja2>=2.10", + "MarkupSafe>=2.0", + "Pygments>=2.0", ] dynamic = ["version"]