Skip to content

Conversation

@dstansby
Copy link
Contributor

Replaces #3109.

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 13, 2025
@dstansby dstansby removed the needs release notes Automatically applied to PRs which haven't added release notes label Jun 13, 2025
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 17, 2025
@dstansby
Copy link
Contributor Author

@d-v-b any ideas what's going on with the typing error here? I can't wrap my head around why it's erroring. Perhaps we should just stick an # type: ignore comment on the failing line?

@dstansby dstansby removed the needs release notes Automatically applied to PRs which haven't added release notes label Jun 20, 2025
@dstansby dstansby mentioned this pull request Jun 20, 2025
6 tasks
@DimitriPapadopoulos
Copy link
Contributor

DimitriPapadopoulos commented Jun 20, 2025

I wonder whether this would fix the mypy error:

-    if dtype_category == "variable-length-string":
-        zdtype = VariableLengthUTF8()
-    else:
-        zdtype = Int8()
+    if dtype_category == "variable-length-string":
+        zdtype = VariableLengthUTF8
+    else:
+        zdtype = Int8

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 20, 2025
@dstansby
Copy link
Contributor Author

The issue with the dtype mypy error was the variable length string type is not actually a valid ZarrDtype. Since there are existing #type: ignore comments to acocunt for this, I added another one here.

@d-v-b
Copy link
Contributor

d-v-b commented Jun 20, 2025

@d-v-b any ideas what's going on with the typing error here? I can't wrap my head around why it's erroring. Perhaps we should just stick an # type: ignore comment on the failing line?

which specific typing error? a basic challenge with VariableLengthUTF8 is that it's conditionally defined: if numpy < 2 is installed, we define 1 version of the class (using the numpy object dtype) and if numpy > 2 is installed, we define a different version of the class (using np.dtypes.StringDType). That can be why mypy singles this type out as unknown

@dstansby
Copy link
Contributor Author

@d-v-b
Copy link
Contributor

d-v-b commented Jun 20, 2025

This line here: https://github.com/zarr-developers/zarr-python/pull/3133/files#diff-da24b355349b53e4c8047034767d008e4c2ce9ea6c8933a3acd50d0828f00528R334 - if you remove the typing ignores, it gives an error.

yeah, mypy is confused there, so the type ignore is correct. This will get simpler in a few months when we drop numpy < 2.

Copy link
Contributor

@d-v-b d-v-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@d-v-b d-v-b enabled auto-merge (squash) June 24, 2025 19:50
@d-v-b d-v-b merged commit 1d0ea2b into zarr-developers:main Jun 24, 2025
30 checks passed
@codecov
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.47%. Comparing base (2836883) to head (9cc7740).
⚠️ Report is 128 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3133   +/-   ##
=======================================
  Coverage   94.47%   94.47%           
=======================================
  Files          78       78           
  Lines        8578     8578           
=======================================
  Hits         8104     8104           
  Misses        474      474           
Files with missing lines Coverage Δ
src/zarr/core/buffer/core.py 82.17% <100.00%> (ø)
src/zarr/core/dtype/npy/bytes.py 96.77% <100.00%> (ø)
src/zarr/core/dtype/npy/structured.py 96.47% <100.00%> (ø)
src/zarr/core/dtype/npy/time.py 95.20% <ø> (ø)
src/zarr/storage/_memory.py 93.06% <100.00%> (ø)
src/zarr/storage/_zip.py 97.05% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dstansby dstansby deleted the mypy-116 branch September 22, 2025 21:55
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.

3 participants