gitlabpython-sphinxautodocgitlab-pages

Sphinx error while GItLab Pages deploy/ It cannot find part of my modules


I am trying to deploy my Sphinx docs on GitLab. But it is ignores some modules. Please tell me what i am doing wrong. I am do the same things on my host machine and it works, but on gitlab pages dont want to find some modules.

gitlab-ci.yaml

# The Docker image that will be used to build your app
image: python:3.12.4-slim

pages:
  script:
    - apt-get update && apt-get install ffmpeg libsm6 libxext6  -y
    - sudo apt-get install python3-sphinx -y
    - pip install -U rst-to-myst[sphinx]
    - pip install -r requirements.txt
    - pip install myst-parser
    - pip install sphinxawesome-theme
    - pip install autodocsumm
    - sphinx-build -b html ./docs/source public
  tags:
    - linux
  artifacts:
    paths:
      # The folder that contains the files to be exposed at the Page URL
      - public
  #rules:
    # This ensures that only pushes to the default branch will trigger
    # a pages deploy
    #- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

docs/dource/conf.py

import os
import sys


sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.abspath('../../va_sdk')))
sys.path.insert(1, os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.abspath('../../.')))

import va_sdk

# -- Project information -----------------------------------------------------

project = va_sdk.__name__
release = va_sdk.__version__

# -- General configuration ---------------------------------------------------

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'sphinx.ext.coverage',
    'myst_parser',
    'autodocsumm',
]
source_suffix = {
    '.rst': 'restructuredtext',
    '.md': 'markdown',
}
napoleon_google_docstring = True
napoleon_numpy_docstring = True
autosummary_generate = True

templates_path = ['_templates']
exclude_patterns = []

# -- Options for HTML output -------------------------------------------------

html_theme = 'sphinxawesome_theme'
html_static_path = ['_static']

GitLab pages logs

[path]/edge_sdk/docs/source/md_pages/Документация пакета va_sdk.rst:23: WARNING: autosummary: failed to import va_sdk.components.
Possible hints:
* ModuleNotFoundError: No module named 'va_sdk.va_sdk'
* AttributeError: module 'VA SDK' has no attribute 'components'
* AttributeError: module 'VA SDK' has no attribute 'va_sdk'
* ImportError: 
* ImportError: libGL.so.1: cannot open shared object file: No such file or directory
[path]/edge_sdk/docs/source/md_pages/Документация пакета va_sdk.rst:23: WARNING: autosummary: failed to import va_sdk.run.
Possible hints:
* ModuleNotFoundError: No module named 'va_sdk.va_sdk'
* AttributeError: module 'VA SDK' has no attribute 'run'
* AttributeError: module 'VA SDK' has no attribute 'va_sdk'
* ImportError: 
* ImportError: libGL.so.1: cannot open shared object file: No such file or directory
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done

I am notice, that the host machine is working well with this specs. Look at screenshot.

Host machine toctree Gitlab pages toctree

tree command stdout

/
└───edge_sdk
    ├───config
    ├───docs
    │   ├───images
    │   └───topics
    ├───example
    ├───logs
    ├───va_sdk  # some additional modules with __init__.py
    │   ├───components # some modules with __init__.py
    │   │   ├───monitoring # some modules with __init__.py
    │   │   └───utils_process # some modules with __init__.py
    │   ├───schema # some modules with __init__.py
    │   └───utils # some modules with __init__.py
    └───tests
        ├───mockup
        ├───test_core
        ├───test_process
        └───test_utils

Solution

  • Well, I have found a solution, even though I don't fully understand it. I imagine that this error was caused by LibGL, so if somebody has the same problem, my fixed gitlab-ci.yml is:

    # The Docker image that will be used to build your app
    image: python:3.12.4-slim
    
    pages:
      script:
        - apt-get update && apt-get install ffmpeg libsm6 libxext6 libgl1 libgl1-mesa-dev  -y
        - pip install opencv-python-headless
        - sudo apt-get install python3-sphinx -y
        - pip install -U rst-to-myst[sphinx]
        - pip install -r requirements.txt
        - pip install myst-parser
        - pip install sphinxawesome-theme
        - pip install autodocsumm
        - pip install -e .
        - sphinx-build -b html ./docs/source public
      tags:
        - linux
      artifacts:
        paths:
          # The folder that contains the files to be exposed at the Page URL
          - public
      #rules:
        # This ensures that only pushes to the default branch will trigger
        # a pages deploy
        #- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
    
    

    Then all dependencies should work correctly.