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

Adding first gis module to perform geospatial operations, notebook builds #61

Merged
merged 103 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
ec632c4
adding first gis module to perform geospatial operations required for…
sebastienlanglois Dec 18, 2023
bd38932
add documentation
sebastienlanglois Dec 19, 2023
629572c
add backward compatibility for type hints
sebastienlanglois Dec 19, 2023
a9c8fb7
change kernel in specs
sebastienlanglois Dec 19, 2023
99fc6b0
add climatology extraction from watershed boundaries
sebastienlanglois Dec 20, 2023
96d53be
Merge branch 'main' of https://github.com/hydrologie/xhydro into basi…
sebastienlanglois Dec 20, 2023
c761419
correct kernel name
sebastienlanglois Dec 20, 2023
0849dda
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 20, 2023
b10b342
complete climatology example and add correct dependencies
sebastienlanglois Dec 20, 2023
f8ef52b
Merge branch 'basin-delineation' of https://github.com/hydrologie/xhy…
sebastienlanglois Dec 20, 2023
6207fe1
update gis notebook with no execution from nbsphinx at the notebook l…
sebastienlanglois Dec 22, 2023
f59e9b6
correct typos
sebastienlanglois Dec 22, 2023
7baaccf
precalculate map
sebastienlanglois Dec 22, 2023
cbf3cb4
test again readthedocs build
sebastienlanglois Dec 22, 2023
cb15134
temporary fix for pydantic dependency
sebastienlanglois Dec 22, 2023
8d0cb9f
add more context to documentation
sebastienlanglois Dec 22, 2023
e3461a7
try adding interactive map
sebastienlanglois Dec 22, 2023
e48fa87
conditionally run notebooks, add nbQA hooks for cleaning up notebooks…
Zeitsperre Dec 24, 2023
7dea0a1
exclude ipynb files from pretty-json hook
Zeitsperre Dec 24, 2023
a45844e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 24, 2023
2c1f9b9
update pre-commit
Zeitsperre Dec 29, 2023
095c0aa
remove kernelspec information
Zeitsperre Dec 29, 2023
2ee6b4e
synchronize dependencies, add test-notebooks Makefile recipe, add pyt…
Zeitsperre Dec 29, 2023
7af3277
add "approved" label handling
Zeitsperre Dec 29, 2023
20ebeef
remove pytest-xdist
Zeitsperre Dec 29, 2023
5905263
add makefile recipe for installing esmpy
Zeitsperre Dec 29, 2023
c3c7c48
add builds for testing notebooks and for running preliminary tests wi…
Zeitsperre Dec 29, 2023
4875b9c
preliminary build from conda, ESMF-source build optional
Zeitsperre Dec 29, 2023
519a6df
add default shell
Zeitsperre Dec 29, 2023
3b1d54e
update CHANGES.rst
Zeitsperre Jan 12, 2024
3e65cd4
backticks where needed
Zeitsperre Jan 12, 2024
85e37f3
add land use classification function
sebastienlanglois Jan 12, 2024
cb98b00
Merge branch 'main' of https://github.com/hydrologie/xhydro into basi…
sebastienlanglois Jan 12, 2024
9772de3
add unit tests for gis module
sebastienlanglois Jan 15, 2024
a8dd3b5
update docstrings
sebastienlanglois Jan 16, 2024
d776be7
add first batch of missing tests
sebastienlanglois Jan 16, 2024
2add8ee
Merge branch 'main' of https://github.com/hydrologie/xhydro into basi…
sebastienlanglois Jan 16, 2024
5e53b39
Merge branch 'basin-delineation' into conditional-notebook-builds
Zeitsperre Jan 16, 2024
955cf61
disable ESMF-source build
Zeitsperre Jan 16, 2024
2e391c2
update tests
sebastienlanglois Jan 16, 2024
7e88b44
update changes
sebastienlanglois Jan 16, 2024
4084d57
update typos
sebastienlanglois Jan 16, 2024
5be464e
complete tests
sebastienlanglois Jan 16, 2024
cfa6d32
Merge branch 'basin-delineation' into conditional-notebook-builds
Zeitsperre Jan 16, 2024
456c425
Conditionally Run Notebooks (#65)
Zeitsperre Jan 16, 2024
f8bf322
add notebooks label to pull requests when notebooks are modified
Zeitsperre Jan 19, 2024
cff536f
update CHANGES.rst
Zeitsperre Jan 19, 2024
305a8f7
update CHANGES.rst
Zeitsperre Jan 19, 2024
561d53b
Some small text adjustments
Zeitsperre Jan 19, 2024
d576ba3
Add notebooks label to pull requests when notebooks are modified (#68)
Zeitsperre Jan 19, 2024
3a15c0a
strip outputs
sebastienlanglois Jan 22, 2024
cd13490
Merge branch 'basin-delineation' of https://github.com/hydrologie/xhy…
sebastienlanglois Jan 22, 2024
0685e5a
strip map
sebastienlanglois Jan 22, 2024
a8cb7ac
Apply suggestions from code review
Zeitsperre Jan 22, 2024
7ebb98e
remove nbsphinx execution to never
sebastienlanglois Jan 22, 2024
347d5c0
Merge branch 'basin-delineation' of https://github.com/hydrologie/xhy…
sebastienlanglois Jan 22, 2024
9157eda
only skip running notebooks when SKIP_NOTEBOOKS env var is set
Zeitsperre Jan 26, 2024
1cb2a3f
pin all formatting tools to the same versions
Zeitsperre Jan 29, 2024
654b7a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 29, 2024
f6f0440
keep notebook outputs
Zeitsperre Jan 31, 2024
811592e
always run when called by GitHub
Zeitsperre Jan 31, 2024
0d0b365
add makefile recipe for checking that notebooks run, ignoring outputs
Zeitsperre Jan 31, 2024
015a348
maybe call the proper notebook testing command in the workflows? that…
Zeitsperre Jan 31, 2024
4288ef2
try keeping run counts, drop empty cells
Zeitsperre Jan 31, 2024
509d791
rerun notebooks
Zeitsperre Jan 31, 2024
e5eb465
Merge branch 'main' into basin-delineation
Zeitsperre Feb 1, 2024
66e0fdc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 1, 2024
5dde017
Merge branch 'main' into basin-delineation
Zeitsperre Feb 1, 2024
77df41e
Apply suggestions from code review
Zeitsperre Feb 2, 2024
e239aea
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
a7000cd
use pipe notation
Zeitsperre Feb 2, 2024
1305ef6
fix filename
Zeitsperre Feb 2, 2024
23f60ab
fix filename
Zeitsperre Feb 2, 2024
4c5c5de
fix test outputs
Zeitsperre Feb 2, 2024
e3b19ba
mark test as being failable due to API limits
Zeitsperre Feb 2, 2024
2085af1
Merge branch 'main' into basin-delineation
Zeitsperre Feb 8, 2024
9dd505e
Merge branch 'main' into basin-delineation
Zeitsperre Feb 8, 2024
ebe93d6
pin intake-esm
Zeitsperre Feb 8, 2024
5a58da0
Merge branch 'main' into basin-delineation
Zeitsperre Feb 13, 2024
bb83bbe
Merge branch 'main' into basin-delineation
Zeitsperre Mar 4, 2024
d24a903
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 4, 2024
ede5c76
fix version
Zeitsperre Mar 4, 2024
ae206ad
use pytest>=8.0.0
Zeitsperre Mar 4, 2024
8600d35
remove duplicate entry
Zeitsperre Mar 4, 2024
5360e2a
pin intake below v2.0.0
Zeitsperre Mar 4, 2024
feae452
relax some pins
Zeitsperre Mar 4, 2024
c1d5410
version pinning
Zeitsperre Mar 4, 2024
038ac20
Merge branch 'main' into basin-delineation
Zeitsperre Mar 8, 2024
1128b72
update gis notebook
sebastienlanglois Mar 11, 2024
cec771a
Merge branch 'basin-delineation' of https://github.com/hydrologie/xhy…
sebastienlanglois Mar 11, 2024
b3639fb
updated branch after review
sebastienlanglois Mar 11, 2024
f31919b
Merge branch 'main' into basin-delineation
sebastienlanglois Mar 11, 2024
ed2e8cf
try pipeline with striped outputs in gis notebook
sebastienlanglois Mar 11, 2024
4d4ba4c
update kernelspec
sebastienlanglois Mar 11, 2024
32b07b5
remove kernelspec field
Zeitsperre Mar 11, 2024
750b5d5
remove kernelspec and add outputs to notebook
sebastienlanglois Mar 11, 2024
a0eb88a
Merge branch 'basin-delineation' of https://github.com/hydrologie/xhy…
sebastienlanglois Mar 11, 2024
36901a6
correct gravelius property name
sebastienlanglois Mar 12, 2024
12efda8
Update environment-dev.yml to add missing library planetary-computer
sebastienlanglois Mar 12, 2024
d90cc27
update order of notebooks
sebastienlanglois Mar 12, 2024
8043acb
Update .github/workflows/main.yml to add python 3.12
sebastienlanglois Mar 12, 2024
0130c05
fix triggers
Zeitsperre Mar 12, 2024
6bf6c62
harden runners
Zeitsperre Mar 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
- '.github/workflows/*'
- 'tox.ini'
- 'Makefile'

'notebooks':
- changed-files:
- any-glob-to-any-file:
- 'docs/notebooks/**/*.ipynb'
76 changes: 76 additions & 0 deletions .github/workflows/label-on-approval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Label Pull Request on Pull Request review approval

on:
pull_request_review:
types:
- submitted
pull_request_target:
types:
- ready_for_review
- review_requested

permissions:
checks: write
contents: read
pull-requests: write

jobs:
label_approved:
name: Label on Approval
if: |
(!contains(github.event.pull_request.labels.*.name, 'approved')) &&
(github.event.review.state == 'approved') &&
(github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)
runs-on: ubuntu-latest
steps:
- name: Label Approved
uses: actions/github-script@v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['approved']
})

comment_approved:
name: Comment Concerning Approved Tag
if: |
(github.event_name == 'pull_request_target') &&
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
runs-on: ubuntu-latest
steps:
- name: Find comment
uses: peter-evans/find-comment@v2.4.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This Pull Request is coming from a fork and must be manually tagged `approved` in order to perform additional testing
- name: Create comment
if: |
(steps.fc.outputs.comment-id == '') &&
(!contains(github.event.pull_request.labels.*.name, 'approved')) &&
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
uses: peter-evans/create-or-update-comment@v3.1.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
> **Warning**
> This Pull Request is coming from a fork and must be manually tagged `approved` in order to perform additional testing.
edit-mode: replace
- name: Update comment
if: |
contains(github.event.pull_request.labels.*.name, 'approved')
uses: peter-evans/create-or-update-comment@v3.1.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
> **Note**
> This Pull Request is approved!
reactions: |
hooray
edit-mode: append
147 changes: 147 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ on:
- tests/test_xhydro.py
- xhydro/__init__.py
pull_request:
types:
- opened
- reopened
- synchronize
pull_request_review:
types:
- submitted

concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master.
Expand All @@ -25,6 +32,10 @@ jobs:
lint:
name: Lint (Python${{ matrix.python-version }})
runs-on: ubuntu-latest
if: |
((github.event_name == 'pull_request') && (github.event.action != 'labeled')) ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
strategy:
matrix:
python-version:
Expand All @@ -42,9 +53,54 @@ jobs:
run: |
python -m tox -e lint

test-preliminary:
name: Preliminary Tests (Python${{ matrix.python-version }})
needs: lint
if: |
(github.event_name == 'pull_request') && !contains(github.event.pull_request.labels.*.name, 'approved')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: "3.9"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
environment-file: environment-dev.yml
create-args: >-
mamba
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
mamba --version
echo "micromamba $(micromamba --version)"
- name: Install xHydro
run: |
python -m pip install --no-deps .
- name: Check versions
run: |
conda list
echo ESMF_VERSION=$(cat $ESMFMKFILE | grep "ESMF_VERSION_STRING=" | awk -F= '{print $2}' | tr -d "'")
python -m pip check || true
- name: Test with pytest
run: |
make test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-conda:
name: Test with Python${{ matrix.python-version }} (Anaconda)
needs: lint
if: |
contains(github.event.pull_request.labels.*.name, 'approved') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -81,6 +137,7 @@ jobs:
- name: Check versions
run: |
conda list
echo ESMF_VERSION=$(cat $ESMFMKFILE | grep "ESMF_VERSION_STRING=" | awk -F= '{print $2}' | tr -d "'")
python -m pip check || true
- name: Test with pytest
run: |
Expand All @@ -94,9 +151,99 @@ jobs:
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github

test-notebooks:
name: Test Notebooks
needs: lint
if: |
contains(github.event.pull_request.labels.*.name, 'notebooks') ||
contains(github.event.pull_request.labels.*.name, 'approved') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
environment-file: environment-dev.yml
create-args: >-
mamba
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
mamba --version
echo "micromamba $(micromamba --version)"
- name: Install xHydro
run: |
python -m pip install --no-deps .
- name: Check versions
run: |
conda list
echo ESMF_VERSION=$(cat $ESMFMKFILE | grep "ESMF_VERSION_STRING=" | awk -F= '{print $2}' | tr -d "'")
python -m pip check || true
- name: Test Notebooks
run: |
make test-notebooks-lax

# test-ESMF-source:
# name: Tests using ESMF from sources (Python${{ matrix.python-version }})
# needs: lint
# if: |
# contains(github.event.pull_request.labels.*.name, 'approved') ||
# (github.event.review.state == 'approved') ||
# (github.event_name == 'push')
# runs-on: ubuntu-latest
# env:
# ESMF_VERSION: "v8.5.0"
# strategy:
# matrix:
# include:
# - python-version: "3.9"
# steps:
# - uses: actions/checkout@v4.1.1
# - name: Install NetCDF
# run: |
# sudo apt-get -y update
# sudo apt install libnetcdf-dev libnetcdff-dev
# - name: Install ESMF
# uses: esmf-org/install-esmf-action@v1
# env:
# ESMF_NETCDF: nc-config
# with:
# cache: true
# version: ${{ env.ESMF_VERSION }}
# - name: Set up Python${{ matrix.python-version }}
# uses: actions/setup-python@v4.7.1
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install xhydro (with esmpy)
# run: |
# python -m pip install flit
# make dev
# env:
# ESMF_VERSION: ${{ env.ESMF_VERSION }}
# - name: Check versions
# run: |
# python -m pip list
# echo ESMF_VERSION=$(cat $ESMFMKFILE | grep "ESMF_VERSION_STRING=" | awk -F= '{print $2}' | tr -d "'")
# python -m pip check || true
# - name: Test with pytest
# run: |
# make test
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

finish:
needs:
- test-conda
- test-notebooks
runs-on: ubuntu-latest
container: python:3-slim
steps:
Expand Down
18 changes: 17 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: check-toml
- id: pretty-format-json
args: [ '--autofix', '--no-ensure-ascii', '--no-sort-keys' ]
# exclude: .ipynb
exclude: .ipynb
- id: check-yaml
args: [ '--allow-multiple-documents' ]
- repo: https://github.com/pappasam/toml-sort
Expand Down Expand Up @@ -61,6 +61,22 @@ repos:
hooks:
- id: blackdoc
additional_dependencies: [ 'black==24.2.0' ]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
files: '.ipynb'
args: [ '--keep-count', '--keep-output', '--drop-empty-cells', '--extra-keys=metadata.kernelspec' ]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-pyupgrade
args: [ '--py39-plus' ]
additional_dependencies: [ 'pyupgrade==3.15.0' ]
- id: nbqa-black
additional_dependencies: [ 'black==24.2.0' ]
- id: nbqa-isort
additional_dependencies: [ 'isort==5.13.2' ]
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
Expand Down
20 changes: 20 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@
Changelog
=========

v0.4.0 (unreleased)
-------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Thomas-Charles Fortier Filion (:user:`TC-FF`), Sébastien Langlois (:user:`sebastienlanglois`).

New features and enhancements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* `xhydro` has implemented a `gis` module that facilitates geospatial tasks needed for gathering hydrological inputs. (:issue:`60`, :pull:`61`).

Internal changes
^^^^^^^^^^^^^^^^
* Added a workflow based on `actions/labeler` to automatically label Pull Requests based on files changed. (:pull:`68`).
* Added a conditional trigger to the `test-notebooks` job to run in advance of pull request approval in the event that the notebooks found within `docs/notebooks` have been modified (labeled `"notebooks"`). (:pull:`68`).
* Significant changes to the Continuous Integration (CI) setup. (:pull:`65`):
* Added a workflow configuration using ``label_on_approval.yml`` and modifications of ``main.yml`` so that fewer tests are run on Pull Requests before they are fully approved.
* Added some `pre-commit` configurations to both clean up the code within notebooks (`NbQA`) and strip their outputs (`nbstripout`).
* `tox` is now fully v4.0-compliant.
* Added a `Makefile` recipe to facilitate installation of `esmpy` when `esmf` is installed and visible on the `$PATH`.
* Added a `Makefile` recipe for running tests over Jupyter notebooks.
* Synchronized dependencies between `pyproject.toml` and `conda` configuration files.

v0.3.4 (2024-02-29)
-------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Thomas-Charles Fortier Filion (:user:`TC-FF`), Gabriel Rondeau-Genesse (:user:`RondeauG`).
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ lint: lint/flake8 lint/black ## check style
test: ## run tests quickly with the default Python
python -m pytest

test-notebooks: ## run tests on notebooks and compare outputs
pytest --no-cov --nbval --rootdir=tests/ docs/notebooks

test-notebooks-lax: ## run tests on notebooks but don't be so strict about outputs
pytest --no-cov --nbval-lax --rootdir=tests/ docs/notebooks

test-all: ## run tests on every Python version with tox
tox

Expand Down Expand Up @@ -107,8 +113,12 @@ dist: clean ## builds source and wheel package
release: dist ## package and upload a release
python -m flit publish dist/*

install: clean ## install the package to the active Python's site-packages
ESMF_VERSION := $(shell cat $(ESMFMKFILE) | grep "ESMF_VERSION_STRING=" | awk -F= '{print $$2}' | tr -d "'")
install-esmpy: clean ## install esmpy from git based on installed ESMF_VERSION
pip install git+https://github.com/esmf-org/esmf.git@v$(ESMF_VERSION)\#subdirectory=src/addon/esmpy

install: install-esmpy ## install the package to the active Python's site-packages
Comment on lines +116 to +120
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Zeitsperre We can leave this here as an additional security, but this should not be required anymore (yay!)

  • If xESMF is badly installed or initiated, xscen will simply deactivate the functions using it. xhydro/xdatasets do not use it at all, for now.
  • esmf/esmpy 8.6.0 has been released and should have fixed that bug too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want to, we can remove the install-esmpy step from install. This just means that we don't install the GitHub repo version when we run $ make install. I can see having that disabled as being beneficial for users in systems that don't have grep, awk, and tr installed (powershell and command prompt, probably)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's leave that for another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just wanted to point out that xdatasets has xesmf as a dependency because of xagg. I had initially created a spinoff xagg library with no xesmf dependency (because xesmf is used for regridding but not for spatial averaging in xagg, which is the only thing required for xdatasets) but we now have xagg as a dependency.

xesmf is required for the notebooks but might not be for the tests.

python -m flit install

dev: clean ## install the package to the active Python's site-packages
dev: install-esmpy ## install the package to the active Python's site-packages
python -m flit install --symlink
Binary file added docs/_static/_images/example_draw_marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
import warnings
from pathlib import Path

import os
Expand Down Expand Up @@ -77,7 +78,14 @@
}

# Generate documentation from Jupyter notebooks.
nbsphinx_execute = "always"
skip_notebooks = os.getenv("SKIP_NOTEBOOKS")
if skip_notebooks:
warnings.warn("Not executing notebooks.")
nbsphinx_execute = "never"
elif os.getenv("GITHUB_ACTIONS"):
nbsphinx_execute = "always"
else:
nbsphinx_execute = "auto"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Welcome to xHydro's documentation!
readme
installation
usage
notebooks/gis
notebooks/local_frequency_analysis
notebooks/climate_change
planification
Expand Down
Loading
Loading