-
-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Describe the bug
if you set members = true
in options (either global and local) it will break with a bool object is not iterable
despite the docs saying that members
can take a bool value. (https://mkdocstrings.github.io/python/usage/configuration/members/#members)
To Reproduce
- set options.members = true
- run
mkdocs serve
- get error
Expected behavior
That it will not break and simple render all members as the docs say.
System (please complete the following information):
mkdocstrings-python
version: 1.2.0- Python version: 3.9.14
- OS: Ubuntu 22.04.1 LTS, on WSL2.
Additional context
Stacktrace
sras@BLS00CB:~/dev/mkdocstrings_bug$ poetry run mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
> /home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/handler.py(314)render()
-> final_config["members_order"] = rendering.Order(final_config["members_order"])
(Pdb) c
ERROR - Error reading page 'api.md': 'bool' object is not iterable
Traceback (most recent call last):
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 83, in serve
builder(config)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 76, in builder
build(config, live_server=live_server, dirty=dirty)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 308, in build
_populate_page(file.page, config, files, dirty)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/commands/build.py", line 181, in _populate_page
page.render(config, files)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 270, in render
self.content = md.convert(self.markdown)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/markdown/core.py", line 264, in convert
root = self.parser.parseDocument(self.lines).getroot()
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/markdown/blockparser.py", line 90, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/markdown/blockparser.py", line 105, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/markdown/blockparser.py", line 123, in parseBlocks
if processor.run(parent, blocks) is not False:
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings/extension.py", line 127, in run
html, handler, data = self._process_block(identifier, block, heading_level)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings/extension.py", line 213, in _process_block
rendered = handler.render(data, options)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/handler.py", line 314, in render
final_config["members_order"] = rendering.Order(final_config["members_order"])
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/module.html", line 1, in top-level template code
{% extends "_base/module.html" %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 55, in top-level template code
{% block contents scoped %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 62, in block 'contents'
{% block children scoped %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 66, in block 'children'
{% include "children.html" with context %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/children.html", line 1, in top-level template code
{% extends "_base/children.html" %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/templates/material/_base/children.html", line 53, in top-level template code
{% for class in classes|order_members(config.members_order, members_list) %}
File "/home/sras/.cache/pypoetry/virtualenvs/mkdocstrings-bug-ubRBav-y-py3.9/lib/python3.9/site-packages/mkdocstrings_handlers/python/rendering.py", line 127, in do_order_members
for name in members_list:
TypeError: 'bool' object is not iterable
I know that it is the same as simple not setting the members
option, I was just trying options because I wanted to see if I could make re-exported modules from X import y as y
be rendered.
It happens here but I wasn't sure if you want to parse true
to []
before we hit this or just guard against it in the function itself.