Skip to content

Commit

Permalink
Remove old v3 (#1742)
Browse files Browse the repository at this point in the history
* chore: add deprecation warnings to v3 classes / functions

* Resolve Mypy erorrs in `v3` branch (#1692)

* refactor(v3): Using appropriate types

* fix(v3): Typing fixes + minor code fixes

* fix(v3): _sync_iter works with coroutines

* docs(v3/store/core.py): clearer comment

* fix(metadata.py): Use Any outside TYPE_CHECKING for Pydantic

* fix(zarr/v3): correct zarr format + remove unused method

* fix(v3/store/core.py): Potential suggestion on handling str store_like

* refactor(zarr/v3): Add more typing

* ci(.pre-commit-config.yaml): zarr v3 mypy checks turned on in pre-commit

* Specify hatch envs using GitHub actions matrix for v3 tests (#1728)

* Specify v3 hatch envs using GitHub actions matrix

* Update .github/workflows/test-v3.yml

Co-authored-by: Joe Hamman <jhamman1@gmail.com>

* Update .github/workflows/test-v3.yml

Co-authored-by: Joe Hamman <jhamman1@gmail.com>

* test on 3.12 too

* no 3.12

---------

Co-authored-by: Joe Hamman <jhamman1@gmail.com>
Co-authored-by: Joe Hamman <joe@earthmover.io>

* black -> ruff format + cleanup (#1639)

* black -> ruff + cleanup

* format

* Preserve git blame

* pre-commit fix

* Remove outdated dev install docs from installation.rst and link to contributing.rst (#1643)

Co-authored-by: Joe Hamman <joe@earthmover.io>

* chore: remove old v3 implementation

* chore: remove more version-conditional logic

* chore: remove v3_storage_transformers.py again

---------

Co-authored-by: Daniel Jahn (dahn) <dahnjahn@gmail.com>
Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com>
Co-authored-by: Joe Hamman <jhamman1@gmail.com>
Co-authored-by: Joe Hamman <joe@earthmover.io>
Co-authored-by: Saransh Chopra <saransh0701@gmail.com>
Co-authored-by: Alden Keefe Sampson <aldenkeefesampson@gmail.com>
  • Loading branch information
7 people committed Apr 22, 2024
1 parent 472ab13 commit 368b170
Show file tree
Hide file tree
Showing 20 changed files with 424 additions and 4,413 deletions.
16 changes: 0 additions & 16 deletions src/zarr/__init__.py
Expand Up @@ -31,7 +31,6 @@
from zarr.errors import CopyError, MetadataError
from zarr.hierarchy import Group, group, open_group
from zarr.n5 import N5Store, N5FSStore
from zarr._storage.store import v3_api_available
from zarr.storage import (
ABSStore,
DBMStore,
Expand All @@ -53,18 +52,3 @@

# in case setuptools scm screw up and find version to be 0.0.0
assert not __version__.startswith("0.0.0")

if v3_api_available:
from zarr._storage.v3 import (
ABSStoreV3,
DBMStoreV3,
KVStoreV3,
DirectoryStoreV3,
LMDBStoreV3,
LRUStoreCacheV3,
MemoryStoreV3,
MongoDBStoreV3,
RedisStoreV3,
SQLiteStoreV3,
ZipStoreV3,
)
55 changes: 1 addition & 54 deletions src/zarr/_storage/absstore.py
Expand Up @@ -3,7 +3,7 @@
import warnings
from numcodecs.compat import ensure_bytes
from zarr.util import normalize_storage_path
from zarr._storage.store import _get_metadata_suffix, data_root, meta_root, Store, StoreV3
from zarr._storage.store import Store

__doctest_requires__ = {
("ABSStore", "ABSStore.*"): ["azure.storage.blob"],
Expand Down Expand Up @@ -222,56 +222,3 @@ def getsize(self, path=None):

def clear(self):
self.rmdir()


class ABSStoreV3(ABSStore, StoreV3):
def list(self):
return list(self.keys())

def __eq__(self, other):
return (
isinstance(other, ABSStoreV3)
and self.client == other.client
and self.prefix == other.prefix
)

def __setitem__(self, key, value):
self._validate_key(key)
super().__setitem__(key, value)

def rmdir(self, path=None):
if not path:
# Currently allowing clear to delete everything as in v2

# If we disallow an empty path then we will need to modify
# TestABSStoreV3 to have the create_store method use a prefix.
ABSStore.rmdir(self, "")
return

meta_dir = meta_root + path
meta_dir = meta_dir.rstrip("/")
ABSStore.rmdir(self, meta_dir)

# remove data folder
data_dir = data_root + path
data_dir = data_dir.rstrip("/")
ABSStore.rmdir(self, data_dir)

# remove metadata files
sfx = _get_metadata_suffix(self)
array_meta_file = meta_dir + ".array" + sfx
if array_meta_file in self:
del self[array_meta_file]
group_meta_file = meta_dir + ".group" + sfx
if group_meta_file in self:
del self[group_meta_file]

# TODO: adapt the v2 getsize method to work for v3
# For now, calling the generic keys-based _getsize
def getsize(self, path=None):
from zarr.storage import _getsize # avoid circular import

return _getsize(self, path)


ABSStoreV3.__doc__ = ABSStore.__doc__

0 comments on commit 368b170

Please sign in to comment.