[Python] Sphinx Auto-API Exception: Relative import with too many levels (1) for module 'api'

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    First time asking a question on here so apologies if I miss some detail.

    I'm running sphinx auto-api to generate docs, this has always worked on this project but it's now complaining about some imports in one of the site packages.

    Command:

    sphinx-build -b dummy docs docs/_build/html --keep-going


    I'm not sure what's going on. In my conf.py file I have the following line:

    import os
    import sys

    sys.path.insert(0, os.path.abspath(".."))


    I'm running it on a poetry environment.

    This is the error I'm seeing.

    [AutoAPI] Reading files... [ 11%] /Users/marta/PycharmProjects/app/app/lib/python3.10/site-packages/requests-stubs/api.pyi
    Extension error (autoapi.extension):
    Handler <function run_autoapi at 0x107c7da20> for event 'builder-inited' threw an exception (exception: Relative import with too many levels (1) for module 'api')


    Versions of sphinx packages:

    Sphinx = "^6.1.0"
    sphinx-rtd-theme = "^2.0.0"
    sphinx-pydantic = "^0.1.1"
    sphinx-autoapi = "^3.0.0"

    Continue reading...

Compartilhe esta Página