Repository: zarr-developers/zarr-python

Issue:
zarr.group(meta_array=...) argument?
If `zarr.group` is able to create a group from a store, I think it would make sense for it to accept `meta_array` as an argument.

Though I'm a little unclear on what the intended difference in usage is between `zarr.group` and `zarr.Group` other than being able to pass `zarr.group` a string for `store`. But most other arguments are shared.

Discussion:

Patch:
diff --git a/.pyup.yml b/.pyup.yml
index 04937ed0..a70df4e3 100644
--- a/.pyup.yml
+++ b/.pyup.yml
@@ -13,6 +13,3 @@ requirements:
   - requirements_dev_optional.txt:
       pin: True
       update: all
-  - requirements_rtfd.txt:
-      pin: False
-      update: False
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 42fc08bc..2124f772 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -10,6 +10,7 @@ sphinx:
 
 python:
   install:
-    - requirements: requirements_rtfd.txt
     - method: pip
       path: .
+      extra_requirements:
+        - docs
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 46fc39d9..04205350 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -92,8 +92,8 @@ the repository, you can do something like the following::
     $ mkdir -p ~/pyenv/zarr-dev
     $ python -m venv ~/pyenv/zarr-dev
     $ source ~/pyenv/zarr-dev/bin/activate
-    $ pip install -r requirements_dev_minimal.txt -r requirements_dev_numpy.txt -r requirements_rtfd.txt
-    $ pip install -e .
+    $ pip install -r requirements_dev_minimal.txt -r requirements_dev_numpy.txt
+    $ pip install -e .[docs]
 
 To verify that your development environment is working, you can run the unit tests::
 
diff --git a/docs/release.rst b/docs/release.rst
index aa622723..cf1400d3 100644
--- a/docs/release.rst
+++ b/docs/release.rst
@@ -24,6 +24,9 @@ Maintenance
 * Require ``setuptools_scm`` version ``1.5.4``\+
   By :user:`John A. Kirkham <jakirkham>` :issue:`1477`.
 
+* Add ``docs`` requirements to ``pyproject.toml``
+  By :user:`John A. Kirkham <jakirkham>` :issue:`1494`.
+
 .. _release_2.16.0:
 
 2.16.0
diff --git a/pyproject.toml b/pyproject.toml
index 7d8d275c..292bfddd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -13,7 +13,7 @@ maintainers = [
 requires-python = ">=3.8"
 dependencies = [
     'asciitree',
-    'numpy>=1.20',
+    'numpy>=1.20,!=1.21.0',
     'fasteners',
     'numcodecs>=0.10.0',
 ]
@@ -43,6 +43,16 @@ jupyter = [
     'ipytree>=0.2.2',
     'ipywidgets>=8.0.0',
 ]
+docs = [
+    'sphinx',
+    'sphinx_design',
+    'sphinx-issues',
+    'sphinx-copybutton',
+    'sphinx-rtd-theme',
+    'pydata-sphinx-theme',
+    'numpydoc',
+    'numcodecs[msgpack]',
+]
 
 [project.urls]
 "Bug Tracker" = "https://github.com/zarr-developers/zarr-python/issues"
diff --git a/requirements_rtfd.txt b/requirements_rtfd.txt
deleted file mode 100644
index 5d7fec36..00000000
--- a/requirements_rtfd.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-asciitree
-setuptools
-setuptools_scm
-sphinx
-sphinx_design
-sphinx-issues
-sphinx-copybutton
-sphinx-rtd-theme
-pydata-sphinx-theme
-numpydoc
-numpy!=1.21.0
-msgpack-python==0.5.6
diff --git a/zarr/hierarchy.py b/zarr/hierarchy.py
index c7cc5c6f..3361969f 100644
--- a/zarr/hierarchy.py
+++ b/zarr/hierarchy.py
@@ -1360,7 +1360,8 @@ def group(
     synchronizer=None,
     path=None,
     *,
-    zarr_version=None
+    zarr_version=None,
+    meta_array=None
 ):
     """Create a group.
 
@@ -1382,6 +1383,11 @@ def group(
         Array synchronizer.
     path : string, optional
         Group path within store.
+    meta_array : array-like, optional
+        An array instance to use for determining arrays to create and return
+        to users. Use `numpy.empty(())` by default.
+
+        .. versionadded:: 2.16.1
 
     Returns
     -------
@@ -1432,6 +1438,7 @@ def group(
         synchronizer=synchronizer,
         path=path,
         zarr_version=zarr_version,
+        meta_array=meta_array,
     )
 
 


Test patch:
diff --git a/zarr/tests/test_meta_array.py b/zarr/tests/test_meta_array.py
index 39394bd6..2545c6d6 100644
--- a/zarr/tests/test_meta_array.py
+++ b/zarr/tests/test_meta_array.py
@@ -9,7 +9,7 @@ from numcodecs.registry import get_codec, register_codec
 import zarr.codecs
 from zarr.core import Array
 from zarr.creation import array, empty, full, ones, open_array, zeros
-from zarr.hierarchy import open_group
+from zarr.hierarchy import open_group, group
 from zarr.storage import DirectoryStore, MemoryStore, Store, ZipStore
 
 
@@ -234,12 +234,13 @@ def test_full(module, compressor):
     assert np.all(np.isnan(z[:]))
 
 
+@pytest.mark.parametrize("group_create_function", [group, open_group])
 @pytest.mark.parametrize("module, compressor", param_module_and_compressor)
 @pytest.mark.parametrize("store_type", [None, DirectoryStore, MemoryStore, ZipStore])
-def test_group(tmp_path, module, compressor, store_type):
+def test_group(tmp_path, group_create_function, module, compressor, store_type):
     xp = ensure_module(module)
     store = init_store(tmp_path, store_type)
-    g = open_group(store, meta_array=xp.empty(()))
+    g = group_create_function(store, meta_array=xp.empty(()))
     g.ones("data", shape=(10, 11), dtype=int, compressor=compressor)
     a = g["data"]
     assert a.shape == (10, 11)