Skip to content

Commit

Permalink
Include example depencies instructions, resolve #195
Browse files Browse the repository at this point in the history
  • Loading branch information
bwohlberg committed Feb 4, 2022
1 parent 9eed66b commit b2aa9dc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
15 changes: 15 additions & 0 deletions docs/source/exampledepend.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _example_dependencies:

Example Dependencies
--------------------

Some examples use additional dependencies, which are listed in `examples_requirements.txt <https://github.com/lanl/scico/blob/main/examples/examples_requirements.txt>`_.
The additional requirements should be installed via pip, with the exception of ``astra-toolbox``,
which should be installed via conda:

::

conda install -c astra-toolbox astra-toolbox
pip install -r examples/examples_requirements.txt # Installs other example requirements

The dependencies can also be installed individually as required.
2 changes: 2 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Usage Examples
.. toctree::
:maxdepth: 1

.. include:: exampledepend.rst


Organized by Application
------------------------
Expand Down
8 changes: 7 additions & 1 deletion examples/makeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,18 @@
print(".. _example_notebooks:\n", file=dstfile)
with open(src, "r") as srcfile:
for line in srcfile:
# Add toctree and include statements after main heading
if line[0:3] == "===":
print(line, end="", file=dstfile)
print("\n.. toctree::\n :maxdepth: 1", file=dstfile)
print("\n.. include:: exampledepend.rst", file=dstfile)
continue
# Detect lines containing script filenames
m = re.match(r"(\s+)- ([^\s]+).py", line)
if m:
print(" " + prfx + m.group(2), file=dstfile)
else:
print(line, end="", file=dstfile)
# Add toctree statements after section headings
# Add toctree statement after section headings
if line[0:3] == line[0] * 3 and line[0] in ["=", "-", "^"]:
print("\n.. toctree::\n :maxdepth: 1", file=dstfile)

0 comments on commit b2aa9dc

Please sign in to comment.