Skip to content

Commit 147f1ad

Browse files
Merge pull request #1656 from LOCEANlloydizard/update-dev-setup
Fix dev setup issues with pooch data fetch and cache handling
2 parents a3c74e3 + 4451b4a commit 147f1ad

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

.ci_helpers/docker/setup-services.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ def get_pooch_data_path() -> Path:
3131
"""Return path to the Pooch test data cache."""
3232
ver = os.getenv("ECHOPYPE_DATA_VERSION", "v0.11.1a2")
3333
cache_dir = Path(pooch.os_cache("echopype")) / ver
34-
if not cache_dir.exists():
35-
raise FileNotFoundError(
36-
f"Pooch cache directory not found: {cache_dir}\n"
37-
"Make sure test data was fetched via conftest.py"
38-
)
34+
cache_dir.mkdir(parents=True, exist_ok=True)
3935
return cache_dir
4036

4137

docs/source/contrib_setup.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ To create an environment for developing Echopype, we recommend the following ste
4747
pip install -e ".[plot]"
4848
```
4949

50+
For a fresh local setup, enable the Pooch-based test data fetch before running tests.
51+
52+
On Linux/macOS:
53+
```shell
54+
export USE_POOCH=True
55+
```
56+
57+
On Windows PowerShell:
58+
```shell
59+
$env:USE_POOCH="True"
60+
```
61+
62+
This allows the required test data to be downloaded into the local Pooch cache on first run.
63+
5064
:::{tip}
5165
We recommend using Mamba to get around Conda's sometimes slow or stuck behavior when solving dependencies.
5266
See [Mamba's documentation](https://mamba.readthedocs.io/en/latest/) for installation and usage.

echopype/tests/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@
6969
base_url=base,
7070
version=ver,
7171
registry=registry,
72-
retry_if_failed=1,
72+
retry_if_failed=5,
7373
)
7474

75+
downloader = pooch.HTTPDownloader(timeout=300)
76+
7577
def _unpack(fname, action, pooch_instance):
7678
z = Path(fname)
7779
out = z.parent / z.stem
@@ -125,12 +127,11 @@ def _unpack(fname, action, pooch_instance):
125127

126128
return str(out)
127129

128-
129130
for b in bundles:
130131
url = base.format(version=ver) + b
131132
print(f"[echopype-ci] fetching bundle: {b}")
132-
print(f"[echopype-ci] URL: {url}")
133-
EP.fetch(b, processor=_unpack, progressbar=False)
133+
print(f"[echopype-ci] -> URL: {url}")
134+
EP.fetch(b, processor=_unpack, progressbar=False, downloader=downloader)
134135

135136
print(
136137
"\n[echopype-ci] TEST_DATA_FOLDER\n"

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ sphinx_rtd_theme
2525
sphinxcontrib-mermaid
2626
twine
2727
wheel
28+
pooch

0 commit comments

Comments
 (0)