Skip to main content

Lawliet for Python

An in-memory vector cache that speaks the Redis protocol — bundled as a Python package. The wheel contains the server binary: pip install, start it from Python, talk to it with redis-py. No Docker, no separate download.

pip install lawliet-server

The import name is lawliet. Do not install it next to the unrelated lawliet package on PyPI (a web framework): both provide a lawliet module.

import lawliet
import numpy as np

r = lawliet.start()                       # server on a free port; returns redis.Redis

vec = np.random.rand(384).astype("<f4")   # your embedding model's output
r.execute_command("VCREATE", "docs", "DIM", 384)
r.execute_command("VADD", "docs", "doc:1", "FP32", vec.tobytes(),
                  "TEXT", "Employees get 12 days of paid leave.", "META", '{"source":"hr.md"}')
hits = r.execute_command("VSEARCH", "docs", "FP32", vec.tobytes(),
                         "K", 5, "FILTER", 'source == "hr.md"', "WITHTEXT")

lawliet.stop()                            # or let it stop when Python exits

API

lawliet.start(port=None, **options) -> redis.Redis start one server, return a client
lawliet.stop() stop it (idempotent; also runs at exit)
with lawliet.server(**options) as r: server for the duration of a block
lawliet.Server(port=None, **options) several servers, or full control: .start(), .stop(), .client(**redis_kwargs), .port, with Server() as srv:
lawliet.binary_path() path of the bundled binary

options: host (default 127.0.0.1), data_dir (enable snapshots in this directory), maxmemory (e.g. "512mb"), args (extra server flags, e.g. ["--maxmemory-policy", "allkeys-lru"]), startup_timeout (seconds, default 10).

Without data_dir all data is lost when the server stops — ideal for tests:

# conftest.py
import pytest, lawliet

@pytest.fixture
def vdb():
    with lawliet.server() as r:   # fresh, empty server per test
        yield r

Command line

The package installs a lawliet command that runs the bundled server:

lawliet --port 6380               # same flags as the standalone binary
python -m lawliet --version

Notes

  • Wheels: macOS 12+ (arm64, x86_64), Linux (x86_64, aarch64; glibc and musl), Windows (x86_64).
  • LAWLIET_BINARY=/path/to/lawliet makes the package use another server binary.
  • On Windows stop() kills the process, so no snapshot is written on stop; call SAVE first.
  • There is no authentication: keep the default host="127.0.0.1".

Commands (VSEARCH, VCACHE.*, filters, TTL, eviction), limitations and design: project README · DESIGN.md.

Metadata

Release files for lawliet-server 0.3.0

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 lawliet-server 0.3.0
File Actions
lawliet_server-0.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for lawliet_server-0.3.0-py3-none-win_amd64.whl
lawliet_server-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.1+ x86-64 Details for lawliet_server-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
lawliet_server-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64, Linux glibc 2.17+ ARM64 Details for lawliet_server-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
lawliet_server-0.3.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for lawliet_server-0.3.0-py3-none-macosx_12_0_x86_64.whl
lawliet_server-0.3.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for lawliet_server-0.3.0-py3-none-macosx_12_0_arm64.whl

Total release size: 8.2 MB

Release files / lawliet_server-0.3.0-py3-none-win_amd64.whl

Download URL lawliet_server-0.3.0-py3-none-win_amd64.whl
Size 1.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
db116f7fd1f1d679768f02ddb7f11f22943f8a5839ba90e99b24f16f0546a4c9
BLAKE2b-256 checksum
How to use checksums
aaab165d2b492ec8336ba2350db06f898331f15be77c115049c59cb4d272c718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lawliet_server-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl

Download URL lawliet_server-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
Size 1.7 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
6e4aadb8132a6585fe6f3b4f9d642c5f6b17e1db24641234f78899e2a5f98690
BLAKE2b-256 checksum
How to use checksums
b6cf66fd81f0dbb7054081c490bfc12c28901bd7d1e8839a84f65fce737a368b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lawliet_server-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl

Download URL lawliet_server-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Size 1.5 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1e24fbe2c13eda43de2e1f8006fc09e042cca422bb7eab4de03a3f538f220063
BLAKE2b-256 checksum
How to use checksums
6d06ca98f7d56fdfcb2518bc84e6677feedd6a83fe39c6a998202e1569c053c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lawliet_server-0.3.0-py3-none-macosx_12_0_x86_64.whl

Download URL lawliet_server-0.3.0-py3-none-macosx_12_0_x86_64.whl
Size 1.7 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
7a75b8059da2dfc62a1f8beef8e8031fe612d53751eb8205b65be1a5273dae1c
BLAKE2b-256 checksum
How to use checksums
45e638f61a2461c12a1a13e65fd8483bcde613819052805e437bba8541595c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lawliet_server-0.3.0-py3-none-macosx_12_0_arm64.whl

Download URL lawliet_server-0.3.0-py3-none-macosx_12_0_arm64.whl
Size 1.6 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
3a3e0eea7a6e7f72a09405320811fec01826f64fe293a2504b2a0b5387ca399e
BLAKE2b-256 checksum
How to use checksums
677b805eea94187d792b156025141a96bac03392ae82f4e7866733007ff11ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for lawliet-server 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.3.0 This release

5 release files No 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