diff --git a/docs/src/index.rst.in b/docs/src/index.rst.in index a5137653..f7378cfe 100644 --- a/docs/src/index.rst.in +++ b/docs/src/index.rst.in @@ -6,6 +6,18 @@ COSMO Software Cookbook :end-before: marker-intro-end +All the examples provide an ``environment.yml`` file that you can download and +then use with conda to create a new environment with all the required +dependencies for this example. + +.. code-block:: bash + + # Pick a name for the environment and replace with it + conda env create --name --file environment.yml + + # when you want to use the environment + conda env activate --name + .. toctree:: :caption: Table of Contents :maxdepth: 1 diff --git a/generate-gallery.py b/generate-gallery.py index 9d27e630..239a50b9 100644 --- a/generate-gallery.py +++ b/generate-gallery.py @@ -38,7 +38,7 @@ def __init__(self, example): "examples_dirs": os.path.join(HERE, example), "gallery_dirs": gallery_dir, "min_reported_time": 60, - "copyfile_regex": r".*\.(sh|xyz|cp2k)", + "copyfile_regex": r".*\.(sh|xyz|cp2k|yml)", "matplotlib_animations": True, } diff --git a/noxfile.py b/noxfile.py index fac20ca2..83bff979 100644 --- a/noxfile.py +++ b/noxfile.py @@ -128,6 +128,30 @@ def build_docs(session): output.write(f" {path}\n") + # TODO: Explain + with open(file) as fd: + content = fd.read() + + if "Download Conda environment file" in content: + # do not add the download link twice + pass + else: + lines = content.split("\n") + with open(file, "w") as fd: + for line in lines: + if "sphx-glr-download-jupyter" in line: + # add the new download link before + fd.write( + """ + .. container:: sphx-glr-download + + :download:`Download Conda environment file: environment.yml ` +""" + ) + + fd.write(line) + fd.write("\n") + session.run("sphinx-build", "-W", "-b", "html", "docs/src", "docs/build/html")