diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8943a32efc2..0e055b9ff13 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-ast always_run: true @@ -80,7 +80,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: "v0.4.7" + rev: "v0.8.3" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] diff --git a/packages/grid/enclave/attestation/requirements.txt b/packages/grid/enclave/attestation/requirements.txt index bd5059ad68d..032dcf3cae2 100644 --- a/packages/grid/enclave/attestation/requirements.txt +++ b/packages/grid/enclave/attestation/requirements.txt @@ -1,3 +1,3 @@ -fastapi==0.110.0 +fastapi==0.115.6 loguru==0.7.2 -uvicorn[standard]==0.27.1 +uvicorn[standard]==0.32.1 diff --git a/packages/grid/seaweedfs/requirements.txt b/packages/grid/seaweedfs/requirements.txt index c4ecc044267..5c973cd366a 100644 --- a/packages/grid/seaweedfs/requirements.txt +++ b/packages/grid/seaweedfs/requirements.txt @@ -1,4 +1,4 @@ -fastapi==0.110.0 +fastapi==0.115.6 pyyaml==6.0.1 supervisor==4.2.5 -uvicorn==0.27.1 +uvicorn==0.32.1 diff --git a/packages/syft/setup.cfg b/packages/syft/setup.cfg index 89a67e4032c..7effd71d874 100644 --- a/packages/syft/setup.cfg +++ b/packages/syft/setup.cfg @@ -27,7 +27,7 @@ package_dir = syft = setuptools - bcrypt==4.1.2 + bcrypt==4.2.1 boto3==1.34.56 forbiddenfruit==0.1.4 packaging>=23.0 @@ -39,13 +39,13 @@ syft = pyzmq>=23.2.1,<=25.1.1 requests==2.32.3 RestrictedPython==7.0 - tqdm==4.66.4 + tqdm==4.67.1 typeguard==4.1.5 - typing_extensions==4.12.0 + typing_extensions==4.12.2 sherlock[filelock]==0.4.1 - uvicorn[standard]==0.30.0 + uvicorn[standard]==0.32.1 markdown==3.5.2 - fastapi==0.111.0 + fastapi==0.115.6 psutil==6.0.0 itables==1.7.1 argon2-cffi==23.1.0 @@ -69,8 +69,8 @@ syft = psycopg[pool]==3.1.19 ipython<8.27.0 dynaconf==3.2.6 - sqlalchemy==2.0.32 - psycopg2-binary==2.9.9 + sqlalchemy==2.0.36 + psycopg2-binary==2.9.10 install_requires = %(syft)s @@ -87,9 +87,9 @@ exclude = [options.extras_require] data_science = - transformers==4.41.2 - opendp==0.9.2 - evaluate==0.4.2 + transformers==4.47.0 + opendp==0.11.1 + evaluate==0.4.3 recordlinkage==0.16 # backend.dockerfile installs torch separately, so update the version over there as well! torch==2.2.2 @@ -97,13 +97,13 @@ data_science = dev = %(test_plugins)s %(telemetry)s - bandit==1.7.8 - debugpy==1.8.2 - importlib-metadata==7.1.0 + bandit==1.8.0 + debugpy==1.8.9 + importlib-metadata==8.4.0 isort==5.13.2 mypy==1.10.0 - pre-commit==3.7.1 - ruff==0.4.7 + pre-commit==4.0.1 + ruff==0.8.3 safety>=2.4.0b2 aiosmtpd==1.4.6 diff --git a/packages/syft/src/syft/client/api.py b/packages/syft/src/syft/client/api.py index 85fe33545fa..29ff15e4246 100644 --- a/packages/syft/src/syft/client/api.py +++ b/packages/syft/src/syft/client/api.py @@ -1364,7 +1364,7 @@ def validate_callable_args_and_kwargs( _check_type(value, t) except ValueError: # TODO: fix this properly - if not (t == type(Any)): + if t is not type(Any): _type_str = getattr(t, "__name__", str(t)) raise SyftException( public_message=f"`{key}` must be of type `{_type_str}` not `{type(value).__name__}`" diff --git a/packages/syft/src/syft/serde/json_serde.py b/packages/syft/src/syft/serde/json_serde.py index ee86241716c..70b86f8b622 100644 --- a/packages/syft/src/syft/serde/json_serde.py +++ b/packages/syft/src/syft/serde/json_serde.py @@ -298,7 +298,7 @@ def _is_serializable_mapping(annotation: Any) -> bool: - the key type is str - the value type is serializable and not a Union """ - if get_origin(annotation) != dict: + if get_origin(annotation) is not dict: return False args = get_args(annotation) diff --git a/packages/syft/src/syft/serde/lib_service_registry.py b/packages/syft/src/syft/serde/lib_service_registry.py index 517df6c643c..c50fb193b0d 100644 --- a/packages/syft/src/syft/serde/lib_service_registry.py +++ b/packages/syft/src/syft/serde/lib_service_registry.py @@ -199,7 +199,7 @@ def flatten(self) -> list[Self]: def isfunction(obj: Callable) -> bool: return ( inspect.isfunction(obj) - or type(obj) == numpy.ufunc + or type(obj) is numpy.ufunc or isinstance(obj, BuiltinFunctionType) ) diff --git a/packages/syft/src/syft/service/action/action_types.py b/packages/syft/src/syft/service/action/action_types.py index c7bd730d557..c79c35a6811 100644 --- a/packages/syft/src/syft/service/action/action_types.py +++ b/packages/syft/src/syft/service/action/action_types.py @@ -19,7 +19,7 @@ def action_type_for_type(obj_or_type: Any) -> type: """ if isinstance(obj_or_type, ActionDataEmpty): obj_or_type = obj_or_type.syft_internal_type - if type(obj_or_type) != type: + if type(obj_or_type) is not type: obj_or_type = type(obj_or_type) if obj_or_type not in action_types: diff --git a/packages/syft/src/syft/service/dataset/dataset.py b/packages/syft/src/syft/service/dataset/dataset.py index 185774fa86c..c9b8137aadf 100644 --- a/packages/syft/src/syft/service/dataset/dataset.py +++ b/packages/syft/src/syft/service/dataset/dataset.py @@ -306,7 +306,7 @@ def _is_action_data_empty(obj: Any) -> bool: def check_mock(data: Any, mock: Any) -> bool: - if type(data) == type(mock): + if type(data) is type(mock): return True return _is_action_data_empty(mock) or _is_action_data_empty(data) diff --git a/packages/syft/src/syft/service/policy/policy.py b/packages/syft/src/syft/service/policy/policy.py index f89493c4c0b..62554639067 100644 --- a/packages/syft/src/syft/service/policy/policy.py +++ b/packages/syft/src/syft/service/policy/policy.py @@ -342,7 +342,7 @@ def is_owned( def is_met( self, context: AuthedServiceContext, action_object: ActionObject ) -> bool: - return type(action_object.syft_action_data) == self.type and self.is_owned( + return type(action_object.syft_action_data) is self.type and self.is_owned( context, action_object ) diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py index ab07c7380f1..6ca660affe2 100644 --- a/packages/syft/src/syft/service/request/request.py +++ b/packages/syft/src/syft/service/request/request.py @@ -974,7 +974,7 @@ def _deposit_result_l2( f"accept_by_depositing_result can only be run on {UserCodeStatusCollection} not " f"{user_code_status_change.linked_obj.object_type}" ) - if not type(user_code_status_change) == UserCodeStatusChange: + if type(user_code_status_change) is not UserCodeStatusChange: raise TypeError( f"accept_by_depositing_result can only be run on {UserCodeStatusChange} not " f"{type(user_code_status_change)}" diff --git a/packages/syft/src/syft/types/syft_object.py b/packages/syft/src/syft/types/syft_object.py index 7b30ffaa562..19862279c07 100644 --- a/packages/syft/src/syft/types/syft_object.py +++ b/packages/syft/src/syft/types/syft_object.py @@ -435,7 +435,7 @@ def refresh(self) -> None: new_object = api.services.migration._get_object( uid=self.id, object_type=type(self) ) - if type(new_object) == type(self): + if type(new_object) is type(self): self.__dict__.update(new_object.__dict__) except Exception as _: return diff --git a/packages/syft/src/syft/util/table.py b/packages/syft/src/syft/util/table.py index 25db3fb4552..06c0264cf77 100644 --- a/packages/syft/src/syft/util/table.py +++ b/packages/syft/src/syft/util/table.py @@ -22,14 +22,14 @@ def _syft_in_mro(self: Any, item: Any) -> bool: - if hasattr(type(item), "mro") and type(item) != type: + if hasattr(type(item), "mro") and type(item) is not type: # if unbound method, supply self if hasattr(type(item).mro, "__self__"): mro = type(item).mro() else: mro = type(item).mro(type(item)) # type: ignore - elif hasattr(item, "mro") and type(item) != type: + elif hasattr(item, "mro") and type(item) is not type: mro = item.mro() else: mro = str(self) # type: ignore @@ -98,7 +98,7 @@ def _create_table_rows( if id_ is not None and include_id: cols["id"].append({"value": str(id_), "type": "clipboard"}) - if type(item) == type: + if type(item) is type: t = full_name_with_qualname(item) else: try: diff --git a/packages/syft/tests/syft/policy/mixed_policy_test.py b/packages/syft/tests/syft/policy/mixed_policy_test.py index fedb6bed14a..c60b2fedb95 100644 --- a/packages/syft/tests/syft/policy/mixed_policy_test.py +++ b/packages/syft/tests/syft/policy/mixed_policy_test.py @@ -37,7 +37,7 @@ def test_constant(worker) -> None: constant = create_constant.to_policy_rule("test") assert constant.val == 2 - assert constant.klass == int + assert constant.klass is int create_constant = CreatePolicyRuleConstant( val=root_client.api.services.test.test_query diff --git a/packages/syft/tests/syft/serde/numpy_functions_test.py b/packages/syft/tests/syft/serde/numpy_functions_test.py index 14a858f101e..75b5ec0d631 100644 --- a/packages/syft/tests/syft/serde/numpy_functions_test.py +++ b/packages/syft/tests/syft/serde/numpy_functions_test.py @@ -91,7 +91,7 @@ def test_numpy_functions(func, func_arguments, request): except Exception as e: assert ( - e == AttributeError + e is AttributeError ), f"Can not evaluate {func}({func_arguments}) with {e}" print(e) else: diff --git a/packages/syft/tests/syft/service/dataset/dataset_service_test.py b/packages/syft/tests/syft/service/dataset/dataset_service_test.py index 4d73e35fa6f..680d72e3499 100644 --- a/packages/syft/tests/syft/service/dataset/dataset_service_test.py +++ b/packages/syft/tests/syft/service/dataset/dataset_service_test.py @@ -302,10 +302,10 @@ def test_upload_dataset_with_assets_of_different_data_types( res = root_datasite_client.upload_dataset(dataset) assert isinstance(res, SyftSuccess) assert len(root_datasite_client.api.services.dataset.get_all()) == 1 - assert type(root_datasite_client.datasets[0].assets[0].data) == type( + assert type(root_datasite_client.datasets[0].assets[0].data) is type( different_data_types ) - assert type(root_datasite_client.datasets[0].assets[0].mock) == type( + assert type(root_datasite_client.datasets[0].assets[0].mock) is type( different_data_types ) diff --git a/packages/syft/tests/syft/settings/settings_service_test.py b/packages/syft/tests/syft/settings/settings_service_test.py index 7555aadd91e..3f6dd245065 100644 --- a/packages/syft/tests/syft/settings/settings_service_test.py +++ b/packages/syft/tests/syft/settings/settings_service_test.py @@ -322,7 +322,7 @@ def get_mock_client(faker, root_client, role): password=password, password_verify=password, ) - assert type(result) == UserView + assert type(result) is UserView guest_client = root_client.guest() return guest_client.login(email=email, password=password) diff --git a/packages/syft/tests/syft/users/user_stash_test.py b/packages/syft/tests/syft/users/user_stash_test.py index 584e616d093..53f79a3dda4 100644 --- a/packages/syft/tests/syft/users/user_stash_test.py +++ b/packages/syft/tests/syft/users/user_stash_test.py @@ -74,7 +74,7 @@ def test_userstash_get_by_uid( assert result.is_err() exc = result.err() - assert type(exc) == NotFoundException + assert type(exc) is NotFoundException assert exc.public_message @@ -98,7 +98,7 @@ def test_userstash_get_by_email( exc = result.err() assert result.is_err() - assert type(exc) == NotFoundException + assert type(exc) is NotFoundException assert "not found" in exc.public_message @@ -130,7 +130,7 @@ def test_userstash_get_by_signing_key( exc = result.err() assert result.is_err() - assert type(exc) == NotFoundException + assert type(exc) is NotFoundException assert exc.public_message @@ -161,7 +161,7 @@ def test_userstash_get_by_verify_key( ) searched_user = result.err() assert result.is_err() - assert type(searched_user) == NotFoundException + assert type(searched_user) is NotFoundException assert searched_user.public_message diff --git a/packages/syft/tests/syft/users/user_test.py b/packages/syft/tests/syft/users/user_test.py index 4c727b4f1fe..a2f88d38a36 100644 --- a/packages/syft/tests/syft/users/user_test.py +++ b/packages/syft/tests/syft/users/user_test.py @@ -273,7 +273,7 @@ def test_guest_user_update_to_root_email_failed( def test_user_view_set_password(worker: Worker, root_client: DatasiteClient) -> None: change_ok = root_client.account.set_password("123", confirm=False) - assert type(change_ok) == SyftSuccess + assert type(change_ok) is SyftSuccess assert "Successfully" in change_ok.message email = root_client.account.email diff --git a/packages/syft/tests/syft/zmq_queue_test.py b/packages/syft/tests/syft/zmq_queue_test.py index a995d09dced..b87136d56d2 100644 --- a/packages/syft/tests/syft/zmq_queue_test.py +++ b/packages/syft/tests/syft/zmq_queue_test.py @@ -275,4 +275,4 @@ def test_zmq_client_serde(): deser = syft.deserialize(bytes_data, from_bytes=True) - assert type(deser) == type(client) + assert type(deser) is type(client)