Skip to content

refactor: centralize built-in codec registration - #4515

Open
victorwon2001 wants to merge 1 commit into
zarr-developers:mainfrom
victorwon2001:fix/issue-3339
Open

victorwon2001 wants to merge 1 commit into
zarr-developers:mainfrom
victorwon2001:fix/issue-3339

Conversation

@victorwon2001

Copy link
Copy Markdown

Summary

  • Move the built-in codec registration table out of zarr.codecs.__init__ into an explicit, one-time zarr.registry bootstrap after the package's API modules load.
  • Preserve all existing codec names, the endian alias, numcodecs.* qualified names, public codec exports, configuration-based selection, and lazy third-party entry points.
  • Add separate-process import-order checks and regression coverage for idempotency, custom registrations, and entry-point resolution.

For reviewers

The registration timing remains at normal package import, but the codec implementation package no longer directly registers its own classes. Please check the late bootstrap boundary and existing third-party integration semantics; no public API changes are intended.

Author attestation

  • I am a human, these are my changes, and I have reviewed and understood every change and can explain why each is correct.

TODO

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

Focused registry/config and metadata/codec suites pass, along with Ruff lint and formatting checks. The full repository suite was started but interrupted during resource-intensive execution and has not been verified to completion.

Fixes #3339

@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label Oct 15, 2026
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.71%. Comparing base (bd0dc84) to head (794b5a2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4515   +/-   ##
=======================================
  Coverage   94.71%   94.71%           
=======================================
  Files          94       94           
  Lines       13663    13671    +8     
=======================================
+ Hits        12941    12949    +8     
  Misses        722      722           
Files with missing lines Coverage Δ
src/zarr/__init__.py 97.91% <100.00%> (+0.09%) ⬆️
src/zarr/codecs/__init__.py 100.00% <100.00%> (ø)
src/zarr/registry.py 93.24% <100.00%> (+1.48%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

abstraction leakage in codec registration

1 participant