Repository navigation
Move zip/folder I/O behind a storage-backend seam (no behaviour change) - #152
Open
francopestilli wants to merge 1 commit into
Open
francopestilli wants to merge 1 commit into
francopestilli wants to merge 1 commit into
Conversation
Introduce trx/backends/ with a small TrxBackend protocol and a registry, and move the code that walks a .trx zip or folder, memory-maps each array and assembles a TrxFile (load_from_zip, load_from_directory, _create_trx_from_pointer, zip_from_folder, and the bodies of load and save) into trx.backends.memmap.MemmapBackend. The logic is unchanged; it has only moved. trx.trx_file_memmap keeps every public name: load() and save() now pick the backend from the path through the registry, and load_from_zip, load_from_directory, zip_from_folder and TrxFile._create_trx_from_pointer delegate to the memmap module, so DIPY, scilpy and existing scripts import exactly what they did before. This is the first step toward letting a TrxFile open and save other containers (a Zarr Vectors store is the motivating case) without touching the TRX specification or the TrxFile API. Adds trx/tests/test_backends.py covering the registry, extension dispatch, a save/load round trip, the legacy names, and registering a custom backend. Existing suite: 205 passed before and after. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AfVKrdLrUh3AEnK2A5Ez2L
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
==========================================
+ Coverage 86.40% 86.90% +0.50%
==========================================
Files 15 19 +4
Lines 3031 3193 +162
==========================================
+ Hits 2619 2775 +156
- Misses 412 418 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
First step of #153: the backend seam alone, no behaviour change. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce trx/backends/ with a small TrxBackend protocol and a registry,
and move the code that walks a .trx zip or folder, memory-maps each
array and assembles a TrxFile (load_from_zip, load_from_directory,
_create_trx_from_pointer, zip_from_folder, and the bodies of load and
save) into trx.backends.memmap.MemmapBackend. The logic is unchanged;
it has only moved.
trx.trx_file_memmap keeps every public name: load() and save() now
pick the backend from the path through the registry, and
load_from_zip, load_from_directory, zip_from_folder and
TrxFile._create_trx_from_pointer delegate to the memmap module, so
DIPY, scilpy and existing scripts import exactly what they did before.
This is the first step toward letting a TrxFile open and save other
containers (a Zarr Vectors store is the motivating case) without
touching the TRX specification or the TrxFile API.
Adds trx/tests/test_backends.py covering the registry, extension
dispatch, a save/load round trip, the legacy names, and registering a
custom backend. Existing suite: 205 passed before and after.
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01AfVKrdLrUh3AEnK2A5Ez2L