Skip to content

Commit 9002584

Browse files
authored
Remove openapi_config property (#369)
## Problem We want to remove the `openapi_config` config property because we don't want generated openapi stuff in the public interface. This is a holdover from the v2 days of `pinecone.init()` but has never been documented; I would be surprised if anyone is actually using it. ## Solution - Convert deprecation warning into an exception - Remove unit tests relying on this deprecated option ## Type of Change - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1 parent 5854471 commit 9002584

File tree

4 files changed

+4
-41
lines changed

4 files changed

+4
-41
lines changed

pinecone/control/pinecone.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,8 @@ def __init__(
214214
)
215215

216216
if kwargs.get("openapi_config", None):
217-
warnings.warn(
218-
"Passing openapi_config is deprecated and will be removed in a future release. Please pass settings such as proxy_url, proxy_headers, ssl_ca_certs, and ssl_verify directly to the Pinecone constructor as keyword arguments. See the README at https://github.com/pinecone-io/pinecone-python-client for examples.",
219-
DeprecationWarning,
217+
raise Exception(
218+
"Passing openapi_config is no longer supported. Please pass settings such as proxy_url, proxy_headers, ssl_ca_certs, and ssl_verify directly to the Pinecone constructor as keyword arguments. See the README at https://github.com/pinecone-io/pinecone-python-client for examples.",
220219
)
221220

222221
self.openapi_config = ConfigBuilder.build_openapi_config(self.config, **kwargs)

tests/integration/data/test_openapi_configuration.py

-19
This file was deleted.

tests/unit/test_config.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,9 @@ def test_config_pool_threads(self):
9898
idx = pc.Index(host="my-index-host", name="my-index-name")
9999
assert idx._vector_api.api_client.pool_threads == 10
100100

101-
def test_config_when_openapi_config_is_passed_merges_api_key(self):
102-
oai_config = OpenApiConfiguration()
103-
pc = Pinecone(api_key="asdf", openapi_config=oai_config)
104-
assert pc.openapi_config.api_key == {"ApiKeyAuth": "asdf"}
105-
106101
def test_ssl_config_passed_to_index_client(self):
107-
oai_config = OpenApiConfiguration()
108-
oai_config.ssl_ca_cert = "path/to/cert"
109102
proxy_headers = make_headers(proxy_basic_auth="asdf")
110-
oai_config.proxy_headers = proxy_headers
111-
112-
pc = Pinecone(api_key="key", openapi_config=oai_config)
103+
pc = Pinecone(api_key="key", ssl_ca_certs="path/to/cert", proxy_headers=proxy_headers)
113104

114105
assert pc.openapi_config.ssl_ca_cert == "path/to/cert"
115106
assert pc.openapi_config.proxy_headers == proxy_headers
@@ -119,12 +110,8 @@ def test_ssl_config_passed_to_index_client(self):
119110
assert idx._vector_api.api_client.configuration.proxy_headers == proxy_headers
120111

121112
def test_host_config_not_clobbered_by_index(self):
122-
oai_config = OpenApiConfiguration()
123-
oai_config.ssl_ca_cert = "path/to/cert"
124113
proxy_headers = make_headers(proxy_basic_auth="asdf")
125-
oai_config.proxy_headers = proxy_headers
126-
127-
pc = Pinecone(api_key="key", openapi_config=oai_config)
114+
pc = Pinecone(api_key="key", ssl_ca_certs="path/to/cert", proxy_headers=proxy_headers)
128115

129116
assert pc.openapi_config.ssl_ca_cert == "path/to/cert"
130117
assert pc.openapi_config.proxy_headers == proxy_headers

tests/unit/test_control.py

-4
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ def test_list_indexes_returns_iterable(self, mocker, index_list_response):
215215
response = p.list_indexes()
216216
assert [i.name for i in response] == ["index1", "index2", "index3"]
217217

218-
def test_api_key_and_openapi_config(self, mocker):
219-
p = Pinecone(api_key="123", openapi_config=OpenApiConfiguration.get_default_copy())
220-
assert p.config.api_key == "123"
221-
222218

223219
class TestIndexConfig:
224220
def test_default_pool_threads(self):

0 commit comments

Comments
 (0)