Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
118 changes: 42 additions & 76 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI
env:
micromamba_version: 1.5
micromamba_version: 2


on:
Expand All @@ -16,42 +16,59 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nbqa ruff black jupytext isort

- name: Lint with Ruff
run: nbqa ruff notebooks/**/*.md

- name: Lint with Isort
run: nbqa isort notebooks/**/*.md

- name: Check formatting with Black
run: nbqa black notebooks/**/*.md

build_0:
name: wradlib notebooks - linux
runs-on: ubuntu-latest
needs: [lint]
defaults:
run:
shell: bash -l {0}
env:
WRADLIB_DATA: ./wradlib-data
CONDA_ENV_FILE: ci/requirements/notebooks.yml
CONDA_ENV_FILE: environment.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-name: wradlib-notebooks
environment-file: ${{env.CONDA_ENV_FILE}}
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
- name: Install wradlib
run: |
git clone https://github.com/wradlib/wradlib.git
cd wradlib
echo "WRADLIB_TAG=`git name-rev --name-only --tags HEAD`" >> $GITHUB_ENV
python -m pip install . --no-deps
- name: Install wradlib-data
run: |
python -m pip install wradlib-data
mkdir ./wradlib-data
- name: Version Info
run: |
python -c "import wradlib; print(wradlib.version.version)"
Expand All @@ -62,60 +79,34 @@ jobs:
run: |
export WRADLIB_DATA=`realpath $WRADLIB_DATA`
pytest -n auto --verbose --durations=15 --pyargs notebooks
- name: Commit files
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
git config --global user.email "wradlib-docs@wradlib.org"
git config --global user.name "wradlib-docs-bot"
git checkout --orphan render
git add --all .
git commit -m "Rendering at commit $GITHUB_SHA"
- name: Push changes
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
if [ $WRADLIB_TAG == 'undefined' ]; then
BRANCH=devel
else
BRANCH=$WRADLIB_TAG
fi
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/wradlib/wradlib-notebooks.git render:$BRANCH -fq

build_1:
name: wradlib notebooks - macosx
runs-on: macos-latest
needs: [lint]
defaults:
run:
shell: bash -l {0}
env:
WRADLIB_DATA: ./wradlib-data
CONDA_ENV_FILE: ci/requirements/notebooks.yml
CONDA_ENV_FILE: environment.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-name: wradlib-notebooks
environment-file: ${{env.CONDA_ENV_FILE}}
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
- name: Install wradlib
run: |
git clone https://github.com/wradlib/wradlib.git
cd wradlib
echo "WRADLIB_TAG=`git name-rev --name-only --tags HEAD`" >> $GITHUB_ENV
python -m pip install . --no-deps
- name: Install wradlib-data
run: |
python -m pip install wradlib-data
mkdir ./wradlib-data
- name: Version Info
run: |
python -c "import wradlib; print(wradlib.version.version)"
Expand All @@ -130,38 +121,30 @@ jobs:
build_2:
name: wradlib notebooks - windows
runs-on: windows-latest
needs: [lint]
defaults:
run:
shell: bash -l {0}
env:
WRADLIB_DATA: ./wradlib-data
CONDA_ENV_FILE: ci/requirements/notebooks.yml
CONDA_ENV_FILE: environment.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-name: wradlib-notebooks
environment-file: ${{env.CONDA_ENV_FILE}}
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
- name: Install wradlib
run: |
git clone https://github.com/wradlib/wradlib.git
cd wradlib
python -m pip install . --no-deps
- name: Install wradlib-data
run: |
python -m pip install wradlib-data
mkdir ./wradlib-data
- name: Version Info
run: |
python -c "import wradlib; print(wradlib.version.version)"
Expand All @@ -172,20 +155,3 @@ jobs:
run: |
export WRADLIB_DATA=`python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" $WRADLIB_DATA`
pytest -n auto --verbose --durations=15 --pyargs notebooks

trigger_rtd:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [build_0]
name: trigger readthedocs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
RTD_URL: ${{ secrets.RTD_URL }}
steps:
- name: trigger readthedocs
run: |
echo "triggering"
curl -X POST -H "Authorization: Token $RTD_TOKEN" "$RTD_URL"
90 changes: 0 additions & 90 deletions .github/workflows/render.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# whitelist notebooks
!notebooks/
#!/notebooks/**
# ignore .py (paired notebooks)
notebooks/**/*.py

# whitelist .dask
!.dask/
Expand Down
65 changes: 40 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
# --- Jupytext: create temporary .py mirrors from MyST notebooks ---
- repo: https://github.com/mwouts/jupytext
rev: v1.19.0.dev0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args:
- '--py38-plus'
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
args: ['--extra-keys', 'metadata.kernelspec cell.metadata.pycharm cell.metadata.tags']
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.254'
- id: jupytext
name: jupytext (md → py)
files: "^notebooks/.*\\.md$"
args: ["--to", "py:percent"]
pass_filenames: false
always_run: true

# --- Ruff ---
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.6
hooks:
- id: ruff
args: [ "--fix" ]
name: ruff (lint + fix)
files: "^notebooks/.*\\.py$"
args: ["--fix"]

# --- Black ---
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 25.11.0
hooks:
- id: black
- id: black-jupyter
files: "^notebooks/.*\\.py$"

# --- Jupytext: sync py → md (only paired mirrors) ---
- repo: https://github.com/mwouts/jupytext
rev: v1.19.0.dev0
hooks:
- id: jupytext
name: jupytext (sync py → md)
files: '^notebooks/(?!__init__\\.py$)(?!conftest\\.py$).*\\.py$'
args: ["--sync"]
# DO NOT set pass_filenames: false
always_run: false

# --- Cleanup temporary .py files ---
- repo: local
hooks:
- id: cleanup-jupytext
name: Remove temporary Jupytext Python mirrors
entry: bash -c "find notebooks -type f -name '*.py' ! -name '__init__.py' ! -name 'conftest.py' -exec rm -f {} +"
language: system
always_run: true
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: mambaforge-latest

conda:
environment: environment.yml

sphinx:
builder: html
configuration: conf.py
Loading
Loading