astrapy
A Python client for the Data API on DataStax Astra DB
What it is and what it does
AstraPy is a Python client for DataStax Astra DB's Data API, providing a pythonic interface to store, query, and search documents and structured table data. It abstracts the HTTP-based Data API into familiar Python objects and methods, supporting both schemaless document collections and typed table structures with vector indexing.
The library handles vector search natively, including hybrid search combining lexical and vector-based ranking, and supports server-side embedding generation when the backend is configured with a vectorize provider. It wraps httpx for HTTP communication and includes utilities for UUID generation and type hints, making it suitable for applications that need to integrate Astra DB as a backend without managing raw API calls.
Use it for:
- Build semantic search features by storing document embeddings and querying with vector similarity.
- Create RAG (retrieval-augmented generation) pipelines using hybrid search to combine text and vector matching.
- Store and retrieve structured data in typed tables with vector indexes for similarity-based lookups.
- Integrate Astra DB as a serverless vector store in Python applications without managing database infrastructure.
- Perform hybrid search combining keyword matching and semantic similarity in a single operation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
AstraPy is a Python client library for DataStax Astra DB that enables document and table storage, retrieval, and vector search operations through a pythonic API.
Yes. AstraPy is actively maintained, production-stable, has low install friction, carries a permissive license, and provides a clean Python abstraction for Astra DB's Data API. Install it if you are already using Astra DB or evaluating it as a serverless vector database backend. No security vulnerabilities are known.
Install
astrapy on PyPI
pip
pip install astrapyuv
uv add astrapypoetry
poetry add astrapyInstalling astrapy
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with recent releases (36 days since last update) and a stable codebase marked as Production/Stable. Supports current Python versions 3.10 through 3.14.
License in practice
Licensed under Apache Software License (permissive), allowing commercial use and modification with minimal restrictions.
Quickstart
pip install astrapy
from astrapy import DataAPIClient
client = DataAPIClient()
db = client.get_database(
"https://01234567-....apps.astra.datastax.com",
token="AstraCS:..."
)
collection = db.create_collection("my_collection")
collection.insert_one({"text": "example"})
results = collection.find({})
Requires an active Astra DB instance and valid API endpoint and token credentials from astra.datastax.com.
Verify before relying
- Whether server-side embedding providers (e.g., 'example_vendor') are included or require external setup.
- Performance characteristics for large-scale vector searches or bulk operations.
- Specific latency or throughput guarantees for the Data API backend.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — deprecation, h11, httpx, ipython, pymongo, toml, typing-extensions, uuid6 |
| Maintenance | actively maintained — 36 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 388,109/month — #7,037 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: astrapy-2.3.1-py3-none-any.whl
Keywords: Astra, Astra DB, DataStax
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
langchain-astradbIntegrates Astra DB (a serverless vector…
permissive · top 15,000 on PyPI
upstash-vectorPython client for Upstash Vector, a serverless…
permissive · top 15,000 on PyPI
qdrant-clientPython client library for Qdrant vector search…
permissive · top 1,000 on PyPI
cassandra-driverA Python client library for Apache Cassandra…
permissive · top 5,000 on PyPI
astra-assistantsWraps OpenAI's Assistants API as a drop-in…
unclear · top 15,000 on PyPI
pymongo-search-utilsProvides utility functions for vector search…
permissive · top 15,000 on PyPI
ragstack-ai-knowledge-storeStores and retrieves LangChain documents using…
unclear · top 15,000 on PyPI
redisvlRedisVL is a Python client for building AI…
permissive · top 5,000 on PyPI
google-cloud-vectorsearchPython client library for Google Cloud Vector…
permissive · top 5,000 on PyPI
firebolt-sdkFirebolt-sdk provides a Python DB API…
permissive · top 15,000 on PyPI