fix mock pkgs in docs (#4591)
* fix mock pkgs in docs * sphinx * CI Co-authored-by: chaton <thomas@grid.ai>
This commit is contained in:
parent
343d19fa86
commit
abf1d4b992
|
@ -8,7 +8,7 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
|
||||||
branches: [master, "release/*"]
|
branches: [master, "release/*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-docs:
|
sphinx-check:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -48,6 +48,7 @@ jobs:
|
||||||
# python -m pip install --upgrade --user pip
|
# python -m pip install --upgrade --user pip
|
||||||
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
|
pip install --requirement requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
|
||||||
pip install --requirement requirements/extra.txt
|
pip install --requirement requirements/extra.txt
|
||||||
|
pip install --requirement requirements/loggers.txt
|
||||||
pip install --requirement requirements/docs.txt
|
pip install --requirement requirements/docs.txt
|
||||||
python --version
|
python --version
|
||||||
pip --version
|
pip --version
|
||||||
|
|
|
@ -304,22 +304,23 @@ def package_list_from_file(file):
|
||||||
return mocked_packages
|
return mocked_packages
|
||||||
|
|
||||||
|
|
||||||
|
# define mapping from PyPI names to python imports
|
||||||
|
PACKAGE_MAPPING = {
|
||||||
|
'Pillow': 'PIL',
|
||||||
|
'opencv-python': 'cv2',
|
||||||
|
'PyYAML': 'yaml',
|
||||||
|
'comet-ml': 'comet_ml',
|
||||||
|
'neptune-client': 'neptune',
|
||||||
|
}
|
||||||
MOCK_PACKAGES = []
|
MOCK_PACKAGES = []
|
||||||
if SPHINX_MOCK_REQUIREMENTS:
|
if SPHINX_MOCK_REQUIREMENTS:
|
||||||
# mock also base packages when we are on RTD since we don't install them there
|
# mock also base packages when we are on RTD since we don't install them there
|
||||||
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements.txt'))
|
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements.txt'))
|
||||||
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/extra.txt'))
|
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/extra.txt'))
|
||||||
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/loggers.txt'))
|
MOCK_PACKAGES += package_list_from_file(os.path.join(PATH_ROOT, 'requirements/loggers.txt'))
|
||||||
|
MOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]
|
||||||
|
|
||||||
MOCK_MANUAL_PACKAGES = [
|
autodoc_mock_imports = MOCK_PACKAGES
|
||||||
'torchvision',
|
|
||||||
'PIL',
|
|
||||||
# packages with different package name compare to import name
|
|
||||||
'yaml',
|
|
||||||
'comet_ml',
|
|
||||||
'neptune',
|
|
||||||
]
|
|
||||||
autodoc_mock_imports = MOCK_PACKAGES + MOCK_MANUAL_PACKAGES
|
|
||||||
|
|
||||||
autosummary_generate = True
|
autosummary_generate = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue