pyodide / pyodide/sphinx-js

KeyError: 'id' processing TypeDoc

Open
#154 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
290
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Just tried out sphinx-js 3.1 on https://github.com/microsoft/bistring. I'm getting the following error:

Handler <function analyze at 0x7f6538653550> for event 'builder-inited' threw an exception (exception: 'id')

I patched sphinx up a bit to get this trace:

Traceback (most recent call last):
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx/events.py", line 110, in emit
    results.append(listener.handler(self.app, *args))
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/__init__.py", line 60, in analyze
    app._sphinxjs_analyzer = analyzer.from_disk(abs_source_paths,
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 40, in from_disk
    return cls(json, base_dir)
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 29, in __init__
    ir_objects = self._convert_all_nodes(json)
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 113, in _convert_all_nodes
    converted, more_todo = self._convert_node(todo.pop())
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 160, in _convert_node
    interfaces=self._related_types(node, kind='implementedTypes'),
  File "/home/tavianator/.local/share/virtualenvs/docs-BrgkGiab/lib/python3.8/site-packages/sphinx_js/typedoc.py", line 227, in _related_types
    pathname = Pathname(make_path_segments(self._index[type['id']],
KeyError: 'id'

Which points here.

The variable type looks like this:

{'type': 'reference', 'typeArguments': [{'type': 'reference', 'name': 'String'}], 'name': 'Iterable'}

So I expect the relevant code is this line.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in sphinx_js/typedoc.py at _related_types and follow the _convert_node path shown in the traceback; compare the TypeDoc data from bistring.ts line 17 with the expected index entries. Reproduce against microsoft/bistring and verify that builder-inited analysis completes without KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.