Skip to content

Commit

Permalink
Feature: add delete method to dataset API (#229)
Browse files Browse the repository at this point in the history
* add delete dataset method

* add api method

* Bump version (v2.0.5)
  • Loading branch information
ryansingman authored May 22, 2024
1 parent 909cefc commit 47455b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cleanlab_studio/internal/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ def get_cleanset_status(api_key: str, cleanset_id: str) -> JSONDict:
return status


def delete_dataset(api_key: str, dataset_id: str) -> None:
check_uuid_well_formed(dataset_id, "dataset ID")
res = requests.delete(dataset_base_url + f"/{dataset_id}", headers=_construct_headers(api_key))
handle_api_error(res)


def delete_project(api_key: str, project_id: str) -> None:
check_uuid_well_formed(project_id, "project ID")
res = requests.delete(project_base_url + f"/{project_id}", headers=_construct_headers(api_key))
Expand Down
13 changes: 13 additions & 0 deletions cleanlab_studio/studio/studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ def upload_dataset(
schema_overrides=schema_overrides,
)

def delete_dataset(
self,
dataset_id: str,
) -> None:
"""Deletes a dataset from Cleanlab Studio.
If the dataset is used in projects, the projects will be deleted as well.
"""
api.delete_dataset(
self._api_key,
dataset_id,
)

def download_cleanlab_columns(
self,
cleanset_id: str,
Expand Down
2 changes: 1 addition & 1 deletion cleanlab_studio/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Note to developers:
# Consider if backend's MIN_CLI_VERSION needs updating when pushing any changes to this file.

__version__ = "2.0.4"
__version__ = "2.0.5"

SCHEMA_VERSION = "0.2.0"
MIN_SCHEMA_VERSION = "0.1.0"
Expand Down

0 comments on commit 47455b7

Please sign in to comment.