Skip to content

Commit 0998b72

Browse files
authored
[Bug] Infinite loop when listing the contents of an empty catalog (#49)
## Problem When trying to call `Catalog.list_datasets` on an empty catalog, you go into an infinite loop. ```python from pinecone_datasets import Catalog catalog = Catalog(base_path='/path/to/empty/dir') catalog.list_datasets() # infinite loop ``` ## Solution Add test and remove the offending log line attempting to call list_datasets as they are being loaded in. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue)
1 parent bdbd226 commit 0998b72

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

pinecone_datasets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.. include:: ../README.md
33
"""
44

5-
__version__ = "1.0.0"
5+
__version__ = "1.0.1"
66

77

88
from .public import list_datasets, load_dataset

pinecone_datasets/catalog.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def load(self, **kwargs) -> "Catalog":
6161

6262
self.datasets = collected_datasets
6363
logger.info(f"Loaded {len(self.datasets)} datasets from {self.base_path}")
64-
logger.debug(f"Datasets in {self.base_path}: {self.list_datasets(as_df=False)}")
6564
return self
6665

6766
def list_datasets(self, as_df: bool) -> Union[List[str], "pd.DataFrame"]:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pinecone-datasets"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "Load datasets to explore Pinecone"
55
authors = ["Pinecone Support <support@pinecone.io>"]
66
maintainers = [

tests/integration/test_io_local.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747

4848

4949
class TestLocalIO:
50+
def test_empty_catalog(self, tmpdir):
51+
catalog = Catalog(base_path=str(tmpdir.mkdir("catalog")))
52+
assert catalog.list_datasets(as_df=False) == []
53+
5054
def test_io_write_to_local(self, tmpdir):
5155
dataset_name = "test_io_dataset"
5256
metadata = DatasetMetadata(

tests/unit/test_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515

1616
def test_version():
17-
assert __version__ == "1.0.0"
17+
assert __version__ == "1.0.1"

0 commit comments

Comments
 (0)