Skip to main content

Pinecone Python SDK

Reason this release was yanked:

troubleshooting release workflow

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",
)

# 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 = 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pinecone-8.2.0rc1-cp310-abi3-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

pinecone-8.2.0rc1-cp310-abi3-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

pinecone-8.2.0rc1-cp310-abi3-macosx_10_12_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: pinecone-8.2.0rc1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.5 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

Hashes for pinecone-8.2.0rc1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 01b245acb280142ff120045cb8e0c3cac511571be426bd7f2500acde4ed032fb
MD5 4162a43d49869f6eb6def268d7ac1722
BLAKE2b-256 7a50399fd69da51933aae5166f2408a3667866f432ee83d4148a0737ea931db2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-win_amd64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4f46d00b5255ae0e3feb69757577fd14d6d3faab2f5b3df27bd25a0d3444e7ab
MD5 620933bd53e9d93ed974b54e58832585
BLAKE2b-256 1c9fcf4d947152e79cd0e5480ed9a47e2cc14429e0ea070af142e8220ed83990

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4f2b2d75ad94800e7dca32dcccdb7b97cd3cf596a15e3a9d0670dfb497b86596
MD5 8c3855b7731240d3e570f952f896cce9
BLAKE2b-256 e38ea64d2cfc3e3cd8d537f1d7a997cca28fb46cd01c3c59cedcff424f8591b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bf12c19a2985463b91d951c20f9422e1ff09de642e266d1800bb01dd6cc62d1
MD5 bb9604c02d351be27c82e7dd2976f270
BLAKE2b-256 9839540df6d55a8f05bd111b4e108027825cc2182b11f56af9f318f8e8ab831b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7fd58f05aa2646c7448e361113eeb158f67c0eef2aff82a74c636d8c2103ecf1
MD5 f3d6e128e43dd26405de47c421fd9af2
BLAKE2b-256 ab6902114d045422675af71fb481642f47872407c9312677722a346eb2550962

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edd32d87091ff8b33458aa4d448466960224996ace1d7b0fd4aac682bcaf2237
MD5 988d4846fe7b2757a8b4215e140f7259
BLAKE2b-256 d87e659d76ce7789bb4fe4a6fd3dd25e2ab924cabfd42b98dbd13cc08785bbf5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinecone-8.2.0rc1-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pinecone-8.2.0rc1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 127f5cf90069cd4edb5c8b43f2322106a91b69718d34945636f530f0e68735ff
MD5 ab932a5a7edd69dcb4326ef3a152eb2d
BLAKE2b-256 c32ce05f22312d4d45841120fa00e82d4df05b9c9886a0993925eb71e9910b78

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinecone-8.2.0rc1-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release-rc.yaml on pinecone-io/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page