Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion in griffe #83

Closed
roastduck opened this issue Jun 8, 2022 · 6 comments
Closed

Infinite recursion in griffe #83

roastduck opened this issue Jun 8, 2022 · 6 comments
Labels
bug Something isn't working griffe: wildcard-imports Related to wildcard imports

Comments

@roastduck
Copy link

Describe the bug
I went into infinite recursion after upgrading mkdocstrings to 0.19, which begins to use griffe.

The stack trace is very long. Its first part is as below:

ERROR    -  Error reading page 'api.md': maximum recursion depth exceeded
Traceback (most recent call last):
  File "/home/rd/venv-freetensor/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/click/core.py", line [10](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:11)55, in main
    rv = self.invoke(ctx)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocs/__main__.py", line 215, in gh_deploy_command
    build.build(cfg, dirty=not clean)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocs/commands/build.py", line 292, in build
    _populate_page(file.page, config, files, dirty)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocs/commands/build.py", line 174, in _populate_page
    page.render(config, files)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 175, in render
    self.content = md.convert(self.markdown)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/markdown/core.py", line 264, in convert
    root = self.parser.parseDocument(self.lines).getroot()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/markdown/blockparser.py", line 90, in parseDocument
    self.parseChunk(self.root, '\n'.join(lines))
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/markdown/blockparser.py", line 105, in parseChunk
    self.parseBlocks(parent, text.split('\n\n'))
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/markdown/blockparser.py", line 123, in parseBlocks
    if processor.run(parent, blocks) is not False:
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocstrings/extension.py", line 121, in run
    html, handler, data = self._process_block(identifier, block, heading_level)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocstrings/extension.py", line 195, in _process_block
    data: CollectorItem = handler.collect(identifier, options)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/mkdocstrings_handlers/python/handler.py", line 195, in collect
    unresolved, iterations = loader.resolve_aliases(only_exported=True, only_known_modules=True)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/loader.py", line 179, in resolve_aliases
    self.expand_wildcards(wildcards_module)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/loader.py", line 247, in expand_wildcards
    self.expand_wildcards(target, only_known_modules)  # type: ignore[union-attr]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/loader.py", line 267, in expand_wildcards
    obj[new_member.name] = Alias(
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 79, in __setitem__
    value.parent = self
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 888, in parent
    self._target.aliases[self.path] = self  # type: ignore[union-attr]  # we just checked the target is not None
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 8[11](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:12), in __getattr__
    attr = getattr(self.target, name)
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 9[20](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:21), in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line [27](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:28), in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 9[44](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:45), in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line [82](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:83)0, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line [92](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:93)0, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line [94](https://github.com/roastduck/FreeTensor/runs/6792201094?check_suite_focus=true#step:4:95)4, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 944, in resolve_target
    resolved = self.modules_collection[self.target_path]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 820, in __getitem__
    return self.target[key]
  File "/home/rd/venv-freetensor/lib/python3.9/site-packages/griffe/dataclasses.py", line 920, in target
    self.resolve_target()

The full log is at here.

To Reproduce
I went into this issue for my Github repo. You can build the document following the guide. Please let me know if this requires too much effort, and I may try to provide a minimal reproduction.

Expected behavior
The doc should be built.

System (please complete the following information):

  • griffe version: 0.20.0
  • Python version: 3.9
  • OS: Linux
@pawamoy
Copy link
Member

pawamoy commented Jun 9, 2022

Hello, thanks for the report!

I was able to replicate. The issue is again with wildcard imports. They're a PITA to handle 😅
I can push a patch that will allow you to build your docs, though the results might be unexpected (your Python API page currently shows nothing on my end with the patch).

Supporting wildcard imports as well as Python itself through inference will require quite important changes in Griffe. This won't happen very soon 🙂 But I'll add a way to fallback on introspection for such difficult cases.

Also note that you can still use latest mkdocstrings with the legacy Python handler: just depend on mkdocstrings-python-legacy instead of mkdocstrings-python, or use the python-legacy extra instead of the python one.

@pawamoy pawamoy added bug Something isn't working griffe: wildcard-imports Related to wildcard imports labels Jun 9, 2022
pawamoy added a commit that referenced this issue Sep 23, 2022
@pawamoy
Copy link
Member

pawamoy commented Sep 23, 2022

I know it's been long since you opened this, but if you get the chance, could you try to build your docs using griffe's fix-more-alias-errors branch?

@roastduck
Copy link
Author

roastduck commented Sep 26, 2022

Could you please a guide on how to install griffe's fix-more-alias-errors branch? It seems there is no setup.py.

I found the contribution guide. I have had a try, and the doc looks fine :)

@pawamoy
Copy link
Member

pawamoy commented Sep 26, 2022

Thank you very much for trying and reporting back!

For potential future readers: you can install a Python package from a remote Git repository and a particular branch with:

pip install git+https://github.com/mkdocstrings/griffe@branche-name

@pawamoy
Copy link
Member

pawamoy commented Sep 26, 2022

I'll go ahead and close this, don't hesitate to open a new issue if it happens again 🙂

@roastduck
Copy link
Author

roastduck commented Dec 19, 2022

Hi, this issue did happen again. 😂

Still the same issue which causes infinite recursion on the same lines.

Opening a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working griffe: wildcard-imports Related to wildcard imports
Projects
None yet
Development

No branches or pull requests

2 participants