Skip to content

Commit

Permalink
Fix documentation (#313)
Browse files Browse the repository at this point in the history
On readthedocs, _pypowsybl module needs to be mocked since it is not installed:
the corresponding parameters was not updated correctly when moving _pypowsybl to pypowsybl package.

Signed-off-by: Sylvain Leclerc <[email protected]>
  • Loading branch information
sylvlecl authored Feb 9, 2022
1 parent b93b34a commit f01c4ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.9"

sphinx:
configuration: docs/conf.py

python:
version: 3.7
install:
- requirements: requirements.txt
9 changes: 7 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
try:
# trick to assess whether we can use the installed lib (for running tests)
# or instead use sources (for doc generation on readthedocs)
print('Checking for pypowsybl installation.')
import pypowsybl._pypowsybl
print('pypowsybl installation found.')
except ImportError:
# Path to python sources, for doc generation on readthedocs
sys.path.insert(0, os.path.abspath('..'))
print('pypowsybl installation not found: appending source directory to path')
source_path = os.path.abspath('..')
sys.path.insert(0, source_path)
print(f'appended {source_path}')


# -- Project information -----------------------------------------------------
Expand Down Expand Up @@ -89,7 +94,7 @@
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
# to avoid an error if pypowsybl has not been installed
autodoc_mock_imports = ["_pypowsybl"]
autodoc_mock_imports = ["pypowsybl._pypowsybl"]


# Autodoc options
Expand Down

0 comments on commit f01c4ef

Please sign in to comment.