refactor!: Rename the decoded result types to the Tensor family - #172
Merged
Conversation
Name the four concrete result classes after the two axes that actually decide their layout: fixed- vs variable-length, and optional (masked) vs not. `Tensor` becomes the union that a read returns, which is the name users see in every read signature. - `Tensor` (class) -> `FixedLengthTensor` - `VariableArray` -> `VariableLengthTensor` - `MaskedTensor` -> `OptionalFixedLengthTensor` - `MaskedVariableArray` -> `OptionalVariableLengthTensor` - `DecodedArray` (alias) -> `Tensor` The Rust side follows: the `Py`-prefixed wrappers take the new names, the internal enum becomes `Tensor` with variants that mirror the `ArrayBytes` layouts (`Fixed`, `Variable`, `OptionalFixed`, `OptionalVariable`), and `src/data/tensor.rs` becomes `src/data/fixed.rs` to pair with `variable.rs`. This is a rename only. No behavior changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 10, 2026
It is a Rust type that interfaces to and from Python (it implements IntoPyObject), so it takes the Py prefix like the pyclass wrappers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
@d-v-b and I got on a call and decided on some names, as we wrote down here.
In particular, our current
DecodedArraybecomesTensor, a type alias that is a union of fixed and variable-length in-memory n-d arrays.In the future, I would like to explore merging
FixedLengthTensorandOptionalFixedLengthTensorinto a single class. But that would be a bit messy because the__array__would sometimes convert to a plain array and other times convert to a masked array.Supersedes #136. That PR renamed the
DecodedArrayalias toArrayData; this takes a different direction, and branches fresh offmaininstead (#136 had gone stale against #145–#150 and #160–#168).A read returns a
Tensor. The four concrete classes are named after the two axes that actually decide the layout: fixed- vs variable-length, and optional (masked) vs not.Tensor(class)FixedLengthTensorVariableArrayVariableLengthTensorMaskedTensorOptionalFixedLengthTensorMaskedVariableArrayOptionalVariableLengthTensorDecodedArray(alias)TensorRust side
Py-prefixed wrappers take the matching names.PyTensor(it implementsIntoPyObject, so it takes thePyprefix), with variants that mirror theArrayByteslayouts that produce them:Fixed,Variable,OptionalFixed,OptionalVariable.src/data/tensor.rsbecomessrc/data/fixed.rs, to pair withvariable.rs.repr::decoded_array_reprbecomesrepr::tensor_repr.PyTensorBufferkeeps its name. It is an internal buffer-protocol helper and is not exported to Python.Scope
Rename only. No behavior changes.
Follow-up
We want to prototype collapsing the four classes into two, with nullability carried as an optional mask on
FixedLengthTensor/VariableLengthTensorrather than as separateOptional*classes. That is a separate PR; this one lands the naming first. TheOptionalnames may get another look then.Verification
cargo clippy --all-targets --all-features -- -D warnings— cleancargo test --all-features— 28 passedcargo fmt --check(with the CI config) — cleanpytest— 325 passed, 1 xfailedruff check/ruff format --check— cleanpydoclinton the.pyistubs — no violationsmkdocs build --strict— clean🤖 Generated with Claude Code