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

Readthedocs #381

merged 6 commits into from
Apr 25, 2024

Conversation

AurelienJaquier
Copy link
Collaborator

Description

@anilbey it looks like we cannot use cd in readthedocs, so I had to copy back the rst converting code to .readthedocs.yml with updated paths.

Checklist:

  • Unit tests are added to cover the changes (skip if not applicable).
  • The changes are mentioned in the documentation (skip if not applicable).
  • CHANGELOG file is updated (skip if not applicable).

@AurelienJaquier AurelienJaquier self-assigned this Apr 25, 2024
@AurelienJaquier AurelienJaquier requested a review from anilbey April 25, 2024 11:25
@anilbey
Copy link
Contributor

anilbey commented Apr 25, 2024

I see. Would it not work if we keep the script paths relative to the repository directory and call it from both .tox and .readthedocs?
E.g. instead of this tox block

changedir = docs

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

This following will run the script without changing the path.

commands =
    sh examples_to_rst.sh  # assuming we are inside the root EFEL folder, not EFEL/docs folder
    cd docs
    # build the docs to see if it builds fine
    make html SPHINXOPTS=-W
    # make sure the feature names and units are up-to-date
    pytest test_feature_units_in_docs.py

What do you think?

@AurelienJaquier
Copy link
Collaborator Author

doing cd inside tox does not work either, I stay at the root :/

@anilbey
Copy link
Contributor

anilbey commented Apr 25, 2024

I think we can find a solution.

@anilbey
Copy link
Contributor

anilbey commented Apr 25, 2024

tox.ini

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

examples_to_rst.sh

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 docs/source/
cp -r examples/sonata-network/sonata-network_files docs/source/
cp examples/nmc-portal/L5TTPC2.rst docs/source/nmc-portal.rst
cp -r examples/nmc-portal/L5TTPC2_files docs/source/

This seems to work.

@AurelienJaquier
Copy link
Collaborator Author

Thanks @anilbey ! I implemented your changes and it seems to work now :)

@anilbey
Copy link
Contributor

anilbey commented Apr 25, 2024

Good news :)

@@ -12,9 +12,7 @@ build:
python: "3.10"
jobs:
pre_build:
- cd docs
- sh examples_to_rst.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not work if we place the examples_to_rst.sh into either docs or examples and call it sh docs/examples_to_rst.sh in the .readthedocs.yaml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should work. Let me implement it

Copy link
Contributor

@anilbey anilbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thanks a lot @AurelienJaquier

@AurelienJaquier AurelienJaquier merged commit 2134768 into master Apr 25, 2024
20 checks passed
@AurelienJaquier AurelienJaquier deleted the readthedocs branch April 25, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants