Skip to content

chore(dataform): warn about future removal of MATLAB-compatible writes#142

Merged
KenyaOtsuka merged 1 commit into
KamitaniLab:devfrom
KenyaOtsuka:chore/deprecate-matlab-compatible-writes
Jul 3, 2026
Merged

chore(dataform): warn about future removal of MATLAB-compatible writes#142
KenyaOtsuka merged 1 commit into
KamitaniLab:devfrom
KenyaOtsuka:chore/deprecate-matlab-compatible-writes

Conversation

@KenyaOtsuka

Copy link
Copy Markdown

Summary

This is a warning-only PR. It adds a FutureWarning to the bdpy.dataform
write paths that currently produce MATLAB-compatible v7.3 .mat files
(via hdf5storage.savemat(..., format='7.3', ...)), giving users advance
notice before the format changes.

No behavior changes here. The on-disk format, the hdf5storage dependency,
and the _mat_v73 reader are all left untouched, and round-trip behavior is
identical. The actual write-side breaking change — switching these writers to
bdpy-native plain HDF5 and dropping the hdf5storage dependency — is done in
#141. This PR is intended to land first so users get a release with the
deprecation warning before #141 changes the format.

What the warning says

Emitted as a FutureWarning:

Writing MATLAB-compatible v7.3 .mat files is deprecated and will change in a
future release: bdpy will write bdpy-native plain HDF5 instead. Newly written
files will no longer be guaranteed to be readable by MATLAB's load().
Reading existing hdf5storage / MATLAB v7.3 files remains supported.

In short:

  • MATLAB-compatible v7.3 .mat writing is going away in a future release (Drop the hdf5storage dependency (write-side breaking change) #141).
  • bdpy will write bdpy-native plain HDF5 instead.
  • Newly written files will no longer be guaranteed to be readable by MATLAB's load().
  • Reading existing hdf5storage / MATLAB v7.3 files remains supported.

Affected write paths

These are exactly the paths that #141 rewrites to plain HDF5:

  • bdpy/dataform/sparse.py
    • save_array(..., sparse=False) (dense branch)
    • save_multiarrays(...)
    • SparseArray.save(...)
  • bdpy/dataform/features.py
    • save_feature(...)

Note: save_array(..., sparse=True) delegates to SparseArray.save, so the
warning fires there — exactly one FutureWarning per call, no double-warn.

Tests

  • New assertWarns(FutureWarning) tests for each write path, each also
    asserting the save/load round-trip is unchanged
    (tests/dataform/test_sparse.py, tests/dataform/test_features.py).
  • Manually verified each path emits exactly one FutureWarning.
  • pytest tests/dataform/test_sparse.py tests/dataform/test_features.py → all pass (NumPy 2.x).

Add a FutureWarning to the MATLAB-compatible v7.3 .mat write paths that are
slated to become bdpy-native plain HDF5: save_array (dense), save_multiarrays,
SparseArray.save, and save_feature.

This is warning-only. The on-disk format, the hdf5storage dependency, and the
_mat_v73 reader are all unchanged, and reading existing hdf5storage / MATLAB
v7.3 files remains supported. The actual switch to plain HDF5 is implemented on
the refactor/drop-hdf5storage-write branch.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KenyaOtsuka

Copy link
Copy Markdown
Author

When reviewing this PR, I'd appreciate it if you could also check whether the approach taken in #141 is acceptable.

@KenyaOtsuka KenyaOtsuka marked this pull request as ready for review June 30, 2026 02:46

@HirokiYasuda03 HirokiYasuda03 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KenyaOtsuka
Thank you for your lot of works. I think it's OK to merge this PR.

I've also checked PR #142. I think the approach is fine (I'll review the code itself again and provide feedback once it's marked as “ready for review”).

@KenyaOtsuka KenyaOtsuka merged commit 1409ca2 into KamitaniLab:dev Jul 3, 2026
3 of 6 checks passed
@KenyaOtsuka KenyaOtsuka deleted the chore/deprecate-matlab-compatible-writes branch July 3, 2026 01:39
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.

3 participants