Repository navigation
Answer what shape a file is, without reading it - #156
Merged
Merged
Conversation
Sizing the destination of a batch read means knowing the shape of one image or volume, and rexlib now answers that without the caller opening anything. The manager is defaulted the way it is for read and write, so a caller asks about a path and nothing else, and the extents come back as a tuple to agree with every other shape this package reports. The overloads over a reader provider are left until the provider is bound. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ind-the-shape-queries
|
oierlauzi
approved these changes
Sep 20, 2026
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.



Item 3a of the backlog, and the half of the batch source work that carries no
threads and no GIL.
Sizing the destination of a batch read means knowing the shape of one image or
volume before allocating anything. rexlib gained
query_extentsandquery_core_extentsin gigabit-clowns/rexlib#461; this binds them.The second is the one that matters: its documentation upstream calls it "the
shape of a single image or volume, which is what the destination of a batch
carries beside its leading extent", so none of that arithmetic has to be
reproduced here.
Three choices worth naming
Extents come back as tuples, built explicitly rather than let through as
lists. A shape is a tuple everywhere else in this package after #153, and a
query that answered with a list would be the odd one out for no reason.
The wrapper takes the path first. C++ has
query_extents(formats, path);the Python layer is
query_extents(path, manager=None). This is the firstplace the second layer reorders arguments rather than only defaulting them,
and it is the point of the layer: leaving the manager first would force every
caller to fetch one, which is exactly what defaulting exists to avoid. The
binding underneath keeps the C++ order with both arguments required.
The overloads over a reader provider are not here. They take an
image_reader_provider&, and nothing binds a provider yet — that arrives with3b, which binds the whole chain. Worth noting for then: those take a non-const
reference where the format manager ones take a const one, since a caching
provider mutates as it opens.
The submodule moves
external/rexlibgoes from741b262to43bbffec. Not incidental — the codehere now needs a rexlib that has these functions, and CI overriding the pin
with
git submodule update --remotewould hide that from anyone cloning andbuilding by the README.
Checked
g++ -std=c++20 -fsyntax-only -Wall -Wextra -Wpedanticagainst the updated submodule.
ruff check .passes; 47 tests collect undertests/em/image/.that a written file reports the extents it was written with, that both
answers are tuples, that the core is the tail of the whole whatever the rank,
and that what comes back sizes a destination. The failure case is
RuntimeErrorfor the same reason as the neighbouring tests — a file noformat claims reaches
invalid_operation_error, which derives fromstd::logic_error.🤖 Generated with Claude Code