From 2c35bc96fa898a3d4525f1e8cae6d16d02d734fa Mon Sep 17 00:00:00 2001 From: Lloyd Izard <76954858+LOCEANlloydizard@users.noreply.github.com> Date: Sat, 18 Apr 2026 19:24:50 +0200 Subject: [PATCH 1/2] Fix dev setup issues with pooch data fetch and cache handling - Add pooch to dev requirements - Ensure pooch cache directory is created if missing - Improve data fetch (retry + timeout) - Document USE_POOCH setup for local environments --- .ci_helpers/docker/setup-services.py | 6 +----- docs/source/contrib_setup.md | 14 ++++++++++++++ echopype/tests/conftest.py | 7 ++++--- requirements-dev.txt | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.ci_helpers/docker/setup-services.py b/.ci_helpers/docker/setup-services.py index b460e6766..c5b2f8c25 100755 --- a/.ci_helpers/docker/setup-services.py +++ b/.ci_helpers/docker/setup-services.py @@ -31,11 +31,7 @@ def get_pooch_data_path() -> Path: """Return path to the Pooch test data cache.""" ver = os.getenv("ECHOPYPE_DATA_VERSION", "v0.11.1a2") cache_dir = Path(pooch.os_cache("echopype")) / ver - if not cache_dir.exists(): - raise FileNotFoundError( - f"Pooch cache directory not found: {cache_dir}\n" - "Make sure test data was fetched via conftest.py" - ) + cache_dir.mkdir(parents=True, exist_ok=True) return cache_dir diff --git a/docs/source/contrib_setup.md b/docs/source/contrib_setup.md index ab7679ca0..311da5d12 100644 --- a/docs/source/contrib_setup.md +++ b/docs/source/contrib_setup.md @@ -47,6 +47,20 @@ To create an environment for developing Echopype, we recommend the following ste pip install -e ".[plot]" ``` +For a fresh local setup, enable the Pooch-based test data fetch before running tests. + +On Linux/macOS: +```shell +export USE_POOCH=True +``` + +On Windows PowerShell: +```shell +$env:USE_POOCH="True" +``` + +This allows the required test data to be downloaded into the local Pooch cache on first run. + :::{tip} We recommend using Mamba to get around Conda's sometimes slow or stuck behavior when solving dependencies. See [Mamba's documentation](https://mamba.readthedocs.io/en/latest/) for installation and usage. diff --git a/echopype/tests/conftest.py b/echopype/tests/conftest.py index 6b1f9513c..be570fe6d 100644 --- a/echopype/tests/conftest.py +++ b/echopype/tests/conftest.py @@ -69,9 +69,11 @@ base_url=base, version=ver, registry=registry, - retry_if_failed=1, + retry_if_failed=5, ) + downloader = pooch.HTTPDownloader(timeout=120) + def _unpack(fname, action, pooch_instance): z = Path(fname) out = z.parent / z.stem @@ -125,12 +127,11 @@ def _unpack(fname, action, pooch_instance): return str(out) - for b in bundles: url = base.format(version=ver) + b print(f"[echopype-ci] fetching bundle: {b}") print(f"[echopype-ci] → URL: {url}") - EP.fetch(b, processor=_unpack, progressbar=False) + EP.fetch(b, processor=_unpack, progressbar=False, downloader=downloader) print( "\n[echopype-ci] TEST_DATA_FOLDER\n" diff --git a/requirements-dev.txt b/requirements-dev.txt index c4f35dc11..cf63c2f7d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,3 +25,4 @@ sphinx_rtd_theme sphinxcontrib-mermaid twine wheel +pooch From 4451b4a11a32a4f37fdf6c95f885900b91d54173 Mon Sep 17 00:00:00 2001 From: Lloyd Izard <76954858+LOCEANlloydizard@users.noreply.github.com> Date: Sat, 18 Apr 2026 19:50:02 +0200 Subject: [PATCH 2/2] Update conftest.py --- echopype/tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/echopype/tests/conftest.py b/echopype/tests/conftest.py index be570fe6d..82dd22f9d 100644 --- a/echopype/tests/conftest.py +++ b/echopype/tests/conftest.py @@ -72,7 +72,7 @@ retry_if_failed=5, ) - downloader = pooch.HTTPDownloader(timeout=120) + downloader = pooch.HTTPDownloader(timeout=300) def _unpack(fname, action, pooch_instance): z = Path(fname) @@ -130,7 +130,7 @@ def _unpack(fname, action, pooch_instance): for b in bundles: url = base.format(version=ver) + b print(f"[echopype-ci] fetching bundle: {b}") - print(f"[echopype-ci] → URL: {url}") + print(f"[echopype-ci] -> URL: {url}") EP.fetch(b, processor=_unpack, progressbar=False, downloader=downloader) print(