Claude/py312 modernizations#4087
Merged
Merged
Conversation
…#176) Bumps the actions group with 8 updates in the / directory: | Package | From | To | | --- | --- | --- | | [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) | `0.9.5` | `0.9.6` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `6.0.0` | `6.0.1` | | [github/issue-metrics](https://github.com/github/issue-metrics) | `4.2.2` | `4.2.7` | | [j178/prek-action](https://github.com/j178/prek-action) | `2.0.3` | `2.0.4` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.0` | `7.0.1` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `7.0.0` | `8.0.1` | | [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) | `1.13.0` | `1.14.0` | | [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.5.3` | `0.5.6` | Updates `prefix-dev/setup-pixi` from 0.9.5 to 0.9.6 - [Release notes](https://github.com/prefix-dev/setup-pixi/releases) - [Commits](prefix-dev/setup-pixi@1b2de7f...5185adf) Updates `codecov/codecov-action` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@57e3a13...e79a696) Updates `github/issue-metrics` from 4.2.2 to 4.2.7 - [Release notes](https://github.com/github/issue-metrics/releases) - [Commits](github-community-projects/issue-metrics@c9e9838...1e38d5e) Updates `j178/prek-action` from 2.0.3 to 2.0.4 - [Release notes](https://github.com/j178/prek-action/releases) - [Commits](j178/prek-action@6ad8027...bdca6f1) Updates `actions/upload-artifact` from 7.0.0 to 7.0.1 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v7...043fb46) Updates `actions/download-artifact` from 7.0.0 to 8.0.1 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v7...3e5f45b) Updates `pypa/gh-action-pypi-publish` from 1.13.0 to 1.14.0 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](pypa/gh-action-pypi-publish@v1.13.0...cef2210) Updates `zizmorcore/zizmor-action` from 0.5.3 to 0.5.6 - [Release notes](https://github.com/zizmorcore/zizmor-action/releases) - [Commits](zizmorcore/zizmor-action@b1d7e1f...5f14fd0) --- updated-dependencies: - dependency-name: prefix-dev/setup-pixi dependency-version: 0.9.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: codecov/codecov-action dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/issue-metrics dependency-version: 4.2.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: j178/prek-action dependency-version: 2.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: actions/download-artifact dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-version: 1.14.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: zizmorcore/zizmor-action dependency-version: 0.5.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…, math.prod, pathlib - Replace hand-rolled batched() in codec_pipeline.py with itertools.batched (stdlib 3.12+) - Replace typing_extensions.Buffer with collections.abc.Buffer in crc32c_.py - Remove unused ParamSpec / P from core/sync.py - Replace functools.reduce(operator.mul) with math.prod in common.product(), indexing.py CoordinateIndexer.__init__, array.AsyncArray.size, and chunk_grids._guess_num_chunks_per_axis_shard - Replace os.path.exists / os.path.getsize with pathlib equivalents in storage/_local.py Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4087 +/- ##
=======================================
Coverage 93.47% 93.47%
=======================================
Files 90 90
Lines 11967 11958 -9
=======================================
- Hits 11186 11178 -8
+ Misses 781 780 -1
🚀 New features to boost your workflow:
|
Contributor
Author
|
these are minor changes and reverting this PR would be very cheap. I am using an agent to review, and I will self-merge if nothing turns up |
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.
I had claude do a review of our test suite. The tracking issue is on my fork of zarr-python.
Summary
Addresses M1–M5 of #181. Replaces Python <3.12 patterns with stdlib equivalents now that the minimum Python version is 3.12. Behavior is identical; no public API changes.
M1 —
itertools.batched(codec_pipeline.py)batched()generator and theisliceimport it depended on.batchedto the existingfrom itertools importline.batchedfrom this module (verified withgrepacrosssrc/andtests/).M2 —
collections.abc.Buffer(codecs/crc32c_.py)import typing_extensions.from collections.abc import Buffer as ABCBuffer(stdlib since 3.12).cast("typing_extensions.Buffer", ...)calls withcast(ABCBuffer, ...).M3 — Remove unused
ParamSpec/P(core/sync.py)from typing_extensions import ParamSpecand the unusedP = ParamSpec("P")assignment.grepthat nothing importsPfromzarr.core.sync.M4 —
math.prodfor integer productsproduct()body asreturn math.prod(tup); removed the now-unusedimport functoolsandimport operator. The nameproductis preserved because it is imported insrc/zarr/codecs/numcodecs/_codecs.py,src/zarr/core/indexing.py, andtests/test_codecs/test_codecs.py.reduce(operator.mul, cdata_shape, 1)withmath.prod(cdata_shape); removed unusedimport operatorandreducefrom thefunctoolsimport.np.prod(self.metadata.shape).item()withmath.prod(self.metadata.shape).self.metadata.shapeistuple[int, ...]. Addedimport math._guess_num_chunks_per_axis_shard): Replacednp.prod(chunk_shape)withmath.prod(chunk_shape).chunk_shapeis typedtuple[int, ...].mathalready imported.chunks = np.maximum(np.array(shape, dtype="=f8"), 1)— a numpy float64 array. Converting tomath.prodwould be incorrect (it expects an iterable of numbers and the semantics differ for floating-point arrays). Left unchanged.np.arange(np.prod(array.shape),...)), not executable source. The actual production usage in that file already callsproduct()fromzarr.core.common(line 264) and is unchanged.M5 — pathlib in _local.py (~lines 366, 372)
os.path.exists(dest_root)→dest_root.exists()(dest_rootis aPath).os.path.getsize(self.root / key)→(self.root / key).stat().st_size.import osretained — still used foros.makedirs,os.rename,os.link,os.unlink.Test results
Notes
🤖 Generated with Claude Code