I am trying to create sphinx documentation for my python project. While trying to execute make html i am getting no module error
Running Sphinx v5.1.1
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 2 changed, 0 removed
reading sources... [100%] rman_wrapper
WARNING: autodoc: failed to import module 'rman_oss'; the following exception was raised:
No module named 'common'
WARNING: autodoc: failed to import module 'rman_wrapper'; the following exception was raised:
No module named 'common'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] rman_wrapper
generating indices... genindex py-modindex done
False:config_filele code... [ 87%] test_wallet_temp
highlighting module code... [100%] verify_update_csv_status_v2
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 2 warnings.
My directory structure is
├── bin
│ └── folder
│ └── rman_oss.py
└── lib
└── python
└──common
└── some_file.py
└──db
└── some_file.py
And in my script i am using
sys.path.append(BASE_DIR + "/lib/python")
from common import some_file
from db import some_file
It is working while actual execution but giving error while running make html command for document creation in sphinx. I tried insert option as well but not able to fix
sys.path.insert(1, BASE_DIR + "/lib/python/db")
from common import some_file
from db import some_file
Script execution is fine getting error while creating sphinx doc
My conf.py
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0,os.path.abspath('../../..'))
sys.path.insert(1, os.path.abspath('../../src/lib/python/common'))
sys.path.insert(2, os.path.abspath('../../src/lib/python/db'))
sys.path.insert(3, os.path.abspath('../../src/lib/python/mt'))
sys.path.insert(4,os.path.abspath('../../src/bin/db_main'))
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'facops-oci-backup'
copyright = '2022, Keshav Kishor'
author = 'Keshav Kishor'
release = '00:00:00'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon'
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
My docs directory structure is
docs
└── build
└── doctrees
└── html
└── source
└── conf.py
└── index.rst
└── modules.rst
└── <other rst>
└── make.bat
└── Makefile
└── rman_oss.py
src
├── bin
│ └── folder
│ └── rman_oss.py
└── lib
└── python
└──common
└── some_file.py
└──db
└── some_file.py