Skip to main content

numproto provides numpy arrays to protobuf conversion

Project description


Numproto is a simple python3.6+ library to serialize and deserialize numpy arrays into and from protobuf messages.


You can install NumProto from the PyPI package:

$ pip install numproto


Numproto serializes a numpy array into an NDArray message as specified in ndarray.proto:

syntax = "proto3";

message NDArray {
    bytes ndarray = 1;

This library provides two methods: one for serialization ndarray_to_proto and one for deserialization proto_to_ndarray.

import numpy as np

from numproto import ndarray_to_proto, proto_to_ndarray

nda = np.arange(10)

serialized_nda = ndarray_to_proto(nda)
deserialized_nda = proto_to_ndarray(serialized_nda)

assert np.array_equal(nda, deserialized_nda)


To run the tests first install the numproto package from source in development mode and then run the tests using pytest:

$ git clone
$ cd numproto
$ pip install -e .[dev]

$ pytest

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

numproto-0.1.0.tar.gz (3.6 kB view hashes)

Uploaded source

Built Distribution

numproto-0.1.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded py3

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