sphinx-doc / sphinx-doc/sphinx
Nested dictionaries/lists not supported by `sphinx-build --define`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Trying to customize the values of intersphinx_mapping with sphinx-build --define, I only get errors.
How to Reproduce
Any conf.py will work. Run:
sphinx-build --define intersphinx_mapping.python=http://localhost:8001,None -b html . _build/html
The expected result is that it corresponds to something like:
intersphinx_mapping = {"python": ["http://localhost:8001", "None"]}
But I get this error:
ERROR: Invalid value `'http://localhost:8001,None'` in intersphinx_mapping['python']. Expected a two-element tuple or list.
With an already populated intersphinx_mapping, I also tried to override only the first item of the tuple with this value: intersphinx_mapping.python.0=http://localhost:8001 It does not work.
Environment Information
Platform: linux; (Linux-6.18.35-1.qubes.fc41.x86_64-x86_64-with-glibc2.41)
Python version: 3.13.5 (main, Jun 13 2026, 14:18:01) [GCC 14.2.0])
Python implementation: CPython
Sphinx version: 9.1.0
Docutils version: 0.21.2
Jinja2 version: 3.1.6
Pygments version: 2.20.0
Sphinx extensions
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with any conf.py using sphinx-build --define intersphinx_mapping.python=http://localhost:8001,None, then trace how the --define entry is parsed and validated. Done means nested dictionaries and lists, including the intersphinx_mapping example and indexed tuple item, can be configured without the reported validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100