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

add flag to disable nbsphinx #1615

Merged
merged 5 commits into from
Jun 15, 2021
Merged

Conversation

epassaro
Copy link
Member

@epassaro epassaro commented Jun 3, 2021

Description

I thought about a way to fast render the documentation. Made a small patch to conf.py and now prepending the variable DISABLE_NBSPHINX=1 to the build command skips the notebook rendering.

Example:

cd docs/
DISABLE_NBSPHINX=1 make html

Then sphinx just render the .rst files.

Also I removed hardcoded metadata in notebooks. If we want to change this values we should do it through conf.py not harcoding them (by the way, the hardcoded values were the default ones). Using harcoded metadata leads to hard to debug problems.

Motivation and context

@jaladh-singhal's issue no. #1282

How has this been tested?

  • Testing pipeline.
  • Other.

Locally. Please checkout to this PR and try it too.

Examples

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@github-actions
Copy link

github-actions bot commented Jun 3, 2021

Before a PR is accepted, it must meet the following criteria:

  • Is the necessary information provided?
    • Does the PR have a complete description? Does it explain what the PR is attempting to do/fix, does it explain how it does this?
    • Is there an explanation of why this PR is needed?
    • Please use the TARDIS PR template
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be at or very close to 100%.
  • Is the code properly documented?
    • If this modifies existing code, then the docs should be updated. If this adds a new feature, additional documentation should be created.
    • Sphinx and docstrings in the code (in numpydoc format)
  • Does this conform to PEP 8 and the TARDIS style guidelines?
  • Does the PR fix the problem it describes?
    • Make sure it doesn’t e.g. just fix the problem for a specific case
    • Is this the best way of fixing the problem?
  • Is the code tidy?
    • No unnecessary print lines or code comments

@codecov
Copy link

codecov bot commented Jun 3, 2021

Codecov Report

Merging #1615 (f033173) into master (e847a59) will increase coverage by 5.20%.
The diff coverage is n/a.

❗ Current head f033173 differs from pull request most recent head e090386. Consider uploading reports for the commit e090386 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1615      +/-   ##
==========================================
+ Coverage   61.92%   67.13%   +5.20%     
==========================================
  Files          62       73      +11     
  Lines        5702     6100     +398     
==========================================
+ Hits         3531     4095     +564     
+ Misses       2171     2005     -166     
Impacted Files Coverage Δ
tardis/tardis/io/atom_data/base.py 90.80% <0.00%> (-0.48%) ⬇️
tardis/tardis/scripts/cmfgen2tardis.py 0.00% <0.00%> (ø)
tardis/tardis/analysis.py
...rlo/montecarlo_numba/tests/test_numba_interface.py 100.00% <0.00%> (ø)
...dis/visualization/widgets/tests/test_shell_info.py 100.00% <0.00%> (ø)
...dis/montecarlo/montecarlo_numba/tests/test_base.py 97.14% <0.00%> (ø)
...ntecarlo_numba/tests/test_numba_formal_integral.py 100.00% <0.00%> (ø)
...rdis/visualization/widgets/tests/test_line_info.py 100.00% <0.00%> (ø)
...rdis/montecarlo/montecarlo_numba/tests/conftest.py 91.11% <0.00%> (ø)
...tecarlo/montecarlo_numba/tests/test_interaction.py 100.00% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e847a59...e090386. Read the comment docs.

@isaacgsmith
Copy link
Member

Two things:

  • Does this work with python setup.py build_docs as well? And would you just do DISABLE_NBSPHINX=1 python setup.py build_docs?
  • You may want to add that example you made in the pull request comment into the documentation (i.e. say that you do cd docs and then DISABLE_NBSPHINX=1 make html).

@tardis-sn tardis-sn deleted a comment from github-actions bot Jun 4, 2021
@tardis-sn tardis-sn deleted a comment from github-actions bot Jun 4, 2021
@tardis-sn tardis-sn deleted a comment from github-actions bot Jun 4, 2021
@epassaro
Copy link
Member Author

epassaro commented Jun 4, 2021

Two things:

  • Does this work with python setup.py build_docs as well? And would you just do DISABLE_NBSPHINX=1 python setup.py build_docs?
  • You may want to add that example you made in the pull request comment into the documentation (i.e. say that you do cd docs and then DISABLE_NBSPHINX=1 make html).
  • Yes it works.
  • It's already in the documentation. Is "prepend to the build command" clear enough?

@isaacgsmith
Copy link
Member

Two things:

  • Does this work with python setup.py build_docs as well? And would you just do DISABLE_NBSPHINX=1 python setup.py build_docs?
  • You may want to add that example you made in the pull request comment into the documentation (i.e. say that you do cd docs and then DISABLE_NBSPHINX=1 make html).
  • Yes it works.
  • It's already in the documentation. Is "prepend to the build command" clear enough?

In my opinion, it could be more clear. Writing out the examples I think would be helpful.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@isaacgsmith isaacgsmith left a comment

Choose a reason for hiding this comment

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

Looks good, except that I think you should put the examples of how to do this (both with build docs and with make html) in the documentation.

@epassaro
Copy link
Member Author

Looks good, except that I think you should put the examples of how to do this (both with build docs and with make html) in the documentation.

python setup.py build_docs will be deprecated soon so I would not encourage people to learn or use it. Maybe I'll remove the command from all documentation.

@epassaro
Copy link
Member Author

Looks good, except that I think you should put the examples of how to do this (both with build docs and with make html) in the documentation.

python setup.py build_docs will be deprecated soon so I would not encourage people to learn or use it. Maybe I'll remove the command from all documentation.

I removed the python setup.py build_docs command and used the full command to explain the flag @smithis7.

@isaacgsmith isaacgsmith self-requested a review June 14, 2021 13:56
@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

Copy link
Contributor

@andrewfullard andrewfullard left a comment

Choose a reason for hiding this comment

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

Needs a rebase

@epassaro
Copy link
Member Author

Needs a rebase

Done

@andrewfullard andrewfullard self-requested a review June 15, 2021 13:30
@andrewfullard andrewfullard merged commit 66b10ad into tardis-sn:master Jun 15, 2021
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
* add flag to disable nbsphinx

* update doc

* change approach

* remove unnecessary metadata

* remove future deprecated command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants