Skip to content

Commit

Permalink
Merge branch 'main' of github.com:activeloopai/deeplake into managed-…
Browse files Browse the repository at this point in the history
…thin-client
  • Loading branch information
dgaloop committed Feb 10, 2024
2 parents 6daf75d + 8fff66c commit ddd1065
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 236 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ If you're a dataset owner and do not want your dataset to be included in this li
<details>
<summary><b> Usage Tracking</b></summary>

By default, we collect usage data using Bugout (here's the [code](https://github.com/activeloopai/deeplake/blob/853456a314b4fb5623c936c825601097b0685119/deeplake/__init__.py#L24) that does it). It does not collect user data other than anonymized IP address data, and it only logs the Deep Lake library's own actions. This helps our team understand how the tool is used and how to build features that matter to you! After you register with Activeloop, data is no longer anonymous. You can always opt-out of reporting using the CLI command below, or by setting an environmental variable ```BUGGER_OFF``` to ```True```:

```bash
activeloop reporting --off
```
By default, we collect usage data using Bugout (here's the [code](https://github.com/activeloopai/deeplake/blob/853456a314b4fb5623c936c825601097b0685119/deeplake/__init__.py#L24) that does it). It does not collect user data other than anonymized IP address data, and it only logs the Deep Lake library's own actions. This helps our team understand how the tool is used and how to build features that matter to you! After you register with Activeloop, data is no longer anonymous. You can always opt-out of reporting by setting an environmental variable ```BUGGER_OFF``` to ```True```:

</details>

Expand Down
2 changes: 1 addition & 1 deletion deeplake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
]


__version__ = "3.8.19"
__version__ = "3.8.20"
warn_if_update_required(__version__)
__encoded_version__ = np.array(__version__)
config = {"s3": Config(max_pool_connections=50, connect_timeout=300, read_timeout=300)}
Expand Down
1 change: 0 additions & 1 deletion deeplake/api/tests/test_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pytest
from io import StringIO
from contextlib import contextmanager
from deeplake.cli.auth import login, logout
from deeplake.client.client import DeepLakeBackendClient
from deeplake.util.exceptions import (
AgreementNotAcceptedError,
Expand Down
10 changes: 0 additions & 10 deletions deeplake/api/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@
from deeplake.util.pretty_print import summary_tensor, summary_dataset
from deeplake.util.shape_interval import ShapeInterval
from deeplake.constants import GDRIVE_OPT, MB, KB
from deeplake.client.config import REPORTING_CONFIG_FILE_PATH

from click.testing import CliRunner
from deeplake.cli.auth import login, logout
from deeplake.util.bugout_reporter import feature_report_path
from rich import print as rich_print
from io import BytesIO

Expand Down Expand Up @@ -2350,13 +2347,6 @@ def user_not_logged_in_exception_check(runner):
ds = deeplake.empty("hub://adilkhan/demo")


def dataset_handler_error_check(runner, username, password):
result = runner.invoke(login, f"-u {username} -p {password}")
with pytest.raises(DatasetHandlerError):
ds = deeplake.load(f"hub://{username}/wrong-path")
runner.invoke(logout)


def test_incompat_dtype_msg(local_ds, capsys):
local_ds.create_tensor("abc", dtype="uint32")
with pytest.raises(SampleAppendError):
Expand Down
1 change: 0 additions & 1 deletion deeplake/api/tests/test_dataset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import jwt

from deeplake.util.exceptions import DatasetHandlerError, UserNotLoggedInException
from deeplake.cli.auth import login, logout
from click.testing import CliRunner
import pytest
import deeplake
Expand Down
21 changes: 2 additions & 19 deletions deeplake/api/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from deeplake.util.exceptions import ReadOnlyModeError, EmptyTensorError, TransformError
from deeplake.client.utils import get_user_name
from deeplake.cli.auth import logout, login
from click.testing import CliRunner

import numpy as np

Expand All @@ -27,10 +24,6 @@ def populate(ds):
def test_view_token_only(
hub_cloud_path, hub_cloud_dev_token, hub_cloud_dev_credentials
):
runner = CliRunner()
result = runner.invoke(logout)
assert result.exit_code == 0

ds = deeplake.empty(hub_cloud_path, token=hub_cloud_dev_token)
with ds:
populate(ds)
Expand Down Expand Up @@ -60,29 +53,19 @@ def test_view_token_only(


@pytest.mark.slow
def test_view_public(hub_cloud_dev_credentials):
runner = CliRunner()
result = runner.invoke(logout)
assert result.exit_code == 0

username, password = hub_cloud_dev_credentials

def test_view_public(hub_cloud_dev_token):
ds = deeplake.load("hub://activeloop/mnist-train")
view = ds[100:200]

with pytest.raises(ReadOnlyModeError):
view.save_view(id="100to200")

runner.invoke(login, f"-u {username} -p {password}")

ds = deeplake.load("hub://activeloop/mnist-train")
ds = deeplake.load("hub://activeloop/mnist-train", token=hub_cloud_dev_token)
view = ds[100:200]

with pytest.raises(ReadOnlyModeError):
view.save_view(id="100to200")

runner.invoke(logout)


def test_view_with_empty_tensor(local_ds):
with local_ds as ds:
Expand Down
Empty file removed deeplake/cli/__init__.py
Empty file.
152 changes: 0 additions & 152 deletions deeplake/cli/auth.py

This file was deleted.

21 changes: 0 additions & 21 deletions deeplake/cli/commands.py

This file was deleted.

12 changes: 0 additions & 12 deletions deeplake/cli/test_cli.py

This file was deleted.

2 changes: 0 additions & 2 deletions deeplake/client/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import pytest

Check failure on line 1 in deeplake/client/test_client.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_client.test_deepmemory_delete

failed on setup with "deeplake.util.exceptions.AuthenticationException: Authentication failed. Please try logging in again."
Raw output
request = <SubRequest 'corpus_query_relevances_copy' for <Function test_deepmemory_delete>>
hub_cloud_dev_token = 'eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpZCI6InRlc3RpbmdhY2MyIiwiYXBpX2tleSI6IjU4Y0tLb1p6UE1BbThPU2RpbTRiZ2tBekhWekt1VUE3MFJpNTNyZUpKRTJuaiJ9.'

    @pytest.fixture
    def corpus_query_relevances_copy(request, hub_cloud_dev_token):
        if not is_opt_true(request, HUB_CLOUD_OPT):
            pytest.skip(f"{HUB_CLOUD_OPT} flag not set")
            return
    
        corpus = _get_storage_path(request, HUB_CLOUD)
>       query_vs = VectorStore(
            path=f"hub://{HUB_CLOUD_DEV_USERNAME}/deepmemory_test_queries2",
            runtime={"tensor_db": True},
            token=hub_cloud_dev_token,
        )

deeplake/tests/path_fixtures.py:482: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
deeplake/core/vectorstore/deeplake_vectorstore.py:124: in __init__
    self.dataset_handler = get_dataset_handler(
deeplake/core/vectorstore/dataset_handlers/dataset_handler.py:13: in get_dataset_handler
    return ManagedDH(*args, **kwargs)
deeplake/core/vectorstore/dataset_handlers/managed_dataset_handler.py:130: in __init__
    response = self.client.init_vectorstore(
deeplake/client/managed/managed_client.py:69: in init_vectorstore
    response = self.request(
deeplake/client/client.py:163: in request
    check_response_status(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <Response [401]>

    def check_response_status(response: requests.Response):
        """Check response status and throw corresponding exception on failure."""
        code = response.status_code
        if code >= 200 and code < 300:
            return
    
        try:
            message = response.json()["description"]
        except Exception:
            message = " "
    
        if code == 400:
            raise BadRequestException(message)
        elif response.status_code == 401:
>           raise AuthenticationException
E           deeplake.util.exceptions.AuthenticationException: Authentication failed. Please try logging in again.

deeplake/client/utils.py:88: AuthenticationException
from deeplake.cli.commands import login, logout
from click.testing import CliRunner
from deeplake.client.client import (
DeepLakeBackendClient,
DeepMemoryBackendClient,
Expand Down
3 changes: 0 additions & 3 deletions deeplake/core/vectorstore/test_deeplake_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
METRIC_TO_INDEX_METRIC,
)
from deeplake.core.vectorstore.vector_search import dataset as dataset_utils
from deeplake.cli.auth import login, logout
from click.testing import CliRunner


EMBEDDING_DIM = 100
NUMBER_OF_DATA = 10
Expand Down
4 changes: 0 additions & 4 deletions deeplake/core/vectorstore/vector_search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ def create_tensor_to_length_str(tensors):
return tensor_lengths


random.seed(0)
np.random.seed(0)


def generate_random_string(length):
# Define the character set to include letters (both lowercase and uppercase) and digits
characters = string.ascii_letters + string.digits
Expand Down
2 changes: 0 additions & 2 deletions deeplake/enterprise/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from math import floor

import deeplake
from click.testing import CliRunner
from deeplake.cli.auth import login, logout
from deeplake.constants import QUERY_MESSAGE_MAX_SIZE
from deeplake.tests.common import requires_libdeeplake
from deeplake.util.exceptions import EmptyTokenException
Expand Down
4 changes: 3 additions & 1 deletion deeplake/util/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def storage_provider_from_path(
creds_used = "PLATFORM"
if creds == "ENV":
creds_used = "ENV"
elif isinstance(creds, dict) and set(creds.keys()) == {"profile_name"}:
elif isinstance(creds, dict) and (
set(creds.keys()) == {"profile_name"} or not bool(creds)
):
creds_used = "ENV"
elif isinstance(creds, dict) and bool(creds):
creds_used = "DICT"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def libdeeplake_available():
extras_require["all"] = [req_map[r] for r in all_extras]

if libdeeplake_available():
libdeeplake = "libdeeplake==0.0.98"
libdeeplake = "libdeeplake==0.0.99"
extras_require["enterprise"] = [libdeeplake, "pyjwt"]
extras_require["all"].append(libdeeplake)
install_requires.append(libdeeplake)
Expand Down Expand Up @@ -101,7 +101,7 @@ def get_property(prop):
"tests_require": tests,
"include_package_data": True,
"zip_safe": False,
"entry_points": {"console_scripts": ["activeloop = deeplake.cli.commands:cli"]},
"entry_points": {},
"dependency_links": [],
"project_urls": {
"Documentation": "https://docs.activeloop.ai/",
Expand Down

0 comments on commit ddd1065

Please sign in to comment.