Skip to content

Commit

Permalink
Merge branch 'dev' into numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
Smartappli committed Apr 29, 2024
2 parents 9af2b0b + 41f71da commit d5265c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/syft/src/syft/client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _repr_markdown_(self, wrap_as_python: bool = False, indent: int = 0) -> str:
str_repr = "## API: " + custom_path + "\n"
str_repr += (
"### Description: "
+ f'<span style="font-weight: lighter;">{endpoint.description}</span><br>'
+ f'<span style="font-weight: lighter;">{endpoint.description.text}</span><br>'
+ "\n"
)
str_repr += "#### Private Code:\n"
Expand Down
8 changes: 4 additions & 4 deletions packages/syft/src/syft/protocol/protocol_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"CustomAPIView": {
"1": {
"version": 1,
"hash": "8fe9f0fded4dbce033e2b14798a59d8635c3b73b0562f9ea686b1162ed155e91",
"hash": "0b9afdd554f0b353c07256e2522342be1302b395d649f1cbabc555e5baecb150",
"action": "add"
}
},
Expand Down Expand Up @@ -108,21 +108,21 @@
"UpdateTwinAPIEndpoint": {
"1": {
"version": 1,
"hash": "cd0d4d67dc03cf6b78832f33ef584ec0ff8fa0b851629396ba27d7db63130342",
"hash": "6d8effd404f15d4378b1ff3382e0622b9e5a637d9db342d43cfec00fe29c649a",
"action": "add"
}
},
"CreateTwinAPIEndpoint": {
"1": {
"version": 1,
"hash": "e735dc30cba1789c3fb109e35aa40ffa873951f8e00b0b971950b1735c27d1ca",
"hash": "55e0a7b0ac428a6abb771ffcb925ee79cdd752a4b83058aa4b71fbef2a9fee63",
"action": "add"
}
},
"TwinAPIEndpoint": {
"1": {
"version": 1,
"hash": "540468be5db20efe555d2288c9aed60887306ac9b56d6a63c066246bc0010e9c",
"hash": "e538734d20be3b477e188eb91f66600c2e654bb32e34806ef24329e48238bf18",
"action": "add"
}
},
Expand Down
21 changes: 15 additions & 6 deletions packages/syft/src/syft/service/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from ...types.transforms import transform
from ...types.uid import UID
from ..context import AuthedServiceContext
from ..dataset.dataset import MarkdownDescription
from ..response import SyftError
from ..user.user import UserView

Expand Down Expand Up @@ -84,7 +85,7 @@ class TwinAPIEndpointView(SyftObject):
access: str = "Public"
mock_function: str | None = None
private_function: str | None = None
description: str | None = None
description: MarkdownDescription | None = None
mock_helper_functions: list[str] | None = None
private_helper_functions: list[str] | None = None
worker_pool: str | None = None
Expand Down Expand Up @@ -328,7 +329,7 @@ class UpdateTwinAPIEndpoint(PartialSyftObject, BaseTwinAPIEndpoint):
path: str
private_function: PrivateAPIEndpoint | None = None
mock_function: PublicAPIEndpoint
description: str | None = None
description: MarkdownDescription | None = None
endpoint_timeout: int = 60


Expand All @@ -342,10 +343,18 @@ class CreateTwinAPIEndpoint(BaseTwinAPIEndpoint):
private_function: PrivateAPIEndpoint | None = None
mock_function: PublicAPIEndpoint
signature: Signature
description: str | None = None
description: MarkdownDescription | None = None
worker_pool: str | None = None
endpoint_timeout: int = 60

def __init__(
self, description: str | MarkdownDescription | None = "", **kwargs: Any
) -> None:
if isinstance(description, str):
description = MarkdownDescription(text=description)

super().__init__(**kwargs, description=description)


@serializable()
class TwinAPIEndpoint(SyncableSyftObject):
Expand All @@ -360,7 +369,7 @@ def __init__(self, **kwargs: Any) -> None:
private_function: PrivateAPIEndpoint | None = None
mock_function: PublicAPIEndpoint
signature: Signature
description: str | None = None
description: MarkdownDescription | None = None
action_object_id: UID
worker_pool: str | None = None
endpoint_timeout: int = 60
Expand Down Expand Up @@ -626,7 +635,7 @@ def api_endpoint(
path: str,
settings: dict[str, str] | None = None,
helper_functions: list[Callable] | None = None,
description: str | None = None,
description: MarkdownDescription | None = None,
worker_pool: str | None = None,
endpoint_timeout: int = 60,
) -> Callable[..., TwinAPIEndpoint | SyftError]:
Expand Down Expand Up @@ -687,7 +696,7 @@ def create_new_api_endpoint(
path: str,
mock_function: Endpoint,
private_function: Endpoint | None = None,
description: str | None = None,
description: MarkdownDescription | None = None,
worker_pool: str | None = None,
endpoint_timeout: int = 60,
) -> CreateTwinAPIEndpoint | SyftError:
Expand Down

0 comments on commit d5265c6

Please sign in to comment.