Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readthedocs #381

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading