Skip to main content

Deserializer for 64 bit Roaring Bitmaps.

Project description

Deserialize 64 bit roaring bitmaps into a Python set of integers. roroaring64 is a lightweight Python binding on top of the CRoaring library.

Note: roroaring64 has only been testing on Linux, so OSX and Windows users, your mileage may vary.

Motivation

brotchie@ built this library to deserialized the 64 bit roaring bitmaps turbo-geth uses in its database model.

API

The roroaring64 module exposes a single method:

def deserialize(serialized: bytes) -> Set[int]:
    ...

deserialize takes the byte representation of a 64 bit roaring bitmap serialized from the Go, Java, or C++ reference roaring bitmap implementations. It returns a Python set of all 64 bit integers contained within the input bitmap.

Example Usage

>>> import roroaring64
>>> hex_bitmap = "0100000000000000000000003a300000010000004700040010000000e64ee84ee94eea4eeb4e"
>>> values = roroaring64.deserialize(bytes.fromhex(hex_bitmap))
>>> print(values)
{4673254, 4673256, 4673257, 4673258, 4673259}

Installation

$ pip install roroaring64

Tests

$ python test.py

Manual Compilation

$ python setup.py build_ext -i

Credits

Thanks to the authors of CRoaring and to ezibenroc@, the author of PyRoaringBitmap, whose project I looked at to work out Cython packaging.

License

MIT License

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

roroaring64-0.1.0.tar.gz (157.7 kB view hashes)

Uploaded Source

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