-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi,
I found an issue where building a sphinx documentation breaks when one of our package's dependencies lazy loads a package.
In our particular case we depend on qcodes
that lazy loads the h5py
package.
When building the documentation, it fails with the following trace stack
[AutoAPI] Reading files... [ 1%] /home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/checkouts/545/quantify_scheduler/gettables_profiled.py
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/sphinx/events.py", line 94, in emit
results.append(listener.handler(self.app, *args))
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/autoapi/extension.py", line 164, in run_autoapi
if sphinx_mapper_obj.load(
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/autoapi/mappers/python/mapper.py", line 306, in load
data = self.read_file(path=path, dir_root=dir_root)
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/autoapi/mappers/python/mapper.py", line 323, in read_file
parsed_data = Parser().parse_file(path)
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/autoapi/mappers/python/parser.py", line 41, in parse_file
return self._parse_file(
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/autoapi/mappers/python/parser.py", line 37, in _parse_file
node = astroid.builder.AstroidBuilder().file_build(file_path, module_name)
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/astroid/builder.py", line 135, in file_build
return self._post_build(module, builder, encoding)
...
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/astroid/raw_building.py", line 82, in attach_const_node
_attach_local_node(node, nodes.const_factory(value), name)
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/astroid/nodes/node_classes.py", line 5531, in const_factory
instance.postinit(_create_dict_items(value, instance))
File "/home/docs/checkouts/readthedocs.org/user_builds/quantify-quantify-scheduler/envs/545/lib/python3.8/site-packages/astroid/nodes/node_classes.py", line 5502, in _create_dict_items
for key, value in values.items():
RuntimeError: dictionary changed size during iteration
which is not very clear to me. I can make the build succeed by adding the line import h5py
to docs/conf.py
, so the root cause is very likely due to the lazy loading of h5py
.
I don't have a nice minimal working example, other than cloning our repo and building the documentation yourselves:
mkdir tmp
cd tmp
git clone --no-single-branch --depth 50 [email protected]:quantify-os/quantify-scheduler.git .
git fetch origin --force --tags --prune --prune-tags --depth 50 merge-requests/545/head:external-545
git checkout --force a7cc1ff360a2da8bb64f44f405a5b7bc5f3389fc
git clean -d -f -f
conda create --name tmp python=3.8
conda activate tmp
pip install quantify-scheduler
pip install -r requirements_dev.txt
pip install qcodes==0.36.0
cd docs
python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
which fails, but after a echo "import h5py" >> conf.py
and running the sphinx build again it succeeds.
Metadata
Metadata
Assignees
Labels
No labels