So it's a multi-value, multiple option option. During make html I get a TypeError in sphinx_click/ext.py:
[…]
File "[…]/.cache/pypoetry/virtualenvs/[…]/lib/python3.9/site-packages/sphinx_click/ext.py", line 86, in _get_help_record
', '.join('%s' % d for d in opt.default)
File "/home/thomas/.cache/pypoetry/virtualenvs/onetwo-reporting-s9O3aHpb-py3.9/lib/python3.9/site-packages/sphinx_click/ext.py", line 86, in <genexpr>
', '.join('%s' % d for d in opt.default)
TypeError: not all arguments converted during string formatting
But I've managed to solve the issue by replacing the old-school %-formatting with a cast and f-strings in the else block in ext.py starting on line 83:
default_str = ', '.join(
str(d) for d in opt.default
) if isinstance(opt.default, (list, tuple)) else opt.default
extras.append(f':default: {default_str}')
My versions:
Python 3.9.9
Sphinx 4.4.0
sphinx-click 3.0.2
Sorry for the cryptic title, please change if you have a better idea.
PS: I just noticed that if I declare default=[["foo", "bar"]] the error goes away also. Since the click docs aren't clear on how to define the defaults in this case, I'll still leave this here in case anybody wants to fix it in the future.
I have an option to a subcommand set up like this:
So it's a multi-value, multiple option option. During
make html
I get aTypeError
insphinx_click/ext.py
:But I've managed to solve the issue by replacing the old-school %-formatting with a cast and f-strings in the
else
block inext.py
starting on line 83:My versions:
Sorry for the cryptic title, please change if you have a better idea.
PS: I just noticed that if I declare
default=[["foo", "bar"]]
the error goes away also. Since theclick
docs aren't clear on how to define the defaults in this case, I'll still leave this here in case anybody wants to fix it in the future.