skillfed

astrapy

A Python client for the Data API on DataStax Astra DB

astrapy v2.3.1 388.1K downloads/30d#7,037 on PyPI39
Permissive license Active released

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 astrapy

uv

uv add astrapy

poetry

poetry add astrapy

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Build Tools

Tags

astra db python clientvector database clientdatastax astra sdkdocument database pythonvector search pythonastra db api wrapperserverless database client
vector-searchserverless-databasedatastax

More Build Tools packages