Ошибка генерации mkdocsstrings «Нет имени модуля»Python

Программы на Python
Ответить
Anonymous
 Ошибка генерации mkdocsstrings «Нет имени модуля»

Сообщение Anonymous »

Я создавал сайт документации для своего проекта Python, используя mkdocstrings.
Для создания справочных файлов кода я следовал этим инструкциям https://mkdocstrings.github.io/recipes/< /p>
Я получаю следующие ошибки:
INFO
- Building documentation... INFO
- Cleaning site directory INFO
- The following pages exist in the docs directory, but are not included in the "nav" configuration: - reference\SUMMARY.md
- reference_init_.md
... ...
- reference\tests\manual_tests.md ERROR
- mkdocstrings: No module named ' ' ERROR
- Error reading page 'reference/init.md': ERROR
- Could not collect ' '

Это моя файловая структура:
Изображение

Это моя папка с документами:
Изображение

У меня то же самое Файл gen_ref_pages.py, показанный на странице:

from pathlib import Path

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()

for path in sorted(Path("src").rglob("*.py")):
module_path = path.relative_to("src").with_suffix("")
doc_path = path.relative_to("src").with_suffix(".md")
full_doc_path = Path("reference", doc_path)

parts = tuple(module_path.parts)

if parts[-1] == "__init__":
parts = parts[:-1]
elif parts[-1] == "__main__":
continue

nav[parts] = doc_path.as_posix() #

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
ident = ".".join(parts)
fd.write(f"::: {ident}")

mkdocs_gen_files.set_edit_path(full_doc_path, path)

with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file: #
nav_file.writelines(nav.build_literate_nav()) # ```

This is my mkdocs.yml:

``` site_name: CA Prediction Docs

theme:
name: "material"
palette:
primary: deep purple
logo: assets/logo.png
favicon: assets/favicon.png
features:
- navigation.instant
- navigation.tabs
- navigation.expand
- navigation.top
# - navigation.sections
- search.highlight
- navigation.footer
icon:
repo: fontawesome/brands/git-alt

copyright: Copyright © 2022 - 2023 Ezequiel González

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/ezegonmac
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/ezequiel-go ... 329583223/

repo_url: https://github.com/ezegonmac/TFG-CellularAutomata
repo_name: ezegonmac/TFG-CellularAutomata

plugins:
- search
- gen-files:
scripts:
- docs/gen_ref_pages.py
- mkdocstrings

nav:
- Introduction: index.md
- Getting Started: getting-started.md
- API Reference: reference.md
# - Reference: reference/
- Explanation: explanation.md


Подробнее здесь: https://stackoverflow.com/questions/752 ... dule-named
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»