x-tabdeveloping / turftopic

Robust and fast topic models with sentence-transformers.
https://x-tabdeveloping.github.io/turftopic/
MIT License
8 stars 3 forks source link

mkdocstrings plugin missing files #17

Closed jankounchained closed 4 months ago

jankounchained commented 4 months ago

problem

can't build or serve documentation.

$ mkdocs serve
ERROR   -  Config value 'plugins': Plugin 'mkdocstrings' option 'custom_templates': The path '/Users/XXX/Repositories/turftopic/templates    - content.code.select' isn't an existing directory.

Aborted with 1 configuration errors!

resolving

This is caused by the following lines in mkdocs config: https://github.com/x-tabdeveloping/turftopic/blob/main/mkdocs.yml#L34-L45

attempt 1

mkdocstrings tries to find a directory that doesn't exist. Tried to comment out L45: custom_templates: templates - content.code.select Error message got longer:

$ mkdocs serve
  File "/Users/XXX/Repositories/turftopic/.venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/__main__.py", line 270, in serve_command
    serve.serve(**kwargs)
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/commands/serve.py", line 86, in serve
    builder(config)
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, live_server=None if is_clean else server, dirty=is_dirty)
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/commands/build.py", line 322, in build
    _populate_page(file.page, config, files, dirty)
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/commands/build.py", line 175, in _populate_page
    page.render(config, files)
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocs/structure/pages.py", line 271, in render
    self.content = md.convert(self.markdown)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/markdown/core.py", line 357, in convert
    root = self.parser.parseDocument(self.lines).getroot()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/markdown/blockparser.py", line 117, in parseDocument
    self.parseChunk(self.root, '\n'.join(lines))
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/markdown/blockparser.py", line 136, in parseChunk
    self.parseBlocks(parent, text.split('\n\n'))
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/markdown/blockparser.py", line 158, in parseBlocks
    if processor.run(parent, blocks) is not False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocstrings/extension.py", line 124, in run
    html, handler, data = self._process_block(identifier, block, heading_level)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocstrings/extension.py", line 195, in _process_block
    handler = self._handlers.get_handler(handler_name, handler_config)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/Repositories/turftopic/.venv/lib/python3.12/site-packages/mkdocstrings/handlers/base.py", line 459, in get_handler
    module = importlib.import_module(f"mkdocstrings_handlers.{name}")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1318, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mkdocstrings_handlers'

attempt 2

comment out the whole block mkdocs serve works, but docstrings are no longer parsed.

jankounchained commented 4 months ago

Update: reinstalled mkdocstrings with an extra: pip install -U "mkdocstrings[python]"

Now attempt 1 (commenting out L45) runs

pawamoy commented 4 months ago
custom_templates: templates    - content.code.select

Looks like a wrongly resolved merge conflict. The - content.code.select part should be in the theme.features list :slightly_smiling_face: And you can indeed remove the custom_templates key and value: there isn't any templates folder in the sources anyway.

jankounchained commented 4 months ago

Thanks @pawamoy The line is out :)