Skip to content

Commit

Permalink
Added flag to disable notebook rendering in Sphinx (tardis-sn#1615)
Browse files Browse the repository at this point in the history
* add flag to disable nbsphinx

* update doc

* change approach

* remove unnecessary metadata

* remove future deprecated command
  • Loading branch information
epassaro authored Jun 15, 2021
1 parent 7ff24b0 commit 638be1a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
numpydoc_show_class_members = False
extensions += ["matplotlib.sphinxext.plot_directive", "sphinxcontrib.bibtex"]

nbsphinx_execute = "auto"
if os.getenv('DISABLE_NBSPHINX') == "1":
nbsphinx_execute = "never"
else:
nbsphinx_execute = "auto"

nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
Expand All @@ -79,6 +82,7 @@
nbsphinx_prolog = """
This notebook is available at
https://github.com/tardis-sn/tardis/tree/master/docs/{{ env.doc2path(env.docname, base=None) }}
----
"""

Expand Down
11 changes: 6 additions & 5 deletions docs/development/documentation_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ Besides this, the functions and classes in your code must always contain **docst
Building documentation locally
==============================

To build TARDIS documentation locally, you can use either of the following commands: ::
To build TARDIS documentation locally, use the following commands:

python setup.py build_docs
or ::
.. code ::
cd docs
make html
.. note :: If you're working on a fresh local copy of the TARDIS repository, you might need to do ``python setup.py develop`` before executing these commands.
.. note ::
- If you're working on a fresh local copy of the TARDIS repository, you might need to do ``python setup.py develop`` before executing these commands.
- Use ``DISABLE_NBSPHINX=1 make html`` to disable notebook rendering (fast mode).
After running this command, you can find the built docs (i.e. HTML webpages) in ``docs/_build``. Open the ``index.html`` in your browser to see how the documentation looks like with your edits. Navigate to page where you made changes or file that you added to check whether it looks as intended or not.

Expand Down
2 changes: 1 addition & 1 deletion docs/development/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ to the Astropy team for designing it.
issues
git_workflow
documentation_guidelines
documentation_preview
running_tests
code_quality
documentation_preview
developer_faq

TARDIS core team Instructions
Expand Down
4 changes: 0 additions & 4 deletions docs/io/optional/custom_source.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
},
"nbsphinx": {
"execute": "always",
"timeout": 600
}
},
"nbformat": 4,
Expand Down
6 changes: 1 addition & 5 deletions docs/io/output/physical_quantities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.8"
},
"nbsphinx": {
"execute": "always",
"timeout": -1
"version": "3.7.10"
}
},
"nbformat": 4,
Expand Down
6 changes: 1 addition & 5 deletions docs/quickstart/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
},
"nbsphinx": {
"execute": "always",
"timeout": -1
"version": "3.7.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 638be1a

Please sign in to comment.