Skip to content

Commit c47753b

Browse files
pfmarkjean-lucas
andauthored
Update slice info (#401)
* add description to slice info * bump version * add descritpion to repr * Update nucleus/slice.py Co-authored-by: Jean Lucas <jean.ferreira@scale.com> * black --------- Co-authored-by: Jean Lucas <jean.ferreira@scale.com>
1 parent c641abb commit c47753b

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## [0.16.5](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.16.4) - 2023-10-12
10+
11+
### Added
12+
- Added a `description` to the slice info.
13+
914
## [0.16.4](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.16.4) - 2023-10-23
1015

1116
### Added

nucleus/slice.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ def __init__(self, slice_id: str, client):
135135
self._client = client
136136
self._name = None
137137
self._dataset_id = None
138+
self._description = None
138139
self._created_at = None
139140
self._pending_job_count = None
140141
self._type = None
141142

142143
def __repr__(self):
143-
return f"Slice(slice_id='{self.id}', name={self._name}, dataset_id={self._dataset_id})"
144+
return f"Slice(slice_id='{self.id}', name='{self.name}', dataset_id='{self.dataset_id}', description='{self.description}')"
144145

145146
def __eq__(self, other):
146147
if self.id == other.id:
@@ -201,6 +202,13 @@ def name(self):
201202
self._name = self.info()["name"]
202203
return self._name
203204

205+
@property
206+
def description(self):
207+
"""Slice description, plain text."""
208+
if self._description is None:
209+
self._description = self.info()["description"]
210+
return self._description
211+
204212
@property
205213
def dataset_id(self):
206214
"""The ID of the Dataset to which the Slice belongs."""
@@ -318,6 +326,10 @@ def info(self) -> dict:
318326
"name": Union[str, int],
319327
"slice_id": str,
320328
"dataset_id": str,
329+
"type": str
330+
"pending_job_count": int
331+
"created_at": datetime
332+
"description": Union[str, None]
321333
}
322334
"""
323335
info = KeyErrorDict(
@@ -332,6 +344,7 @@ def info(self) -> dict:
332344
self._created_at = info["created_at"]
333345
self._pending_job_count = info["pending_job_count"]
334346
self._type = info["type"]
347+
self._description = info["description"]
335348
return info
336349

337350
def append(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ignore = ["E501", "E741", "E731", "F401"] # Easy ignore for getting it running
2525

2626
[tool.poetry]
2727
name = "scale-nucleus"
28-
version = "0.16.4"
28+
version = "0.16.5"
2929
description = "The official Python client library for Nucleus, the Data Platform for AI"
3030
license = "MIT"
3131
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]

0 commit comments

Comments
 (0)