From ef2e087e036365ce7f98b48c5a29bf8563065cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Mon, 1 Jul 2024 18:05:11 +0200 Subject: [PATCH] feat: Update FES2022 documentation and binder configuration The code changes include adding a new environment.yml file in the binder directory, which specifies the dependencies for the pyfes project. Additionally, the postBuild script has been modified to generate Jupyter notebooks from Python files and remove non-notebook files. The conf.py file in the docs/source directory has been updated to include the binder configuration for the FES2022 documentation. Recent user commits and repository commits indicate a focus on documentation updates, code development information, and fixing syntax errors. --- binder/environment.yml | 10 ++++++++++ binder/postBuild | 21 +++++++++++++++++++++ docs/source/conf.py | 25 +++++++++++++++---------- 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 binder/environment.yml create mode 100644 binder/postBuild diff --git a/binder/environment.yml b/binder/environment.yml new file mode 100644 index 0000000..d377b7c --- /dev/null +++ b/binder/environment.yml @@ -0,0 +1,10 @@ +name: pyfes +channels: + - conda-forge +dependencies: + - cartopy + - matplotlib + - jupyter + - pyfes + - sphinx-gallery + - sphinx-inline-tabs diff --git a/binder/postBuild b/binder/postBuild new file mode 100644 index 0000000..c5f3c03 --- /dev/null +++ b/binder/postBuild @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +TMP_CONTENT_DIR=/tmp/pyinterp +mkdir -p $TMP_CONTENT_DIR +cp -r examples binder $TMP_CONTENT_DIR + +find . -delete + +GENERATED_NOTEBOOKS_DIR=.generated-notebooks +cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR + +find $GENERATED_NOTEBOOKS_DIR -name '*.py' -exec sphx_glr_python_to_jupyter.py '{}' + +NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb') +rm -f $NON_NOTEBOOKS + +mv $TMP_CONTENT_DIR/binder . +rm -rf $TMP_CONTENT_DIR + +mkdir notebooks +ln -s ../$GENERATED_NOTEBOOKS_DIR notebooks/auto_examples diff --git a/docs/source/conf.py b/docs/source/conf.py index b486577..6ba56c7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -81,17 +81,22 @@ def push_front_syspath(): 'examples_dirs': [HERE.parent.parent.joinpath('examples')], 'filename_pattern': r'[\\\/]ex_', 'pypandoc': False, - # 'binder': { - # 'org': 'CNES', - # 'repo': 'aviso-fes', - # 'branch': 'main', - # 'binderhub_url': 'https://mybinder.org', - # 'dependencies': - # [HERE.joinpath('..', '..', 'binder', 'environment.yml')], - # 'use_jupyter_lab': True, - # } + 'binder': { + 'org': + 'CNES', + 'repo': + 'aviso-fes', + 'branch': + 'main', + 'binderhub_url': + 'https://mybinder.org', + 'dependencies': + [HERE.joinpath('..', '..', 'binder', 'environment.yml').resolve()], + 'use_jupyter_lab': + True, + } } - +print([HERE.joinpath('..', '..', 'binder', 'environment.yml').resolve()]) exclude_patterns = [] # -- Options for HTML output -------------------------------------------------