Skip to main content

Typesense Python Client

Python client for the Typesense API: https://github.com/typesense/typesense

Installation

$ pip install typesense

You can also add typesense to your project's requirements.txt.

Usage

You can find some examples here.

See detailed API documentation.

Async usage

Use AsyncClient when working in an async runtime:

import asyncio
import typesense


async def main() -> None:
    client = typesense.AsyncClient({
        "api_key": "abcd",
        "nodes": [{"host": "localhost", "port": "8108", "protocol": "http"}],
        "connection_timeout_seconds": 2,
    })

    print(await client.collections.retrieve())
    await client.api_call.aclose()


if __name__ == "__main__":
    asyncio.run(main())

See examples/async_collection_operations.py for a fuller async walkthrough.

Using httpx2

The client sends requests with httpx by default. On Python 3.10+ you can pass an httpx2 client instead. httpx2 is Pydantic's maintained continuation of httpx, and it fixes a connection pool leak in httpcore (encode/httpcore#1093) that can leave an AsyncClient failing every request with PoolTimeout under load.

$ pip install "typesense[httpx2]"
import httpx2
import typesense

http_client = httpx2.AsyncClient(
    timeout=httpx2.Timeout(2.0),
    limits=httpx2.Limits(max_connections=100, max_keepalive_connections=20),
)
client = typesense.AsyncClient(
    {
        "api_key": "abcd",
        "nodes": [{"host": "localhost", "port": "8108", "protocol": "http"}],
    },
    http_client=http_client,
)

typesense.Client takes an httpx2.Client the same way. The connection pool settings in the config (pool_timeout_seconds, max_connections, max_keepalive_connections) only apply to the default client, so set them on your own client instead. The Typesense client does not close a client you pass in.

Compatibility

Typesense Server typesense-python
>= v30.0 >= v2.0.0
>= v28.0 >= v1.0.0
>= v26.0 >= v0.20.0
>= v0.25.0 >= v0.16.0
>= v0.23.0 >= v0.14.0
>= v0.21.0 >= v0.13.0
>= v0.20.0 >= v0.11.0
>= v0.19.0 >= v0.10.0
>= v0.17.0 >= v0.9.0
>= v0.16.0 >= v0.8.0
>= v0.15.0 >= v0.7.0

Contributing

Bug reports and pull requests are welcome on GitHub at [https://github.com/typesense/typesense-python]. If you change any part of the client's source code, run uv run utils/run-unasync.py before opening a PR to keep the generated sync files in sync.

License

typesense-python is distributed under the Apache 2 license.

Metadata

Release files for typesense 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typesense 2.1.1
File Size Uploaded Provenance
typesense-2.1.1.tar.gz 97.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for typesense 2.1.1
File Interpreter ABI Platform
typesense-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 257.9 kB

Release files / typesense-2.1.1.tar.gz

Download URL typesense-2.1.1.tar.gz
Size 97.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5d1fded865ecf9a9e564a4e6b8aa9229c34287e958dc3b16eec408376d142a42
BLAKE2b-256 checksum
How to use checksums
5c255e582ea98ffe6df71e9db8c4288a9bc9179efbace1d49a371e716ffd93f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / typesense-2.1.1-py3-none-any.whl

Download URL typesense-2.1.1-py3-none-any.whl
Size 160.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e37f799be67cc3a948ac756826e0c2451882a61d37d4da6235a4a80c2436afd6
BLAKE2b-256 checksum
How to use checksums
3822d848100d45976e612865251f89607d941199003d24a622b8afc5b9503b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for typesense 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for typesense-2.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page