Skip to main content

No project description provided

Project description

pyvector-rs

An experiment to integrate the power of Vector with Python!

Sending messages reliably can be quite hard

Even with something simple like SQS, when sending a batch of messages individual messages can fail while the rest succeed. So you need to detect this (and other errors), keep them in memory, and retry them with some kind of backoff. But what if your process is asked to exist before these have been sent successfully? What do you do? And how do you handle a large spike in send failures? You don't want messages to pile up and exhaust your memory, which would result in you loosing all your messages. So you need some kind of disk buffer. And you need metrics around this, and logging, and the rest.

If you squint a bit, this begins to look a lot like Vector.

What does this do?

This library integrates Vector with Python (without using an external process) and provides a custom python source that allows you to send Python bytes to Vector with minimal copying.

You can then use any of the many available sinks to forward this data anywhere, with Vector handling all the complexities around batching, buffering to disk or memory, retries, rate-limiting, partitioning, authentication, backpressure and more.

The code below sends 1 million events to a SQS queue, a S3 bucket and an Elasticsearch cluster:

import uuid
import pyvector
import asyncio
import json

# Vector config: https://vector.dev/docs/reference/configuration/
config = """
[sources.python]
type = "python"

[sinks.s3]
type = "aws_s3"
inputs = ["python"]
bucket = "my-bucket"

[sinks.sqs]
type = "aws_sqs"
inputs = ["python"]
queue_url = "..."

[sinks.elasticsearch]
type = "elasticsearch"
inputs = ["python"]
endpoints = ["..."]
"""

async def send_to_vector():
    vector = pyvector.Vector(config)
    await vector.start()

    for i in range(1_000_000):
        data = json.dumps({"i": i, "uuid": str(uuid.uuid4())}).encode()
        await vector.send(source="python", data=data)
    
    await vector.stop()

asyncio.run(send_to_vector())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvector_rs-0.1.0.tar.gz (55.2 kB view details)

Uploaded Source

Built Distributions

pyvector_rs-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (58.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

pyvector_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (18.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyvector_rs-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (58.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

pyvector_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (18.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyvector_rs-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (58.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

pyvector_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (18.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyvector_rs-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl (58.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

pyvector_rs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (18.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file pyvector_rs-0.1.0.tar.gz.

File metadata

  • Download URL: pyvector_rs-0.1.0.tar.gz
  • Upload date:
  • Size: 55.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pyvector_rs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ffaa1107a92e197750ff0c1635b6c464193c0279e5c974258a5dc35e4b546c91
MD5 cff0216818867c67fbee5c51b8506aa1
BLAKE2b-256 91035a9bdd77be7dea774f1058ae5375c1d1940428dc1e515ce3887d2dc3b5dd

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f853ae41efd35edc32c0e871c1b72dc40b8528a0bdc67bdd3d03db70c22ad58a
MD5 d2a2cc413c8e1e0deafce7b3aaeac490
BLAKE2b-256 e4afc3dda92a4a934f29edb817e2d83ef778903716b879474e46b7b90edba6b8

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9db2f4211631d96f188cb3cd6be41f721ad5b963bb1915c4f52229cb257f8132
MD5 59998be1b53771a39593d9dfa57cfa87
BLAKE2b-256 7b21bea139043b6f8ae622501a9ef5fe128d4b1bc559a10170a289465645bc0b

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a924fa6c4c32341f087b63d3c0f9ef1d25a7f3ded020e3a105ae55ce5fc114b2
MD5 959d5ee547f6c6d6fe0617746108b6be
BLAKE2b-256 c1bd6e4f086f095d4b2f2ba5a7f208e45fb204c8767063df90bacb6ce4171888

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 976cbd6d745b3aef9b49cfa15a9321f64cf5895b38252e7d0f9b791d680eaed5
MD5 b6dba0bb3188538c5d449b82da9e69bb
BLAKE2b-256 7ce5c8183272760cefdc19e1409f9a60e2d0564ebb355665407b9dd3142c154c

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 37b5d47d0d41c8fc748a59e1f713b3e5a9a3505abb595badbaeb47a7e679f5df
MD5 05dc9724589e6a496d38caacf1c6bd9b
BLAKE2b-256 a13d277f72f5f9ed7319bc626687a76fe4a4a9b201d8154fc9ffb268026c8ded

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6e2d51f96774805434f2ff1307503b8134e90a70680badf2bfc247af89231bf
MD5 abf10e16c7f7e5fd548990f7d788f5c7
BLAKE2b-256 35c4f6758a2c52df8cb9da067770fbb221ddcf677cb4cf6bee876e2ab138f10a

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2fc3810f79ab6895ca685cf590642e2c8dc79c8dc619933726a416b1e0f7bd6
MD5 45c57c39d293b29c6e8cfbcda64cf904
BLAKE2b-256 85b4f39de2ce87608a42471e49ba9fe606862048cc33dcba21bfd0bf9094136d

See more details on using hashes here.

File details

Details for the file pyvector_rs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvector_rs-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e9318f2a74f908b2c2014fce4438f1159d7eac5f58aee3e1daedbb29ef08ef8
MD5 f880b577ee3485ef291cc823f4247f0e
BLAKE2b-256 bcd4fea5fd16cc8ed23e04be31d74216c3db673907f8eb3d005f9cb74346c484

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page