From a786590906996fe282b95b7d5e781f7d5a2625a0 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 30 Mar 2026 01:32:53 +0700 Subject: [PATCH] docs/conf.py: silence autosectionlabel duplicate-label warnings sphinxarg.ext generates generic sub-headings ("Named arguments", "Positional arguments", "Sub-commands", "General options", ...) for every argparse command and tool. These repeat across many files and trigger large numbers of autosectionlabel duplicate-label warnings. Two-pronged fix: * `autosectionlabel_maxdepth = 3` eliminates the depth-4+ warnings (sub-headings inside each individual command block). * `suppress_warnings` per file silences the residual depth-3 collisions ("serial reader", "decode_hex", "sub-commands", ...) that still appear across tool documentation files. Cross-references into these generic argparse-generated sections are not a supported use-case, so suppressing the warnings is appropriate. Change-Id: I9cdf2a4f6cbd435b16b90ab668205600ffd7c3b0 --- docs/conf.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index ef400701..dc868177 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,3 +64,20 @@ html_theme = 'alabaster' html_static_path = ['_static'] autoclass_content = 'both' + +# Workaround for duplicate label warnings: +# https://github.com/sphinx-doc/sphinx-argparse/issues/14 +# +# sphinxarg.ext generates generic sub-headings ("Named arguments", +# "Positional arguments", "Sub-commands", "General options", ...) for every +# argparse command/tool. These repeat across many files and trigger tons +# of autosectionlabel duplicate-label warnings - suppress them. +autosectionlabel_maxdepth = 3 +suppress_warnings = [ + 'autosectionlabel.saip-tool', + 'autosectionlabel.shell', + 'autosectionlabel.smpp2sim', + 'autosectionlabel.smpp-ota-tool', + 'autosectionlabel.suci-keytool', + 'autosectionlabel.trace', +]