Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add modules for types#3355

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
d-v-b wants to merge7 commits intozarr-developers:main
base:main
Choose a base branch
Loading
fromd-v-b:feat/types-module

Conversation

@d-v-b
Copy link
Contributor

This does a few things:

  • collects a lot of type definitions and constants inzarr.core.types,
  • exports some of those types fromzarr.types
  • defines complete typeddict models for zarr v2 and zarr v3 metadata documents. These are useful enough on their own that we should add them to the library even if this PR goes nowhere.

@github-actionsgithub-actionsbot added the needs release notesAutomatically applied to PRs which haven't added release notes labelAug 6, 2025
@codecov
Copy link

codecovbot commentedAug 6, 2025
edited
Loading

Codecov Report

❌ Patch coverage is97.19626% with3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.54%. Comparing base (a26926c) to head (3e119a9).

Files with missing linesPatch %Lines
src/zarr/types.py0.00%2 Missing⚠️
src/zarr/core/common.py75.00%1 Missing⚠️
Additional details and impacted files
@@           Coverage Diff           @@##             main    #3355   +/-   ##=======================================  Coverage   94.54%   94.54%           =======================================  Files          78       80    +2       Lines        9423     9467   +44     =======================================+ Hits         8909     8951   +42- Misses        514      516    +2
Files with missing linesCoverage Δ
src/zarr/abc/codec.py94.28% <100.00%> (ø)
src/zarr/abc/metadata.py95.65% <ø> (ø)
src/zarr/abc/store.py95.80% <ø> (ø)
src/zarr/api/asynchronous.py87.62% <ø> (ø)
src/zarr/api/synchronous.py92.95% <ø> (ø)
src/zarr/codecs/blosc.py88.11% <100.00%> (ø)
src/zarr/codecs/bytes.py96.87% <100.00%> (ø)
src/zarr/codecs/crc32c_.py97.05% <100.00%> (ø)
src/zarr/codecs/gzip.py91.42% <100.00%> (ø)
src/zarr/codecs/sharding.py94.49% <100.00%> (+0.01%)⬆️
... and44 more
🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ianhi added a commit to ianhi/zarr-python that referenced this pull requestAug 8, 2025
…ure with comprehensive exportsThis approach builds on PRzarr-developers#3355's zarr.core.types foundation while massivelyexpanding zarr.types public exports to enable comprehensive type documentationlinking. The hybrid strategy provides the best of both worlds:- Maintains clean architectural separation (internal zarr.core.types vs public zarr.types)- Enables comprehensive documentation coverage (~75% vs ~7% with vanilla PRzarr-developers#3355)- Provides excellent developer experience with single import location- Supports all common types used in function signatures for proper Sphinx linkingKey additions to zarr.types public API:- Core classes: Array, AsyncArray, Group, AsyncGroup, ZDType, DefaultFillValue- Store types: Store, StorePath, StoreLike, ByteGetter, ByteSetter- Array types: NDArrayLike, ArrayLike, ZDTypeLike- Metadata types: ArrayV2Metadata, ArrayV3Metadata, GroupMetadata, ConsolidatedMetadata- Codec types: BaseCodec, ArrayArrayCodec, BytesBytesCodec, CompressorLike, etc.- Configuration types: ArrayConfig, ArrayConfigLike, ChunkKeyEncodingLike- Enum types: BloscCname, BloscShuffle, Endian, Order, etc.This enables the core goal: "ideally everything in a type hint will be linkable"while maintaining good software engineering practices.🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>Co-Authored-By: Davis Bennett <davis.v.bennett@gmail.com>
@dstansby
Copy link
Contributor

The trouble with defining objects in two places (here,zarr.types andzarr.core.types) is duplication, and also means we end up importing stuff in the tests from the private place (zarr.core.types here) instead of the public place (zarr.types here), which in the past has prevented us from noticing a change in the public API (zarr.types here) because we're not actually using it in any of our tests.

To prevent this, could we either:

  1. Make all the types public and just put them inzarr.types
  2. Put all types inzarr.types, but make some private with a leading underscore in their name

?

Related, there are types that are inzarr.core.types that are used in the public API (at leastShapeLike, I'm sure many others too). If a type is used in the public API, it should be publicly documented, so there needs to be re-evaluation of what is public/private types here.

@d-v-b
Copy link
ContributorAuthor

d-v-b commentedAug 13, 2025
edited
Loading

Related, there are types that are inzarr.core.types that are used in the public API (at leastShapeLike, I'm sure many others too). If a type is used in the public API, it should be publicly documented, so there needs to be re-evaluation of what is public/private types here.

that might be the first step to refining this PR -- we should figure out exactly which types are public. Definitely anything used as an annotation of a public function signature should be public. In this case, these types should be defined just once inzarr.types. All other private types can be defined wherever is convenient for them, which could bezarr.core.types but we could also have private, dtype-specific types inzarr.core.dtype, for example

@d-v-b
Copy link
ContributorAuthor

oops, I forgot that#3304 also adds atypes module. ignore this PR until#3304 is sorted out

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

Reviewers

No reviews

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@d-v-b@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp