Skip to content

Commit 5711249

Browse files
committed
Remove warnings
1 parent b19cce2 commit 5711249

File tree

4 files changed

+43
-95
lines changed

4 files changed

+43
-95
lines changed

pinecone/data/features/bulk_import.py

-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from enum import Enum
22
from typing import Optional, Literal, Iterator, List, Type, cast
33

4-
from pinecone.utils.decorators import prerelease_feature
54
from pinecone.config.config import ConfigBuilder
65
from pinecone.core_ea.openapi.db_data import ApiClient
76
from pinecone.core_ea.openapi.db_data.api.bulk_operations_api import BulkOperationsApi
@@ -44,9 +43,6 @@ def __init__(self, **kwargs):
4443
api_version=API_VERSION,
4544
)
4645

47-
usage_warning = "The bulk import feature is in early access."
48-
49-
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
5046
def start_import(
5147
self,
5248
uri: str,
@@ -90,7 +86,6 @@ def start_import(
9086

9187
return self.__import_operations_api.start_import(StartImportRequest(**args_dict))
9288

93-
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
9489
def list_imports(self, **kwargs) -> Iterator[List[ImportModel]]:
9590
"""
9691
Returns a generator that yields each import operation. It automatically handles pagination tokens on your behalf so you can
@@ -127,7 +122,6 @@ def list_imports(self, **kwargs) -> Iterator[List[ImportModel]]:
127122
else:
128123
done = True
129124

130-
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
131125
def list_imports_paginated(
132126
self,
133127
limit: Optional[int] = None,
@@ -172,7 +166,6 @@ def list_imports_paginated(
172166
)
173167
return self.__import_operations_api.list_imports(**args_dict)
174168

175-
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
176169
def describe_import(self, id: str) -> ImportModel:
177170
"""
178171
describe_import is used to get detailed information about a specific import operation.
@@ -189,7 +182,6 @@ def describe_import(self, id: str) -> ImportModel:
189182

190183
return self.__import_operations_api.describe_import(id=id)
191184

192-
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
193185
def cancel_import(self, id: str):
194186
"""Cancel an import operation.
195187

pinecone/utils/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212
from .parse_args import parse_non_empty_args
1313
from .docslinks import docslinks
1414
from .repr_overrides import install_json_repr_override
15-
from .decorators import prerelease_feature

pinecone/utils/decorators.py

-34
This file was deleted.

tests/unit/data/test_bulk_import.py

+43-52
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import warnings
32

43
from urllib3 import BaseHTTPResponse
54

@@ -36,17 +35,16 @@ def test_start_import_minimal(self, mocker):
3635
"""
3736
client, mock_req = build_client_w_faked_response(mocker, body)
3837

39-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
40-
my_import = client.start_import("s3://path/to/file.parquet")
38+
my_import = client.start_import("s3://path/to/file.parquet")
4139

42-
# We made some overrides to the print behavior, so we need to
43-
# call it to ensure it doesn't raise an exception
44-
print(my_import)
40+
# We made some overrides to the print behavior, so we need to
41+
# call it to ensure it doesn't raise an exception
42+
print(my_import)
4543

46-
assert my_import.id == "1"
47-
assert my_import["id"] == "1"
48-
assert my_import.to_dict() == {"id": "1"}
49-
assert my_import.__class__ == StartImportResponse
44+
assert my_import.id == "1"
45+
assert my_import["id"] == "1"
46+
assert my_import.to_dict() == {"id": "1"}
47+
assert my_import.__class__ == StartImportResponse
5048

5149
def test_start_import_with_kwargs(self, mocker):
5250
body = """
@@ -56,19 +54,18 @@ def test_start_import_with_kwargs(self, mocker):
5654
"""
5755
client, mock_req = build_client_w_faked_response(mocker, body)
5856

59-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
60-
my_import = client.start_import(uri="s3://path/to/file.parquet", integration_id="123-456-789")
61-
assert my_import.id == "1"
62-
assert my_import["id"] == "1"
63-
assert my_import.to_dict() == {"id": "1"}
64-
assert my_import.__class__ == StartImportResponse
57+
my_import = client.start_import(uri="s3://path/to/file.parquet", integration_id="123-456-789")
58+
assert my_import.id == "1"
59+
assert my_import["id"] == "1"
60+
assert my_import.to_dict() == {"id": "1"}
61+
assert my_import.__class__ == StartImportResponse
6562

66-
# By default, use continue error mode
67-
_, call_kwargs = mock_req.call_args
68-
assert (
69-
call_kwargs["body"]
70-
== '{"uri": "s3://path/to/file.parquet", "integrationId": "123-456-789", "errorMode": {"onError": "continue"}}'
71-
)
63+
# By default, use continue error mode
64+
_, call_kwargs = mock_req.call_args
65+
assert (
66+
call_kwargs["body"]
67+
== '{"uri": "s3://path/to/file.parquet", "integrationId": "123-456-789", "errorMode": {"onError": "continue"}}'
68+
)
7269

7370
@pytest.mark.parametrize(
7471
"error_mode_input",
@@ -87,10 +84,9 @@ def test_start_import_with_explicit_error_mode(self, mocker, error_mode_input):
8784
"""
8885
client, mock_req = build_client_w_faked_response(mocker, body)
8986

90-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
91-
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=error_mode_input)
92-
_, call_kwargs = mock_req.call_args
93-
assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "continue"}}'
87+
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=error_mode_input)
88+
_, call_kwargs = mock_req.call_args
89+
assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "continue"}}'
9490

9591
def test_start_import_with_abort_error_mode(self, mocker):
9692
body = """
@@ -100,10 +96,9 @@ def test_start_import_with_abort_error_mode(self, mocker):
10096
"""
10197
client, mock_req = build_client_w_faked_response(mocker, body)
10298

103-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
104-
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=ImportErrorMode.ABORT)
105-
_, call_kwargs = mock_req.call_args
106-
assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "abort"}}'
99+
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=ImportErrorMode.ABORT)
100+
_, call_kwargs = mock_req.call_args
101+
assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "abort"}}'
107102

108103
def test_start_import_with_unknown_error_mode(self, mocker):
109104
body = """
@@ -113,11 +108,10 @@ def test_start_import_with_unknown_error_mode(self, mocker):
113108
"""
114109
client, mock_req = build_client_w_faked_response(mocker, body)
115110

116-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
117-
with pytest.raises(ValueError) as e:
118-
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode="unknown")
111+
with pytest.raises(ValueError) as e:
112+
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode="unknown")
119113

120-
assert "Invalid error_mode value: unknown" in str(e.value)
114+
assert "Invalid error_mode value: unknown" in str(e.value)
121115

122116
def test_start_invalid_uri(self, mocker):
123117
body = """
@@ -129,9 +123,8 @@ def test_start_invalid_uri(self, mocker):
129123
"""
130124
client, mock_req = build_client_w_faked_response(mocker, body, 400)
131125

132-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
133-
with pytest.raises(PineconeApiException) as e:
134-
my_import = client.start_import(uri="invalid path")
126+
with pytest.raises(PineconeApiException) as e:
127+
my_import = client.start_import(uri="invalid path")
135128

136129
assert e.value.status == 400
137130
assert e.value.body == body
@@ -140,9 +133,8 @@ def test_start_invalid_uri(self, mocker):
140133
def test_no_arguments(self, mocker):
141134
client, mock_req = build_client_w_faked_response(mocker, "")
142135

143-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
144-
with pytest.raises(TypeError) as e:
145-
client.start_import()
136+
with pytest.raises(TypeError) as e:
137+
client.start_import()
146138

147139
assert "missing 1 required positional argument" in str(e.value)
148140

@@ -165,17 +157,16 @@ def test_describe_import(self, mocker):
165157
"""
166158
client, mock_req = build_client_w_faked_response(mocker, body)
167159

168-
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
169-
my_import = client.describe_import(id="1")
160+
my_import = client.describe_import(id="1")
170161

171-
# We made some overrides to the print behavior, so we need to
172-
# call it to ensure it doesn't raise an exception
173-
print(my_import)
162+
# We made some overrides to the print behavior, so we need to
163+
# call it to ensure it doesn't raise an exception
164+
print(my_import)
174165

175-
assert my_import.id == "1"
176-
assert my_import["id"] == "1"
177-
desc = my_import.to_dict()
178-
assert desc["id"] == "1"
179-
assert desc["records_imported"] == 1000
180-
assert desc["uri"] == "s3://path/to/file.parquet"
181-
assert desc["status"] == "InProgress"
166+
assert my_import.id == "1"
167+
assert my_import["id"] == "1"
168+
desc = my_import.to_dict()
169+
assert desc["id"] == "1"
170+
assert desc["records_imported"] == 1000
171+
assert desc["uri"] == "s3://path/to/file.parquet"
172+
assert desc["status"] == "InProgress"

0 commit comments

Comments
 (0)