Skip to main content

A little client/server for applications driven by numpy

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Numpy with Apache Arrow Flight

PyPI version License: MIT CI Coverage Status CodeFactor Created with qCradle Renovate enabled

A Problem

We provide

  • An abstract base class for an Apache flight server
  • A client class to communicate with such servers

The client provides a simple interface for sending NumPy arrays, performing computations, and retrieving results, all while handling the serialization and deserialization automatically in the background using Apache Arrow.

To create a server we expect the user to overload a function performing the calcutation based on a dictionary of numpy arrays.

Features

  • Seamless conversion between NumPy arrays and Arrow Tables
  • Simple interface for data transfer operations
  • Type-safe operations with proper error handling

Installation

You can install this client via

pip install numpy-flight

Usage

Basic Setup

We introduce the Baseclass 'Server':

>>> from flight import Server

>>> class TestServer(Server):
...     def f(self, matrices):
...          self.logger.info(f"{matrices.keys()}")
...          # Simple implementation for testing - just return the input
...          return {key : 2*value for key, value in matrices.items()}

All complexity is hidden in the class 'Server' which is itself a child of the pyarrrow's FlightServerBase class. It is enough to implement the method 'f' which is expecting a dictionary of numpy arrays. It will also return a dictionary of numpy arrays.

The server can be started locally with

>>> server = TestServer.start(host="127.0.0.1", port=5555)

While the server is running we can use a Python client for computations

>>> import numpy as np
>>> from flight import Client

>>> with Client(location="grpc://127.0.0.1:5555") as client:
...     output = client.compute(command="compute", data={"input": np.array([1,2,3])})

>>> print(output["input"])
[2 4 6]

Clients for other languages are thinkable. We shut the server down with

server.shutdown()

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

numpy_flight-0.0.16.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numpy_flight-0.0.16-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file numpy_flight-0.0.16.tar.gz.

File metadata

  • Download URL: numpy_flight-0.0.16.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numpy_flight-0.0.16.tar.gz
Algorithm Hash digest
SHA256 416db61dc8f3c9c03b4298e49954d386fffce13fc3366ccd916c44cc0974c5dd
MD5 455e04e5d4556484254e98f858953748
BLAKE2b-256 ff271a12a96603c71e86c1076ad38b39587a0416a9f833a044ea683da399f775

See more details on using hashes here.

Provenance

The following attestation bundles were made for numpy_flight-0.0.16.tar.gz:

Publisher: release.yml on tschm/numpy-flight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numpy_flight-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: numpy_flight-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numpy_flight-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 c2526d75a520ad9a05d11cdd9b03e93c5e534ff8364cc3522da0bbdf256f12e6
MD5 93a813083d21248f6a46634cbc4ceaed
BLAKE2b-256 ff040783435e1c8a540242ee6d61801160a47225bca56c7578c8bc2745e4d5ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for numpy_flight-0.0.16-py3-none-any.whl:

Publisher: release.yml on tschm/numpy-flight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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