From 5f85aa71ec7c6ddc68b846bb3f0331e6a6ebd3f0 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:19:09 +0200 Subject: [PATCH] Remove GHA keys (not supported by miniconda, only micromamba) and typing --- .github/actions/install-parcels/action.yml | 2 -- parcels/_compat.py | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/actions/install-parcels/action.yml b/.github/actions/install-parcels/action.yml index a7aea0602..66a3bbccc 100644 --- a/.github/actions/install-parcels/action.yml +++ b/.github/actions/install-parcels/action.yml @@ -24,8 +24,6 @@ runs: environment-file: ${{ inputs.environment-file }} python-version: ${{ inputs.python-version }} channels: conda-forge - cache-environment: true - cache-downloads: true - name: MPI support if: ${{ ! (runner.os == 'Windows') }} run: conda install -c conda-forge mpich mpi4py diff --git a/parcels/_compat.py b/parcels/_compat.py index 981ef30a5..6efab15a7 100644 --- a/parcels/_compat.py +++ b/parcels/_compat.py @@ -2,13 +2,18 @@ __all__ = ["MPI", "KMeans"] +from typing import Any + +MPI: Any | None = None +KMeans: Any | None = None + try: - from mpi4py import MPI + from mpi4py import MPI # type: ignore[no-redef] except ModuleNotFoundError: - MPI = None + pass # KMeans is used in MPI. sklearn not installed by default try: - from sklearn.cluster import KMeans + from sklearn.cluster import KMeans # type: ignore[no-redef] except ModuleNotFoundError: - KMeans = None + pass