Skip to content

Commit 1c9632e

Browse files
committed
WIP on grpc asyncio and query_namespaces method
This commit squashes several previous commits on this branch to address a GitGuardian security check that continues to fail because an early commit contained a leaked development key.
1 parent e665c0d commit 1c9632e

28 files changed

+2141
-241
lines changed

.github/actions/create-index/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ outputs:
3030
index_name:
3131
description: 'The name of the index, including randomized suffix'
3232
value: ${{ steps.create-index.outputs.index_name }}
33+
index_host:
34+
description: 'The host of the index'
35+
value: ${{ steps.create-index.outputs.index_host }}
36+
index_dimension:
37+
description: 'The dimension of the index'
38+
value: ${{ steps.create-index.outputs.index_dimension }}
39+
index_metric:
40+
description: 'The metric of the index'
41+
value: ${{ steps.create-index.outputs.index_metric }}
3342

3443
runs:
3544
using: 'composite'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Test Data Plane'
2+
description: 'Runs tests on the Pinecone data plane'
3+
4+
inputs:
5+
metric:
6+
description: 'The metric of the index'
7+
required: true
8+
dimension:
9+
description: 'The dimension of the index'
10+
required: true
11+
host:
12+
description: 'The host of the index'
13+
required: true
14+
use_grpc:
15+
description: 'Whether to use gRPC or REST'
16+
required: true
17+
freshness_timeout_seconds:
18+
description: 'The number of seconds to wait for the index to become fresh'
19+
required: false
20+
default: '60'
21+
PINECONE_API_KEY:
22+
description: 'The Pinecone API key'
23+
required: true
24+
25+
outputs:
26+
index_name:
27+
description: 'The name of the index, including randomized suffix'
28+
value: ${{ steps.create-index.outputs.index_name }}
29+
30+
runs:
31+
using: 'composite'
32+
steps:
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python_version }}
37+
38+
- name: Setup Poetry
39+
uses: ./.github/actions/setup-poetry
40+
with:
41+
include_grpc: ${{ inputs.use_grpc }}
42+
include_dev: 'true'
43+
44+
- name: Run data plane tests
45+
id: data-plane-tests
46+
shell: bash
47+
run: poetry run pytest tests/integration/data_asyncio
48+
env:
49+
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
50+
USE_GRPC: ${{ inputs.use_grpc }}
51+
METRIC: ${{ inputs.metric }}
52+
INDEX_HOST: ${{ inputs.host }}
53+
DIMENSION: ${{ inputs.dimension }}
54+
SPEC: ${{ inputs.spec }}
55+
FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }}

.github/workflows/alpha-release.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ on:
2424
default: 'rc1'
2525

2626
jobs:
27-
unit-tests:
28-
uses: './.github/workflows/testing-unit.yaml'
29-
secrets: inherit
30-
integration-tests:
31-
uses: './.github/workflows/testing-integration.yaml'
32-
secrets: inherit
33-
dependency-tests:
34-
uses: './.github/workflows/testing-dependency.yaml'
35-
secrets: inherit
27+
# unit-tests:
28+
# uses: './.github/workflows/testing-unit.yaml'
29+
# secrets: inherit
30+
# integration-tests:
31+
# uses: './.github/workflows/testing-integration.yaml'
32+
# secrets: inherit
33+
# dependency-tests:
34+
# uses: './.github/workflows/testing-dependency.yaml'
35+
# secrets: inherit
3636

3737
pypi:
3838
uses: './.github/workflows/publish-to-pypi.yaml'
39-
needs:
40-
- unit-tests
41-
- integration-tests
42-
- dependency-tests
39+
# needs:
40+
# - unit-tests
41+
# - integration-tests
42+
# - dependency-tests
4343
with:
4444
isPrerelease: true
4545
ref: ${{ inputs.ref }}
@@ -49,4 +49,3 @@ jobs:
4949
secrets:
5050
PYPI_USERNAME: __token__
5151
PYPI_PASSWORD: ${{ secrets.PROD_PYPI_PUBLISH_TOKEN }}
52-

.github/workflows/testing-integration.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,64 @@ jobs:
3232
PINECONE_DEBUG_CURL: 'true'
3333
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
3434

35+
data-plane-setup:
36+
name: Create index
37+
runs-on: ubuntu-latest
38+
outputs:
39+
index_name: ${{ steps.setup-index.outputs.index_name }}
40+
index_host: ${{ steps.setup-index.outputs.index_host }}
41+
index_dimension: ${{ steps.setup-index.outputs.index_dimension }}
42+
index_metric: ${{ steps.setup-index.outputs.index_metric }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Create index
46+
id: setup-index
47+
uses: ./.github/actions/create-index
48+
timeout-minutes: 5
49+
with:
50+
dimension: 100
51+
metric: 'cosine'
52+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
53+
54+
55+
test-data-plane-asyncio:
56+
name: Data plane asyncio integration tests
57+
runs-on: ubuntu-latest
58+
needs:
59+
- data-plane-setup
60+
outputs:
61+
index_name: ${{ needs.data-plane-setup.outputs.index_name }}
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
python_version: [3.8, 3.12]
66+
use_grpc: [true]
67+
spec:
68+
- '{ "asyncio": { "environment": "us-east1-gcp" }}'
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: ./.github/actions/test-data-plane-asyncio
72+
with:
73+
python_version: '${{ matrix.python_version }}'
74+
use_grpc: '${{ matrix.use_grpc }}'
75+
metric: '${{ needs.data-plane-setup.outputs.index_metric }}'
76+
dimension: '${{ needs.data-plane-setup.outputs.index_dimension }}'
77+
host: '${{ needs.data-plane-setup.outputs.index_host }}'
78+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
79+
freshness_timeout_seconds: 600
80+
81+
data-plane-asyncio-cleanup:
82+
name: Deps cleanup
83+
runs-on: ubuntu-latest
84+
needs:
85+
- test-data-plane-asyncio
86+
steps:
87+
- uses: actions/checkout@v4
88+
- uses: ./.github/actions/delete-index
89+
with:
90+
index_name: '${{ needs.test-data-plane-asyncio.outputs.index_name }}'
91+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
92+
3593
data-plane-serverless:
3694
name: Data plane serverless integration tests
3795
runs-on: ubuntu-latest

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ venv.bak/
137137
.ropeproject
138138

139139
# pdocs documentation
140-
# We want to exclude any locally generated artifacts, but we rely on
140+
# We want to exclude any locally generated artifacts, but we rely on
141141
# keeping documentation assets in the docs/ folder.
142142
docs/*
143143
!docs/pinecone-python-client-fork.png
@@ -155,4 +155,6 @@ dmypy.json
155155
*.hdf5
156156
*~
157157

158-
tests/integration/proxy_config/logs
158+
tests/integration/proxy_config/logs
159+
*.parquet
160+
app*.py

app.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

app2.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

app3.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

pinecone/control/pinecone.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
import logging
3-
from typing import Optional, Dict, Any, Union, List, Tuple, Literal
3+
from typing import Optional, Dict, Any, Union, Literal
44

55
from .index_host_store import IndexHostStore
66

@@ -10,7 +10,12 @@
1010
from pinecone.core.openapi.shared.api_client import ApiClient
1111

1212

13-
from pinecone.utils import normalize_host, setup_openapi_client, build_plugin_setup_client
13+
from pinecone.utils import (
14+
normalize_host,
15+
setup_openapi_client,
16+
build_plugin_setup_client,
17+
parse_non_empty_args,
18+
)
1419
from pinecone.core.openapi.control.models import (
1520
CreateCollectionRequest,
1621
CreateIndexRequest,
@@ -317,9 +322,6 @@ def create_index(
317322

318323
api_instance = self.index_api
319324

320-
def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
321-
return {arg_name: val for arg_name, val in args if val is not None}
322-
323325
if deletion_protection in ["enabled", "disabled"]:
324326
dp = DeletionProtection(deletion_protection)
325327
else:
@@ -329,7 +331,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
329331
if "serverless" in spec:
330332
index_spec = IndexSpec(serverless=ServerlessSpecModel(**spec["serverless"]))
331333
elif "pod" in spec:
332-
args_dict = _parse_non_empty_args(
334+
args_dict = parse_non_empty_args(
333335
[
334336
("environment", spec["pod"].get("environment")),
335337
("metadata_config", spec["pod"].get("metadata_config")),
@@ -351,7 +353,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
351353
serverless=ServerlessSpecModel(cloud=spec.cloud, region=spec.region)
352354
)
353355
elif isinstance(spec, PodSpec):
354-
args_dict = _parse_non_empty_args(
356+
args_dict = parse_non_empty_args(
355357
[
356358
("replicas", spec.replicas),
357359
("shards", spec.shards),

pinecone/exceptions/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
)
1313
from .exceptions import PineconeConfigurationError, PineconeProtocolError, ListConversionException
1414

15+
PineconeNotFoundException = NotFoundException
16+
1517
__all__ = [
1618
"PineconeConfigurationError",
1719
"PineconeProtocolError",
@@ -22,6 +24,7 @@
2224
"PineconeApiKeyError",
2325
"PineconeApiException",
2426
"NotFoundException",
27+
"PineconeNotFoundException",
2528
"UnauthorizedException",
2629
"ForbiddenException",
2730
"ServiceException",

0 commit comments

Comments
 (0)