zarr-developers / zarr-python

An implementation of chunked, compressed, N-dimensional arrays for Python.
https://zarr.readthedocs.io
MIT License
1.45k stars 273 forks source link

Group.create_array signature doesn't match between sync and async #2112

Closed TomAugspurger closed 1 week ago

TomAugspurger commented 2 weeks ago

Zarr version

v3

Numcodecs version

na

Python Version

na

Operating System

na

Installation

na

Description

The signature for AsyncGroup.create_array differs from Group.create_array.

Async:

    async def create_array(
        self,
        path: str,
        shape: ChunkCoords,

and sync

    def create_array(
        self,
        name: str,
        *,
        shape: ChunkCoords,

Steps to reproduce

n/a

Additional output

Do we want these to match in general? If so, it might be worth writing a simple pre-commit hook to check that the signatures match between the two objects.

And in this specific case, is path or name correct?

jhamman commented 2 weeks ago

Yes, we want these to match and it looks like the sync version is the one we want in this case (that is name is the arg we want).

In general, our sync wrappers would really benefit from some automation (ala [sychronicity](https://github.com/modal-labs/synchronicity or asyncer.runnify). In 95% of cases, the args/docstring are going to be identical so we can probably auto create the sync versions.

jhamman commented 2 weeks ago

PR up addressing this here: https://github.com/zarr-developers/zarr-python/pull/2132