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

Match NumPy regarding .npy for names in .npz files #76

Merged
merged 2 commits into from
Sep 14, 2024
Merged

Conversation

jturner314
Copy link
Owner

Fixes #48.

When writing a .npz file, NumPy unconditionally adds ".npy" to every name. When generating the public list of names when reading a .npz file, NumPy strips a single ".npy" (if present) from each name. When accessing an array in a .npz file by name, it first checks if that exact name is in the .npz file, and if not, it then tries the name with ".npy" appended. While I personally dislike the inconsistency/implicitness of this behavior, ndarray-npy should follow it for compatibility with NumPy.

Closes #48.

When writing a .npz file, NumPy unconditionally adds ".npy" to every
name. When generating the public list of names when reading a .npz
file, NumPy strips a single ".npy" (if present) from each name. When
accessing an array in a .npz file by name, it first checks if that
exact name is in the .npz file, and if not, it then tries the name
with ".npy" appended. While I personally dislike the
inconsistency/implicitness of this behavior, ndarray-npy should follow
it for compatibility with NumPy.
@jturner314 jturner314 added the breaking change PRs that break backwards compatibility label Sep 14, 2024
@jturner314 jturner314 force-pushed the names-in-npz branch 3 times, most recently from 8b2513f to 9156a07 Compare September 14, 2024 04:45
@jturner314 jturner314 merged commit 08bef59 into master Sep 14, 2024
9 checks passed
@jturner314 jturner314 deleted the names-in-npz branch September 14, 2024 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change PRs that break backwards compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Match NumPy behavior regarding ".npy" extension for names in .npz files
1 participant