Skip to main content

thunderstrike

Python client for the thunderstrike key-value database: a pool of pipelined TLS 1.3 connections behind a small blocking API.

The wheel carries the compiled client library. Nothing to compile on install, and no dependencies beyond the standard library (it uses ctypes).

Install

pip install thunderstrike

Python 3.8 or newer, on Linux x86-64 / ARM64 (glibc 2.17 or newer) or Windows x86-64. macOS wheels come in a later release.

Quick start

The server speaks TLS 1.3 only. The client needs the CA certificate that issued the server's certificate (docker/tls/ca.crt in the server's kit) and a DNS name that certificate carries (localhost unless the server was set up with other THUNDERSTRIKE_TLS_NAMES).

from thunderstrike import Thunderstrike

with open("ca.crt", "rb") as f:
    ca = f.read()

with Thunderstrike("127.0.0.1:7380",
                   tls_server_name="localhost",
                   tls_ca_pem=ca) as db:
    db.set(b"user:1", b"ada")
    print(db.get(b"user:1"))   # b'ada'
    print(db.get(b"nope"))     # None

Give it one address. The client asks that server for the cluster layout and connects to every core (core c listens on port 7380 + c), so those ports must be reachable too.

tls_server_name is sent as SNI and checked against the certificate, so it is the name the certificate was issued for, not necessarily the host you dial. There is no way to turn verification off.

Operations

Keys and values are bytes. A key is at most 65,535 bytes; an empty value is refused. Keys do not expire: the server does not support expiry, and refuses a set with a non-zero ttl_ms as malformed.

db.set(b"k", b"v")
db.get(b"k")                 # b"v", or None when absent
db.get(b"k", b"fallback")    # a default for a miss
db.exists(b"k")              # True / False
db.append(b"k", b"-more")    # appends (creates if absent); returns the new length
db.delete(b"k")              # True if it was there
db.ping()

# Mapping-style access
db[b"k"] = b"v"
value = db[b"k"]             # raises NotFound on a miss
del db[b"k"]                 # raises NotFound on a miss
b"k" in db                   # exists()

Batches

For more than one key, use the batch calls. They put every request on the wire before waiting for any answer, so n keys cost one round trip instead of n.

db.mset({b"a": b"1", b"b": b"2"})           # or a list of (key, value) pairs
db.mget([b"a", b"b", b"missing"])            # [b"1", b"2", None]
db.mdelete([b"a", b"b", b"missing"])         # [True, True, False]

Threads

One Thunderstrike instance is safe to share across threads, and should be: it is a connection pool. The GIL is released during every call, so a thread waiting on the server does not block the others. The API is blocking; there is no asyncio interface in this release (run calls in a thread pool from async code).

Errors and retries

Every failure raises ThunderstrikeError (or a subclass) with:

  • code: the numeric status (positive from the server, negative from the client).
  • retry_class: whether sending the request again is sound.
  • detail: the specific cause when there is one, e.g. the TLS reason.
retry_class meaning
thunderstrike.RETRY_ALWAYS Busy: the server did not apply it. Retry anything after a short backoff.
thunderstrike.RETRY_IF_IDEMPOTENT A lost connection or a timeout: the outcome is unknown. Repeat get, set, exists and ping only.
thunderstrike.RETRY_NEVER Everything else.

The client has already retried Busy answers (every operation but delete) and dropped connections (idempotent operations) before it raises.

Subclasses: NotFound, Timeout, Disconnected, Closed, Busy, ServerOutOfMemory, StorageExhausted, ServerError, TlsError.

import thunderstrike

try:
    db.set(b"k", b"v")
except thunderstrike.Busy:
    ...  # not applied; safe to try again later
except thunderstrike.ThunderstrikeError as e:
    print(e.code, e.retry_class, e.detail)

Configuration

All keyword-only, all optional except the TLS pair:

option meaning
tls_server_name, tls_ca_pem TLS 1.3: the certificate's name and the CA (PEM, bytes or str). Give both.
tls_client_cert_pem, tls_client_key_pem Client certificate (mTLS), for a server that requires one.
request_timeout_ms Per-request deadline, covering retries. Default 60000; 0 disables it.
connect_timeout_ms Connect and TLS handshake deadline.
connections_per_endpoint TCP connections per server core.
max_inflight Pipeline depth per connection.
max_retries Retries for an idempotent request whose connection dropped.
busy_retries, busy_backoff_ms=(min, max), busy_retry_window_ms Busy retry policy. Defaults 4, (2, 200), 5000.
max_response_bytes Largest response the client will accept.
tcp_keepalive_ms, tcp_nodelay Socket options.
min_io_threads, max_io_threads Bounds on the client's I/O threads.

db.stats() returns pool counters (connections, requests, bytes, reconnects). db.endpoints() is the number of server cores connected, db.shards() the number of shards.

The library loads from inside the package. To use another build, set THUNDERSTRIKE_CLIENT_LIB to its path.

License

Proprietary, free to use: see the LICENSE file shipped in the package. You may build this library into your own applications and ship it as part of them.

Copyright (c) 2026 SHORTSQUEEZE PRIVATE LIMITED.

Metadata

Release files for thunderstrike 0.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for thunderstrike 0.1.1
File Interpreter ABI Platform Actions
thunderstrike-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for thunderstrike-0.1.1-py3-none-win_amd64.whl
thunderstrike-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for thunderstrike-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
thunderstrike-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for thunderstrike-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Total release size: 1.8 MB

Release files / thunderstrike-0.1.1-py3-none-win_amd64.whl

Download URL thunderstrike-0.1.1-py3-none-win_amd64.whl
Size 543.2 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
252db921979593179c814659d672bb9bcbb7d524524d9c92d0a5ceb9e0071e57
BLAKE2b-256 checksum
How to use checksums
78384ec255f5ef8c46f58423ca722b1a1aec99f43fe93a0450ecead7ba34909e
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 28, 2026.

Transparency log

Release files / thunderstrike-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL thunderstrike-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 615.0 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
783fb341fce8b579ad39f7506ab7acb2d6f1537ae61853bacb1e51965a4e8da7
BLAKE2b-256 checksum
How to use checksums
5682685b190e8b560cc583d849e9ee0fb05bc8ad0fb7fa991582d3a471ff4ac4
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 28, 2026.

Transparency log

Release files / thunderstrike-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL thunderstrike-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 593.8 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
26ca773680879b25112e4fb75c238ca4ce4ef3d1d347054dd8ee5c07a8cc5e2e
BLAKE2b-256 checksum
How to use checksums
6fee7d458a1540cc421a4ad466a4654f28713c7ee57e9b72b412c1bfcf180ce7
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 28, 2026.

Transparency log

Security for thunderstrike 0.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 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for thunderstrike-0.1.1-py3-none-win_amd64.whl

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 28, 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.

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