-
-
Notifications
You must be signed in to change notification settings - Fork 350
Description
The Zarr subpackages (like storage
) are not referenced directly in the top-level package's __init__.py
.
This leads to warnings in static code analyzers when using snippets of the form:
import zarr
store = zarr.storage.LocalStore('...')
For example, here is a warning from IntelliJ:

It is of course possible to use different imports; however, this kind of import is quite beneficial in situations where different storage providers are used side by side (e.g. Xarray) so that having an explicit reference makes it unambiguous which provider is used.
PEP 562 proposes a solution to support these kinds of imports natively, using the __getattr__
function in modules. NumPy and SciPy both use this pattern.
If you agree that this is a good idea, I can happily contribute a pull request (probably quite similar to SciPy's solution).