Pinecone Python SDK
Project description
Pinecone Python SDK
The Pinecone Python SDK provides a client for the Pinecone vector database. Use it to create and manage indexes, upsert and query vectors, and run inference operations from Python.
Requires Python 3.10+.
Installation
pip install pinecone
For development dependencies (testing, type checking, linting):
pip install pinecone[dev]
Quick start
from pinecone import Pinecone, ServerlessSpec
# Initialize the client
pc = Pinecone(api_key="your-api-key")
# Create a serverless index
pc.indexes.create(
name="movie-recommendations",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1"),
)
# Connect to the index
index = pc.index("movie-recommendations")
# Upsert vectors
index.upsert(
vectors=[
("movie-42", [0.012, -0.087, 0.153]), # 1536-dim embedding
("movie-87", [0.045, 0.021, -0.064]), # 1536-dim embedding
],
namespace="movies-en",
batch_size=100, # split larger inputs into parallel batches automatically
)
# Query for similar vectors
results = index.query(
vector=[0.012, -0.087, 0.153], # 1536-dim embedding
top_k=10,
namespace="movies-en",
)
for match in results.matches:
print(f"{match.id}: {match.score:.4f}")
Async usage
The SDK provides an async client for use with asyncio:
import asyncio
from pinecone import AsyncPinecone
async def main():
async with AsyncPinecone(api_key="your-api-key") as pc:
desc = await pc.indexes.describe("movie-recommendations")
index = await pc.index(host=desc.host)
async with index:
results = await index.query(
vector=[0.012, -0.087, 0.153], # 1536-dim vector
top_k=10,
namespace="movies-en",
)
for match in results.matches:
print(f"{match.id}: {match.score:.4f}")
asyncio.run(main())
Configuration
API key
Pass the API key directly or set the PINECONE_API_KEY environment variable:
from pinecone import Pinecone
# Explicit API key
pc = Pinecone(api_key="your-api-key")
# From environment variable (PINECONE_API_KEY)
pc = Pinecone()
Custom host
Connect to a specific control plane host:
pc = Pinecone(api_key="your-api-key", host="https://api.pinecone.io")
Timeout
Configure request timeouts in seconds:
pc = Pinecone(api_key="your-api-key", timeout=30)
Debug logging
Enable debug logging by setting the PINECONE_DEBUG environment variable:
export PINECONE_DEBUG=1
Development
Setup
Clone the repository and install dependencies with uv:
uv sync
Tests
uv run pytest tests/unit/ -x -v
Type checking
uv run mypy --strict pinecone/
Linting and formatting
uv run ruff check --fix
uv run ruff format
License
Apache-2.0. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinecone-9.0.0.tar.gz.
File metadata
- Download URL: pinecone-9.0.0.tar.gz
- Upload date:
- Size: 255.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e485df8cdff65e8fdb22fc71a32b4c14dcfc7fb0f12428400a03537634b82f5
|
|
| MD5 |
5609fd11bcd4371a430dcfd4b9090558
|
|
| BLAKE2b-256 |
74510de80e2a60897e0cfea95c69fcf3b7b8d62774cd47e52bfffb076823e5dc
|
Provenance
The following attestation bundles were made for pinecone-9.0.0.tar.gz:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0.tar.gz -
Subject digest:
1e485df8cdff65e8fdb22fc71a32b4c14dcfc7fb0f12428400a03537634b82f5 - Sigstore transparency entry: 1437261132
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c20be1c965820b0a7264d9a1ac1bf9d10f5d2d195c66fd147afc4fa11da53459
|
|
| MD5 |
8477c6f10046c0b5d06d05fee9a5e458
|
|
| BLAKE2b-256 |
125e476f477ba6538eb2fb17438a899fa02cc3a8bdc500df47c262b84b0302b5
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-win_amd64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-win_amd64.whl -
Subject digest:
c20be1c965820b0a7264d9a1ac1bf9d10f5d2d195c66fd147afc4fa11da53459 - Sigstore transparency entry: 1437261255
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff8aedc152eac454246e0f53dd9f05883d1f552c7a624919662fba257cd23aed
|
|
| MD5 |
4dc6bb85cfc333351a42a38253a3c1a1
|
|
| BLAKE2b-256 |
f037d5525bbd5adaa4c3af34a6e20a2f5738c39951dcf92952c6b56d253656a8
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
ff8aedc152eac454246e0f53dd9f05883d1f552c7a624919662fba257cd23aed - Sigstore transparency entry: 1437261148
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee2de0cfb75be7e0d4ce7e3a5a60f68ba6e55850b60be7bbbd29124d978b25e3
|
|
| MD5 |
ad557da2c8889b5e19142108a4e4d6df
|
|
| BLAKE2b-256 |
7025659141f575b448dc632007b7bf618640dc3bb7209a756048fe17e7973e8d
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
ee2de0cfb75be7e0d4ce7e3a5a60f68ba6e55850b60be7bbbd29124d978b25e3 - Sigstore transparency entry: 1437261238
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e630b14dab622eb4df478bec82abd7fe4d989e59f26f857e7a51a9fd91e587d9
|
|
| MD5 |
25d354901e307659037a176f62daad3c
|
|
| BLAKE2b-256 |
c37a4d6bfb3166e0ae3ad50f79bbcced9f0b8d3c992eeae17c061522eafdccc7
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
e630b14dab622eb4df478bec82abd7fe4d989e59f26f857e7a51a9fd91e587d9 - Sigstore transparency entry: 1437261194
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53647e1ac3c89086b04fe367152bcf03d8c4a96010e84b79dc01dfaf222e8782
|
|
| MD5 |
d761db66bf1610eeb54f1b152040f097
|
|
| BLAKE2b-256 |
036e3639f92b128844c32759b4762bc25c44366b0d19f05ba152a362ac99f1f8
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
53647e1ac3c89086b04fe367152bcf03d8c4a96010e84b79dc01dfaf222e8782 - Sigstore transparency entry: 1437261213
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd00bf0476d84847a6886ef491c764b290e21efb097914bae8b1d064529be279
|
|
| MD5 |
4c84bb901d8850cf7f0616e09204f69a
|
|
| BLAKE2b-256 |
ad559eade9a4d6b0071a555980f50ecc7694c3fb9beba37c0eb959e65068782f
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
bd00bf0476d84847a6886ef491c764b290e21efb097914bae8b1d064529be279 - Sigstore transparency entry: 1437261173
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pinecone-9.0.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pinecone-9.0.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7248ae78125b70d71e7da161441aed3eefc0741ff2baebcac3c3411fde607a56
|
|
| MD5 |
7813c78079d04ca35c00f7b9dc34f83b
|
|
| BLAKE2b-256 |
10d8fc7c16f6c4bbb6333da9702b1fc20fecc4ad519a56b9d2eb3d6876e9a95a
|
Provenance
The following attestation bundles were made for pinecone-9.0.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-prod.yaml on pinecone-io/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pinecone-9.0.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
7248ae78125b70d71e7da161441aed3eefc0741ff2baebcac3c3411fde607a56 - Sigstore transparency entry: 1437261159
- Sigstore integration time:
-
Permalink:
pinecone-io/python-sdk@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pinecone-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-prod.yaml@6e201eb3a5a4f1596ccaf98c939aaa98fba356e2 -
Trigger Event:
workflow_dispatch
-
Statement type: