Skip to content

Commit

Permalink
Fixing Readthedocs (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienJaquier authored Apr 25, 2024
1 parent 0a4b473 commit 2134768
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ cpp_coverage.xml
docs/bin
docs/lib
docs/source/lib
docs/source/sonata-network.rst
docs/source/sonata-network_files/
docs/source/nmc-portal.rst
docs/source/L5TTPC2_files/
bin
*.tox-info.json
*.ipynb_checkpoints
Expand Down
4 changes: 1 addition & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ build:
python: "3.10"
jobs:
pre_build:
- cd docs
- sh examples_to_rst.sh
- cd -
- sh docs/examples_to_rst.sh

python:
# Install our python package before building the docs
Expand Down
23 changes: 17 additions & 6 deletions docs/examples_to_rst.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
jupyter nbconvert --to rst ../examples/sonata-network/sonata-network.ipynb
jupyter nbconvert --to rst ../examples/nmc-portal/L5TTPC2.ipynb
cp ../examples/sonata-network/sonata-network.rst source/
cp -r ../examples/sonata-network/sonata-network_files source/
cp ../examples/nmc-portal/L5TTPC2.rst source/nmc-portal.rst
cp -r ../examples/nmc-portal/L5TTPC2_files source/
# to call from root

# clean up
rm docs/source/sonata-network.rst
rm -rf docs/source/sonata-network_files
rm docs/source/nmc-portal.rst
rm -rf docs/source/L5TTPC2_files

# convert
jupyter nbconvert --to rst examples/sonata-network/sonata-network.ipynb
jupyter nbconvert --to rst examples/nmc-portal/L5TTPC2.ipynb

# move
mv examples/sonata-network/sonata-network.rst docs/source/
mv examples/sonata-network/sonata-network_files docs/source/
mv examples/nmc-portal/L5TTPC2.rst docs/source/nmc-portal.rst
mv examples/nmc-portal/L5TTPC2_files docs/source/
10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,14 @@ deps =
-r{toxinidir}/requirements_docs.txt
pytest>=7.4.4
allowlist_externals =
make
jupyter
cp
sh
changedir = docs

commands =
sh examples_to_rst.sh
sh docs/examples_to_rst.sh
# build the docs to see if it builds fine
make html SPHINXOPTS=-W
sphinx-build -b html -W docs/source docs/_build/html
# make sure the feature names and units are up-to-date
pytest test_feature_units_in_docs.py
pytest docs/test_feature_units_in_docs.py

[testenv:lint]
envdir = {toxworkdir}/lint
Expand Down

0 comments on commit 2134768

Please sign in to comment.