Skip to content

Avoid caching failed calcium tutorial downloads - #657

Merged
gviejo merged 1 commit into
pynapple-org:devfrom
viranovskaya:docs/calcium-download-safety
Sep 16, 2026
Merged

gviejo merged 1 commit into
pynapple-org:devfrom
viranovskaya:docs/calcium-download-safety

Conversation

@viranovskaya

Copy link
Copy Markdown

The calcium-imaging tutorial writes the response straight to the final NWB filename without checking the HTTP status. An error response or an interrupted stream can leave a file that later runs treat as a completed download.

This adds an HTTP status check and a timeout, writes to a .part file, and renames it only after the download finishes.

I checked successful downloads, HTTP errors, interrupted downloads followed by a retry, and preservation of an existing file in four local offline tests. I also downloaded the current OSF file, verified its SHA-256 against the server metadata, and opened it with nap.load_file(..., lazy_loading=False).

This is a small hardening change prompted by the invalid-HDF5 error in the documentation run for #640. The failed response was not logged, so I cannot establish its exact cause. Existing cached files are not revalidated, and I have not run a full Sphinx build.

@gviejo
gviejo merged commit 3a6fdcf into pynapple-org:dev Sep 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants