Skip to content

Commit

Permalink
v4.0.1 Release. (#2982)
Browse files Browse the repository at this point in the history
  • Loading branch information
khustup2 authored Nov 6, 2024
1 parent 8ade865 commit 6039f72
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 3 deletions.
7 changes: 6 additions & 1 deletion python/deeplake/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import os
from typing import Callable, Any, Dict

import numpy

import deeplake
from ._deeplake import *
from ._deeplake import _deepcopy

__version__ = "4.0.0"
__version__ = "4.0.1"

__all__ = [
"__version__",
"FutureVoid",
"Future",
"Tag",
"TagView",
"TagNotFoundError",
"Tags",
"TagsView",
"ColumnDefinition",
"ColumnDefinitionView",
"ColumnView",
Expand All @@ -29,6 +33,7 @@
"UnevenUpdateError",
"ColumnMissingAppendValueError",
"ColumnAlreadyExistsError",
"ColumnDoesNotExistError",
"InvalidColumnValueError",
"GcsStorageProviderFailed",
"History",
Expand Down
83 changes: 81 additions & 2 deletions python/deeplake/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ __all__ = [
"FutureVoid",
"Future",
"Tag",
"TagView",
"TagNotFoundError",
"Tags",
"TagsView",
"ColumnDefinition",
"ColumnDefinitionView",
"ColumnView",
Expand All @@ -28,6 +30,7 @@ __all__ = [
"UnevenUpdateError",
"ColumnMissingAppendValueError",
"ColumnAlreadyExistsError",
"ColumnDoesNotExistError",
"InvalidColumnValueError",
"GcsStorageProviderFailed",
"History",
Expand Down Expand Up @@ -321,8 +324,52 @@ class Tag:
"""
...

def open_async(self) -> Future:
"""
Asynchronously fetches the dataset corresponding to the tag and returns a Future object.
"""
...

def __repr__(self) -> str: ...

class TagView:
"""
Describes a read-only tag within the dataset.
Tags are created using [deeplake.Dataset.tag][].
"""

@property
def id(self) -> str:
"""
The unique identifier of the tag
"""

@property
def name(self) -> str:
"""
The name of the tag
"""

@property
def version(self) -> str:
"""
The version that has been tagged
"""

def open(self) -> ReadOnlyDataset:
"""
Fetches the dataset corresponding to the tag
"""
...

def open_async(self) -> Future:
"""
Asynchronously fetches the dataset corresponding to the tag and returns a Future object.
"""
...

def __repr__(self) -> str: ...

class TagNotFoundError(Exception):
pass
Expand Down Expand Up @@ -361,6 +408,34 @@ class Tags:

...

class TagsView:
"""
Provides access to the tags within a dataset.
It is returned by the [deeplake.Dataset.tags][] property on a [deeplake.ReadOnlyDataset][].
"""

def __getitem__(self, name: str) -> TagView:
"""
Return a tag by name
"""
...

def __len__(self) -> int:
"""
The total number of tags in the dataset
"""
...

def __repr__(self) -> str: ...

def names(self) -> list[str]:
"""
Return a list of tag names
"""

...


class ColumnDefinition:
def __repr__(self) -> str: ...
Expand Down Expand Up @@ -1329,9 +1404,9 @@ class ReadOnlyDataset(DatasetView):
def __repr__(self) -> str: ...

@property
def tags(self) -> Tags:
def tags(self) -> TagsView:
"""
The collection of [deeplake.Tags][] within the dataset
The collection of [deeplake.TagsView][] within the dataset
"""
...

Expand Down Expand Up @@ -1437,6 +1512,10 @@ class ColumnAlreadyExistsError(Exception):
pass


class ColumnDoesNotExistError(Exception):
pass


class InvalidColumnValueError(Exception):
pass

Expand Down
1 change: 1 addition & 0 deletions python/deeplake/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"BoundingBox",
"BinaryMask",
"SegmentMask",
"TypeKind",
"TextIndexType",
"QuantizationType",
"Binary",
Expand Down
66 changes: 66 additions & 0 deletions python/deeplake/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ __all__ = [
"BoundingBox",
"BinaryMask",
"SegmentMask",
"TypeKind",
"TextIndexType",
"QuantizationType",
"Binary",
Expand Down Expand Up @@ -144,6 +145,10 @@ class Type:
def is_sequence(self) -> bool:
...

@property
def kind(self) -> TypeKind:
...

@property
def shape(self) -> list[int] | None:
"""
Expand All @@ -152,6 +157,66 @@ class Type:
...


class TypeKind:
"""
Members:
Generic
Text
Dict
Embedding
Sequence
Image
BoundingBox
BinaryMask
SegmentMask
"""
BinaryMask: typing.ClassVar[TypeKind]
BoundingBox: typing.ClassVar[TypeKind]
Dict: typing.ClassVar[TypeKind]
Embedding: typing.ClassVar[TypeKind]
Generic: typing.ClassVar[TypeKind]
Image: typing.ClassVar[TypeKind]
SegmentMask: typing.ClassVar[TypeKind]
Sequence: typing.ClassVar[TypeKind]
Text: typing.ClassVar[TypeKind]
__members__: typing.ClassVar[dict[str, TypeKind]]
def __eq__(self, other: typing.Any) -> bool:
...
def __getstate__(self) -> int:
...
def __hash__(self) -> int:
...
def __index__(self) -> int:
...
def __init__(self, value: int) -> None:
...
def __int__(self) -> int:
...
def __ne__(self, other: typing.Any) -> bool:
...
def __repr__(self) -> str:
...
def __setstate__(self, state: int) -> None:
...
def __str__(self) -> str:
...
@property
def name(self) -> str:
...
@property
def value(self) -> int:
...


@typing.overload
def Array(dtype: DataType | str, dimensions: int) -> DataType: ...

Expand Down Expand Up @@ -250,6 +315,7 @@ def Embedding(size: int, dtype: DataType | str = "float32", quantization: Quanti
size: The size of the embedding
dtype: The datatype of the embedding. Defaults to float32
quantization: How to compress the embeddings in the index. Default uses no compression, but can be set to [deeplake.types.QuantizationType.Binary][]
Examples:
>>> ds.add_column("col1", types.Embedding(768))
>>> ds.add_column("col2", types.Embedding(768, quantization=types.QuantizationType.Binary))
Expand Down

0 comments on commit 6039f72

Please sign in to comment.