Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 81 additions & 81 deletions code-samples/workspaces/sdk-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -312,79 +312,6 @@
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"### Delete a workspace\n",
"\n",
"When you delete a workspace, it will be soft-deleted. Deleted workspaces will no longer be accessible through `list_all_workspaces` by default.\n",
"The `delete_workspace` function has no return value."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" await workspace_client.delete_workspace(workspace_id=new_workspace.id)\n",
" print(f\"Successfully deleted workspace: {new_workspace.display_name}\")\n",
"except Exception as e:\n",
" print(f\"Error deleting workspace: {e}\")"
]
},
{
"cell_type": "markdown",
"id": "17",
"metadata": {},
"source": [
"### Fetch details of a deleted workspace\n",
"\n",
"You must include the `deleted=True` option to find details of a deleted workspace."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"from evo.workspaces import Workspace\n",
"\n",
"try:\n",
" workspace: Workspace = await workspace_client.get_workspace(workspace_id=new_workspace.id, deleted=True)\n",
"\n",
" # Display the workspace details\n",
" workspace_info = {\n",
" \"Name\": workspace.display_name,\n",
" \"ID\": workspace.id,\n",
" \"User Role\": workspace.user_role,\n",
" }\n",
"\n",
" df = pd.DataFrame([workspace_info]).T\n",
" df.columns = [\"Workspace info\"]\n",
" display(df)\n",
"except Exception as e:\n",
" print(f\"Error listing workspaces:\\n{e}\")"
]
},
{
"cell_type": "markdown",
"id": "19",
"metadata": {},
"source": [
"### Restore a deleted workspace\n",
"\n",
"To restore a deleted workspace, see the code sample in `api-examples.ipynb`."
]
},
{
"cell_type": "markdown",
"id": "20",
"metadata": {},
"source": [
"## User operations\n",
"\n",
Expand All @@ -403,7 +330,7 @@
},
{
"cell_type": "markdown",
"id": "21",
"id": "16",
"metadata": {},
"source": [
"### Fetch details of the current user's workspace role\n",
Expand All @@ -414,7 +341,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"id": "17",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -430,7 +357,7 @@
},
{
"cell_type": "markdown",
"id": "23",
"id": "18",
"metadata": {},
"source": [
"### List users with access to a workspace"
Expand All @@ -439,7 +366,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "24",
"id": "19",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -463,7 +390,7 @@
},
{
"cell_type": "markdown",
"id": "25",
"id": "20",
"metadata": {},
"source": [
"### Assign a user to a workspace"
Expand All @@ -472,7 +399,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "26",
"id": "21",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -490,7 +417,7 @@
},
{
"cell_type": "markdown",
"id": "27",
"id": "22",
"metadata": {},
"source": [
"### Remove a user from a workspace"
Expand All @@ -499,7 +426,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "28",
"id": "23",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -513,6 +440,79 @@
"except Exception as e:\n",
" print(f\"Error removing user role:\\n{e}\")"
]
},
{
"cell_type": "markdown",
"id": "24",
"metadata": {},
"source": [
"### Delete a workspace\n",
"\n",
"When you delete a workspace, it will be soft-deleted. Deleted workspaces will no longer be accessible through `list_all_workspaces` by default.\n",
"The `delete_workspace` function has no return value."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "25",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" await workspace_client.delete_workspace(workspace_id=new_workspace.id)\n",
" print(f\"Successfully deleted workspace: {new_workspace.display_name}\")\n",
"except Exception as e:\n",
" print(f\"Error deleting workspace: {e}\")"
]
},
{
"cell_type": "markdown",
"id": "26",
"metadata": {},
"source": [
"### Fetch details of a deleted workspace\n",
"\n",
"You must include the `deleted=True` option to find details of a deleted workspace."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "27",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"from evo.workspaces import Workspace\n",
"\n",
"try:\n",
" workspace: Workspace = await workspace_client.get_workspace(workspace_id=new_workspace.id, deleted=True)\n",
"\n",
" # Display the workspace details\n",
" workspace_info = {\n",
" \"Name\": workspace.display_name,\n",
" \"ID\": workspace.id,\n",
" \"User Role\": workspace.user_role,\n",
" }\n",
"\n",
" df = pd.DataFrame([workspace_info]).T\n",
" df.columns = [\"Workspace info\"]\n",
" display(df)\n",
"except Exception as e:\n",
" print(f\"Error listing workspaces:\\n{e}\")"
]
},
{
"cell_type": "markdown",
"id": "28",
"metadata": {},
"source": [
"### Restore a deleted workspace\n",
"\n",
"To restore a deleted workspace, see the code sample in `api-examples.ipynb`."
]
}
],
"metadata": {
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies = [
"evo-colormaps[aiohttp,notebooks]>=0.0.2",
"evo-compute[aiohttp,notebooks]>=0.0.1rc2",
"jupyter",
"authlib>=1.6.8",
"pyjwt>=2.11.0",
]
dynamic = ["readme"]

Expand Down
Loading