From c6e8ac5f322e0779645a9c380293d8864afa72bf Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Tue, 12 Nov 2024 11:50:50 +0100 Subject: [PATCH 1/4] Minimal deps test in CI --- .github/workflows/ci_tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index dbc1c57..ec9080b 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -32,3 +32,15 @@ jobs: - name: Test with tox run: | tox + + minimal-dependencies: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create virtual env + run: python3 -m venv venv --upgrade-deps + - name: Install pyaro + run: source venv/bin/activate && pip install ./ + - name: Try importing pyaro + run: source venv/bin/activate && python -c "import pyaro; print(pyaro.__version__)" + From a457b843dd912cc280cdea872209a26a38ea2e3d Mon Sep 17 00:00:00 2001 From: thorbjoernl <51087536+thorbjoernl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:32:37 +0100 Subject: [PATCH 2/4] Fix pyaro not working without optional deps (I hope) --- src/pyaro/timeseries/Filter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pyaro/timeseries/Filter.py b/src/pyaro/timeseries/Filter.py index 3c92226..3326920 100644 --- a/src/pyaro/timeseries/Filter.py +++ b/src/pyaro/timeseries/Filter.py @@ -1227,11 +1227,11 @@ def __init__( upper: float | None = None, ): if "cf_units" not in sys.modules: - raise ModuleNotFoundError( + logger.info( "valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter." ) if "xarray" not in sys.modules: - raise ModuleNotFoundError( + logger.info( "valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter." ) @@ -1254,8 +1254,16 @@ def name(self): return "valleyfloor_relaltitude" def filter_stations(self, stations: dict[str, Station]) -> dict[str, Station]: - filtered_stations = {} + if "cf_units" not in sys.modules: + raise ModuleNotFoundError( + "valleyfloor_relaltitude filter is missing required dependency 'cf-units'. Please install to use this filter." + ) + if "xarray" not in sys.modules: + raise ModuleNotFoundError( + "valleyfloor_relaltitude filter is missing required dependency 'xarray'. Please install to use this filter." + ) + filtered_stations = {} with xr.open_dataset(self._topo_file) as topo: for k, v in stations.items(): lat = v.latitude From 61dd5170d2d1f31f3409707ac08d455d753ee725 Mon Sep 17 00:00:00 2001 From: thorbjoernl <51087536+thorbjoernl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:39:02 +0100 Subject: [PATCH 3/4] Try again --- src/pyaro/timeseries/Filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyaro/timeseries/Filter.py b/src/pyaro/timeseries/Filter.py index 3326920..1a3fd38 100644 --- a/src/pyaro/timeseries/Filter.py +++ b/src/pyaro/timeseries/Filter.py @@ -1293,7 +1293,7 @@ def _calculate_relative_altitude( *, radius: float, altitude: float, - topo: xr.Dataset, + topo: "xr.Dataset", ): """Calculates relative altitude From 1adfc4609906cf58e3517f741285ff558a69fb0c Mon Sep 17 00:00:00 2001 From: thorbjoernl <51087536+thorbjoernl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:42:01 +0100 Subject: [PATCH 4/4] Retry docs build