Skip to content

Commit 24a4582

Browse files
TomNicholaspre-commit-ci[bot]maxrjones
authored
Split optional dependencies in pyproject.toml (#309)
* split optional deps * comment out un-implemented readers * remove _reader suffix * add kerchunk as writer to cover fastparquet dependency * embed the pyproject.toml in the installation docs * notes on test and docs deps * wording * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * release note * update kerchunk version * separate remote options * remove sneaky git thing * Update pyproject.toml Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com> * update kerchunk verion * remove commented-out readers --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com>
1 parent 14f58ba commit 24a4582

File tree

3 files changed

+69
-12
lines changed

3 files changed

+69
-12
lines changed

docs/installation.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,43 @@ and on conda-forge:
1212
conda install -c conda-forge virtualizarr
1313
```
1414

15+
## Optional dependencies
16+
17+
VirtualiZarr has many optional dependencies, split into those for reading various file formats, and those for writing virtual references out to different formats.
18+
19+
Optional dependencies can be installed in groups via pip. For example to read HDF files and write virtual references to icechunk you could install all necessary dependencies via:
20+
21+
```shell
22+
pip install "virtualizarr[hdf, icechunk]"
23+
```
24+
25+
The full list of optional dependencies can be seen in the `pyproject.toml` file:
26+
27+
```{literalinclude} ../pyproject.toml
28+
:start-at: "[project.optional-dependencies]"
29+
:end-before: "test ="
30+
```
31+
32+
The compound groups allow you to install multiple sets of dependencies at once, e.g. install every file reader via
33+
34+
```shell
35+
pip install "virtualizarr[all_readers]"
36+
```
37+
38+
The basic `pip install virtualizarr` will only install the minimal required dependencies, and so may not be particularly useful on its own.
1539

1640
## Install Test Dependencies
1741

42+
For local development you will want to install the test dependencies so that you can run all the tests in the test suite:
43+
1844
```shell
1945
pip install '-e .[test]'
2046
```
2147

22-
2348
## Install Docs Dependencies
2449

50+
To build the documentation locally you will need further dependencies:
51+
2552
```shell
2653
pip install '-e .[docs]'
2754
```

docs/releases.rst

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ v1.2.1 (unreleased)
99
New Features
1010
~~~~~~~~~~~~
1111

12+
- Optional dependencies can now be installed in groups via pip. See the installation docs.
13+
(:pull:`309`) By `Tom Nicholas <https://github.com/TomNicholas>`_.
1214
- Added a ``.nbytes`` accessor method which displays the bytes needed to hold the virtual references in memory.
1315
(:issue:`167`, :pull:`227`) By `Tom Nicholas <https://github.com/TomNicholas>`_.
1416
- Sync with Icechunk v0.1.0a8 (:pull:`368`) By `Matthew Iannucci <https://github.com/mpiannucci>`. This also adds support

pyproject.toml

+39-11
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,70 @@ dynamic = ["version"]
2222
dependencies = [
2323
"xarray>=2025.1.1",
2424
"numpy>=2.0.0",
25-
"packaging",
2625
"universal-pathlib",
2726
"numcodecs",
2827
"ujson",
28+
"packaging",
2929
]
3030

3131
[project.optional-dependencies]
32-
hdf_reader = [
32+
# for creating virtual datasets from objects on remote storage
33+
remote = [
3334
"fsspec",
35+
"requests",
36+
"aiohttp",
37+
"s3fs",
38+
]
39+
40+
# non-kerchunk-based readers
41+
hdf = [
42+
"virtualizarr[remote]",
3443
"h5py",
3544
"hdf5plugin",
3645
"imagecodecs",
3746
"imagecodecs-numcodecs==2024.6.1",
38-
"numcodecs"
47+
]
48+
49+
# kerchunk-based readers
50+
hdf5 = [
51+
"virtualizarr[remote]",
52+
"kerchunk>=0.2.8",
53+
"h5py",
3954
]
4055
netcdf3 = [
56+
"virtualizarr[remote]",
4157
"kerchunk>=0.2.8",
4258
"scipy",
4359
]
4460
fits = [
61+
"virtualizarr[remote]",
4562
"kerchunk>=0.2.8",
4663
"astropy",
4764
]
65+
all_readers = [
66+
"virtualizarr[hdf]",
67+
"virtualizarr[hdf5]",
68+
"virtualizarr[netcdf3]",
69+
"virtualizarr[fits]",
70+
]
71+
72+
# writers
4873
icechunk = [
4974
"icechunk>=0.1.0a12",
5075
]
76+
kerchunk = ["fastparquet"]
77+
all_writers = [
78+
"virtualizarr[icechunk]",
79+
"virtualizarr[kerchunk]",
80+
]
81+
all = [
82+
"virtualizarr[all_readers]",
83+
"virtualizarr[all_writers]",
84+
]
85+
5186
test = [
5287
"codecov",
53-
"fastparquet",
54-
"fsspec",
55-
"h5py",
56-
"kerchunk>=0.2.8",
5788
"mypy",
58-
"netcdf4",
59-
"numcodecs",
6089
"pandas-stubs",
6190
"pooch",
6291
"pre-commit",
@@ -65,8 +94,7 @@ test = [
6594
"pytest",
6695
"ruff",
6796
"s3fs",
68-
"scipy",
69-
"virtualizarr[hdf_reader]"
97+
"virtualizarr[all]"
7098
]
7199

72100
[project.urls]

0 commit comments

Comments
 (0)