Skip to content

fix(doxygen.py): access default config value through attribute access#1480

Merged
peterjunpark merged 1 commit intodevelopfrom
fix/doxygen-default-config-value
Mar 3, 2026
Merged

fix(doxygen.py): access default config value through attribute access#1480
peterjunpark merged 1 commit intodevelopfrom
fix/doxygen-default-config-value

Conversation

@peterjunpark
Copy link
Contributor

@peterjunpark peterjunpark commented Mar 3, 2026

Motivation

Fix the following warning when Sphinx < 9.

 RemovedInSphinx90Warning: The '_Opt' object tuple interface is deprecated, use attribute access instead for 'def
ault', 'rebuild', and 'valid_types'.

Fix the following error in Sphinx >= 9.

Traceback
=========

    Traceback (most recent call last):
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/sphinx/events.py", line 441, in emit
        results.append(listener.handler(self._app, *args))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/rocm_docs/doxygen.py", line 93, in _run_doxygen
        _update_breathe_settings(app, doxygen_root)
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/rocm_docs/doxygen.py", line 109, in _update_breathe_settings
        default: dict[str, None | str | os.PathLike[Any]] = _get_config_default(
                                                            ^^^^^^^^^^^^^^^^^^^^
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/rocm_docs/doxygen.py", line 41, in _get_config_default
        default_or_callable = config.values[key][0]
                              ~~~~~~~~~~~~~~~~~~^^^
    TypeError: '_Opt' object is not subscriptable
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/sphinx/cmd/build.py", line 414, in build_main
        app = Sphinx(
              ^^^^^^^
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/sphinx/application.py", line 325, in __init__
        self.events.emit('config-inited', self.config)
      File "/home/petepark/amd/venv312/lib/python3.12/site-packages/sphinx/events.py", line 452, in emit
        raise ExtensionError(
    sphinx.errors.ExtensionError: Handler <function _run_doxygen at 0x7344a17a3600> for event 'config-inited' threw an exception (exception: '_Opt' object is not subscriptable)

Technical Details

Access the default configuration value using values.default instead of values[0].

sphinx-doc/sphinx@fd23cf0#diff-5d140f836bc002529fa8bd76ae49b359f0546739c80e44a4c396fa5eb8d8e2d8R149 shows that values[0] == values.default

Test Plan

Tested locally with Sphinx 8 (Python 3.10) and Sphinx 9 (Python 3.12)

Test Result

No change in output. Warning is gone. Fixes build-blocking error if Sphinx >= 9.

Submission Checklist

The tuple interface is deprecated in Sphinx <9 and removed >=9.
@alexxu-amd alexxu-amd self-requested a review March 3, 2026 21:56
Copy link
Contributor

@alexxu-amd alexxu-amd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@peterjunpark peterjunpark merged commit 7a6cd1a into develop Mar 3, 2026
7 checks passed
@peterjunpark peterjunpark deleted the fix/doxygen-default-config-value branch March 4, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants