Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions and remove Redis and safetensors #8555

Merged
merged 7 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 18 additions & 20 deletions packages/syft/setup.cfg
Expand Up @@ -26,47 +26,45 @@ package_dir =
# Add here dependencies of your project (semicolon/line-separated), e.g.

syft =
bcrypt==4.0.1
boto3==1.28.65
bcrypt==4.1.2
boto3==1.34.56
forbiddenfruit==0.1.4
gevent==23.9.1
loguru==0.7.2
networkx==3.2.1
packaging>=23.0
pyarrow==14.0.1
pyarrow==15.0.0
# pycapnp is beta version, update to stable version when available
pycapnp==2.0.0b2
pydantic[email]==2.6.0
pydantic-settings==2.2.1
pymongo==4.6.1
pymongo==4.6.2
pynacl==1.5.0
pyzmq>=23.2.1,<=25.1.1
redis==4.6.0
requests==2.31.0
RestrictedPython==7.0
result==0.16.0
tqdm==4.66.1
result==0.16.1
tqdm==4.66.2
typeguard==4.1.5
typing_extensions==4.8.0
sherlock[redis,filelock]==0.4.1
uvicorn[standard]==0.24.0.post1
fastapi==0.103.2
psutil==5.9.6
typing_extensions==4.10.0
sherlock[filelock]==0.4.1
uvicorn[standard]==0.27.1
fastapi==0.110.0
psutil==5.9.8
hagrid>=0.3
itables==1.6.2
safetensors==0.4.1
itables==1.7.1
argon2-cffi==23.1.0
matplotlib==3.8.0
matplotlib==3.8.3
# jaxlib is a DL library but we are needing it for serialization
jaxlib==0.4.20
jax==0.4.20
# numpy and pandas are ML packages but are needed in many places througout the codebase
numpy>=1.23.5,<=1.24.4
pandas==1.5.3
docker==6.1.3
kr8s==0.13.1
kr8s==0.13.5
PyYAML==6.0.1
azure-storage-blob==12.19
azure-storage-blob==12.19.1

install_requires =
%(syft)s
Expand Down Expand Up @@ -94,11 +92,11 @@ dev =
%(test_plugins)s
%(telemetry)s
bandit==1.7.7
ruff==0.1.6
ruff==0.3.0
importlib-metadata==6.8.0
isort==5.12.0
isort==5.13.2
mypy==1.7.1
pre-commit==3.5.0
pre-commit==3.6.2
safety>=2.4.0b2

telemetry =
Expand Down
1 change: 0 additions & 1 deletion packages/syft/src/syft/store/dict_document_store.py
Expand Up @@ -92,7 +92,6 @@ class DictStoreConfig(StoreConfig):
* NoLockingConfig: no locking, ideal for single-thread stores.
* ThreadingLockingConfig: threading-based locking, ideal for same-process in-memory stores.
* FileLockingConfig: file based locking, ideal for same-device different-processes/threads stores.
* RedisLockingConfig: Redis-based locking, ideal for multi-device stores.
Defaults to ThreadingLockingConfig.
"""

Expand Down
1 change: 0 additions & 1 deletion packages/syft/src/syft/store/document_store.py
Expand Up @@ -775,7 +775,6 @@ class StoreConfig(SyftBaseObject):
* NoLockingConfig: no locking, ideal for single-thread stores.
* ThreadingLockingConfig: threading-based locking, ideal for same-process in-memory stores.
* FileLockingConfig: file based locking, ideal for same-device different-processes/threads stores.
* RedisLockingConfig: Redis-based locking, ideal for multi-device stores.
Defaults to NoLockingConfig.
"""

Expand Down
29 changes: 1 addition & 28 deletions packages/syft/src/syft/store/locks.py
Expand Up @@ -9,16 +9,12 @@
from typing import Callable
from typing import Dict
from typing import Optional
from typing import Union
import uuid

# third party
from pydantic import BaseModel
import redis
from redis.client import Redis
from sherlock.lock import BaseLock
from sherlock.lock import FileLock
from sherlock.lock import RedisLock

# relative
from ..serde.serializable import serializable
Expand Down Expand Up @@ -76,22 +72,6 @@ class FileLockingConfig(LockingConfig):
client_path: Optional[Path] = None


@serializable()
class RedisClientConfig(BaseModel):
host: str = "localhost"
port: int = 6379
db: int = 0
username: Optional[str] = None
password: Optional[str] = None


@serializable()
class RedisLockingConfig(LockingConfig):
"""Redis locking policy"""

client: RedisClientConfig = RedisClientConfig()


class ThreadingLock(BaseLock):
"""
Threading-based Lock. Used to provide the same API as the rest of the locks.
Expand Down Expand Up @@ -343,18 +323,11 @@ def __init__(self, config: LockingConfig):
elif isinstance(config, ThreadingLockingConfig):
self._lock = ThreadingLock(**base_params)
elif isinstance(config, FileLockingConfig):
client: Optional[Union[Path, Redis]] = config.client_path
client: Optional[Path] = config.client_path
self._lock = PatchedFileLock(
**base_params,
client=client,
)
elif isinstance(config, RedisLockingConfig):
client = redis.StrictRedis(**config.client.dict())

self._lock = RedisLock(
**base_params,
client=client,
)
else:
raise ValueError("Unsupported config type")

Expand Down
1 change: 0 additions & 1 deletion packages/syft/src/syft/store/mongo_document_store.py
Expand Up @@ -864,7 +864,6 @@ class MongoStoreConfig(StoreConfig):
* NoLockingConfig: no locking, ideal for single-thread stores.
* ThreadingLockingConfig: threading-based locking, ideal for same-process in-memory stores.
* FileLockingConfig: file based locking, ideal for same-device different-processes/threads stores.
* RedisLockingConfig: Redis-based locking, ideal for multi-device stores.
Defaults to NoLockingConfig.
"""

Expand Down
1 change: 0 additions & 1 deletion packages/syft/src/syft/store/sqlite_document_store.py
Expand Up @@ -466,7 +466,6 @@ class SQLiteStoreConfig(StoreConfig):
* NoLockingConfig: no locking, ideal for single-thread stores.
* ThreadingLockingConfig: threading-based locking, ideal for same-process in-memory stores.
* FileLockingConfig: file based locking, ideal for same-device different-processes/threads stores.
* RedisLockingConfig: Redis-based locking, ideal for multi-device stores.
Defaults to FileLockingConfig.
"""

Expand Down
23 changes: 0 additions & 23 deletions packages/syft/tests/syft/locks_test.py
Expand Up @@ -12,18 +12,14 @@
from joblib import Parallel
from joblib import delayed
import pytest
from pytest_mock_resources import create_redis_fixture

# syft absolute
from syft.store.locks import FileLockingConfig
from syft.store.locks import LockingConfig
from syft.store.locks import NoLockingConfig
from syft.store.locks import RedisLockingConfig
from syft.store.locks import SyftLock
from syft.store.locks import ThreadingLockingConfig

redis_server_mock = create_redis_fixture(scope="session")

def_params = {
"lock_name": "testing_lock",
"expire": 5, # seconds,
Expand Down Expand Up @@ -55,20 +51,12 @@ def locks_file_config():
return FileLockingConfig(**def_params)


@pytest.fixture(scope="function")
def locks_redis_config(redis_server_mock):
def_params["lock_name"] = generate_lock_name()
redis_config = redis_server_mock.pmr_credentials.as_redis_kwargs()
return RedisLockingConfig(**def_params, client=redis_config)


@pytest.mark.parametrize(
"config",
[
pytest.lazy_fixture("locks_nop_config"),
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -106,7 +94,6 @@ def test_acquire_nop(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -137,7 +124,6 @@ def test_acquire_release(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand All @@ -158,7 +144,6 @@ def test_acquire_release_with(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -189,7 +174,6 @@ def test_acquire_expire(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand All @@ -216,7 +200,6 @@ def test_acquire_double_aqcuire_timeout_fail(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -245,7 +228,6 @@ def test_acquire_double_aqcuire_timeout_ok(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -274,7 +256,6 @@ def test_acquire_double_aqcuire_nonblocking(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -304,7 +285,6 @@ def test_acquire_double_aqcuire_retry_interval(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand All @@ -325,7 +305,6 @@ def test_acquire_double_release(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand All @@ -351,7 +330,6 @@ def test_acquire_same_name_diff_namespace(config: LockingConfig):
[
pytest.lazy_fixture("locks_threading_config"),
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down Expand Up @@ -414,7 +392,6 @@ def _kv_cbk(tid: int) -> None:
"config",
[
pytest.lazy_fixture("locks_file_config"),
pytest.lazy_fixture("locks_redis_config"),
],
)
@pytest.mark.skipif(
Expand Down