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

BUG: regression in griffe 0.31.0 ? #178

Closed
neutrinoceros opened this issue Jul 12, 2023 · 3 comments
Closed

BUG: regression in griffe 0.31.0 ? #178

neutrinoceros opened this issue Jul 12, 2023 · 3 comments

Comments

@neutrinoceros
Copy link

Describe the bug

My project's documentation build process crashes with griffe 0.31.0, it builds fine with versions 0.29.1 to 0.30.1

Debug logs

$ griffe dump idefix_cli -LDEBUG

(I tried including the result here but it prevented posting the issue by going over the allowed number of characters)

$ mkdocs build -v

DEBUG    -  Loading configuration file: /Users/robcleme/dev/idefix-project/idefix_cli/mkdocs.yml
DEBUG    -  Loaded theme configuration for 'material' from
            '/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/material/mkdocs_theme.yml':
            {'language': 'en', 'direction': None, 'features': [], 'palette': {'primary': None, 'accent': None},
            'font': {'text': 'Roboto', 'code': 'Roboto Mono'}, 'icon': None, 'favicon':
            'assets/images/favicon.png', 'include_search_page': False, 'search_index_only': True,
            'static_templates': ['404.html']}
DEBUG    -  Config value 'config_file_path' = '/Users/robcleme/dev/idefix-project/idefix_cli/mkdocs.yml'
DEBUG    -  Config value 'site_name' = 'idefix_cli'
DEBUG    -  Config value 'nav' = [{'Introduction': 'index.md'}, 'commands.md', 'plugins.md', 'contributing.md',
            'CHANGELOG.md']
DEBUG    -  Config value 'pages' = None
DEBUG    -  Config value 'site_url' = None
DEBUG    -  Config value 'site_description' = None
DEBUG    -  Config value 'site_author' = None
DEBUG    -  Config value 'theme' = Theme(name='material',
            dirs=['/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/material',
            '/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocs/templates'],
            static_templates=['sitemap.xml', '404.html'], name='material', locale=Locale(language='en',
            territory=''), language='en', direction=None, features=[], palette=[{'scheme': 'default',
            'primary': 'indigo', 'accent': 'indigo', 'toggle': {'icon': 'material/brightness-7', 'name':
            'Switch to dark mode'}}, {'scheme': 'slate', 'primary': 'indigo', 'accent': 'indigo', 'toggle':
            {'icon': 'material/brightness-4', 'name': 'Switch to light mode'}}], font={'text': 'Roboto',
            'code': 'Roboto Mono'}, icon=None, favicon='assets/images/favicon.png', include_search_page=False,
            search_index_only=True)
DEBUG    -  Config value 'docs_dir' = '/Users/robcleme/dev/idefix-project/idefix_cli/docs'
DEBUG    -  Config value 'site_dir' = '/Users/robcleme/dev/idefix-project/idefix_cli/site'
DEBUG    -  Config value 'copyright' = None
DEBUG    -  Config value 'google_analytics' = None
DEBUG    -  Config value 'dev_addr' = _IpAddressValue(host='127.0.0.1', port=8000)
DEBUG    -  Config value 'use_directory_urls' = True
DEBUG    -  Config value 'repo_url' = None
DEBUG    -  Config value 'repo_name' = None
DEBUG    -  Config value 'edit_uri_template' = None
DEBUG    -  Config value 'edit_uri' = None
DEBUG    -  Config value 'extra_css' = []
DEBUG    -  Config value 'extra_javascript' = []
DEBUG    -  Config value 'extra_templates' = []
DEBUG    -  Config value 'markdown_extensions' = ['toc', 'tables', 'fenced_code', 'admonition',
            'pymdownx.highlight', 'pymdownx.inlinehilite', 'pymdownx.snippets', 'pymdownx.superfences']
DEBUG    -  Config value 'mdx_configs' = {'pymdownx.highlight': {'anchor_linenums': True}}
DEBUG    -  Config value 'strict' = False
DEBUG    -  Config value 'remote_branch' = 'gh-pages'
DEBUG    -  Config value 'remote_name' = 'origin'
DEBUG    -  Config value 'extra' = {}
DEBUG    -  Config value 'plugins' = {'include-markdown':
            <mkdocs_include_markdown_plugin.plugin.IncludeMarkdownPlugin object at 0x103327250>,
            'mkdocstrings': <mkdocstrings.plugin.MkdocstringsPlugin object at 0x1037e6e50>}
DEBUG    -  Config value 'hooks' = {}
DEBUG    -  Config value 'watch' = []
DEBUG    -  Running 2 `config` events
DEBUG    -  mkdocstrings: Adding extension to the list
DEBUG    -  mkdocstrings: Added a subdued autorefs instance <mkdocs_autorefs.plugin.AutorefsPlugin object at
            0x103856290>
DEBUG    -  mkdocs_autorefs.plugin: Adding AutorefsExtension to the list
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /Users/robcleme/dev/idefix-project/idefix_cli/site
DEBUG    -  Reading markdown pages.
DEBUG    -  Reading: index.md
DEBUG    -  Running 2 `page_markdown` events
DEBUG    -  Running 2 `page_content` events
DEBUG    -  Reading: CHANGELOG.md
DEBUG    -  Running 2 `page_markdown` events
DEBUG    -  Running 2 `page_content` events
DEBUG    -  Reading: commands.md
DEBUG    -  Running 2 `page_markdown` events
DEBUG    -  Running 2 `page_content` events
DEBUG    -  Reading: contributing.md
DEBUG    -  Running 2 `page_markdown` events
DEBUG    -  Running 2 `page_content` events
DEBUG    -  Reading: plugins.md
DEBUG    -  Running 2 `page_markdown` events
DEBUG    -  mkdocstrings: Matched '::: idefix_cli.lib.print_err'
DEBUG    -  mkdocstrings: Using handler 'python'
ERROR    -  Error reading page 'plugins.md': No module named 'mkdocstrings.handlers.python'
Traceback (most recent call last):
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings/handlers/base.py", line 563, in get_handler
    module = importlib.import_module(f"mkdocstrings_handlers.{name}")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings_handlers/python/__init__.py", line 3, in <module>
    from mkdocstrings_handlers.python.handler import get_handler
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings_handlers/python/handler.py", line 14, in <module>
    from griffe.agents.extensions import load_extensions
ModuleNotFoundError: No module named 'griffe.agents.extensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
    build.build(cfg, dirty=not clean)
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocs/commands/build.py", line 308, in build
    _populate_page(file.page, config, files, dirty)
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocs/commands/build.py", line 181, in _populate_page
    page.render(config, files)
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocs/structure/pages.py", line 270, in render
    self.content = md.convert(self.markdown)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/markdown/core.py", line 264, in convert
    root = self.parser.parseDocument(self.lines).getroot()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/markdown/blockparser.py", line 90, in parseDocument
    self.parseChunk(self.root, '\n'.join(lines))
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/markdown/blockparser.py", line 105, in parseChunk
    self.parseBlocks(parent, text.split('\n\n'))
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/markdown/blockparser.py", line 123, in parseBlocks
    if processor.run(parent, blocks) is not False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings/extension.py", line 121, in run
    html, handler, data = self._process_block(identifier, block, heading_level)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings/extension.py", line 176, in _process_block
    handler = self._handlers.get_handler(handler_name, handler_config)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/idefix_cli-dev/lib/python3.11/site-packages/mkdocstrings/handlers/base.py", line 565, in get_handler
    module = importlib.import_module(f"mkdocstrings.handlers.{name}")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/robcleme/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mkdocstrings.handlers.python'

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/neutrinoceros/idefix_cli
  2. Run command
cd idefix_cli
python -m venv .venv
source .venv/bin/activate
python -m pip install -r docs/requirements.txt
python -m mkdocs build
  1. See error

Expected behavior
A clear and concise description of what you expected to happen.

System (please complete the following information):

  • griffe version: 0.31.0
  • Python version: 3.11.4
  • OS: macOS (also seen on Ubuntu in CI)

Additional context
See an example of failed build here
https://github.com/neutrinoceros/idefix_cli/actions/runs/5530760426/jobs/10090574931

@pawamoy
Copy link
Member

pawamoy commented Jul 12, 2023

You have to install a more recent version of mkdocstrings-python 🙂
Or downgrade Griffe.

@neutrinoceros
Copy link
Author

oh, sorry, I didn't realise that my docs requirements file wasn't being updated. Indeed, upgrading mkdocstrings-python solves it. Thank you !

@pawamoy
Copy link
Member

pawamoy commented Jul 12, 2023

You're welcome, thanks for coming back and closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants