Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning if writing file without .nwb.zarr file extension #265

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

stephprince
Copy link
Contributor

@stephprince stephprince commented Feb 21, 2025

Motivation

Fix #230. Add a warning if writing a Zarr NWBFile that does not end in .nwb.zarr.

How to test the behavior?

from datetime import datetime
from dateutil.tz import tzutc
from pynwb import NWBFile
from hdmf_zarr import NWBZarrIO

nwbfile = NWBFile(session_description='a test NWB File',
                                identifier='TEST123',
                                session_start_time=datetime(1970, 1, 1, 12, tzinfo=tzutc()))
with NWBZarrIO("path.h5", 'w') as io:
    io.write(nwbfile)

Warns with:

UserWarning: The file path provided: path.h5 does not end in '.nwb.zarr'. It is recommended that NWB files using the Zarr backend use the '.nwb.zarr' extension
  warnings.warn(f"The file path provided: {path} does not end in '.nwb.zarr'. "

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.07%. Comparing base (b5b3ce6) to head (4625a4f).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #265      +/-   ##
==========================================
+ Coverage   86.87%   87.07%   +0.19%     
==========================================
  Files           5        5              
  Lines        1196     1199       +3     
  Branches      227      228       +1     
==========================================
+ Hits         1039     1044       +5     
+ Misses         98       97       -1     
+ Partials       59       58       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

[Feature]: Warn if writing a file that does not end in appropriate extension
2 participants