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 Created with qCradle

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 tschm.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 tschm.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.11.tar.gz (7.7 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.11-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for numpy_flight-0.0.11.tar.gz
Algorithm Hash digest
SHA256 72026b4237301ddf5c58d697377901b46703491d7acca4eeef2a908909d0782d
MD5 bb67ccf32fbe4221e9a1465cb9ca1494
BLAKE2b-256 da823b6782f23ee2be3c72e8183746008c0a16dc0c785b9387dc438465383d71

See more details on using hashes here.

Provenance

The following attestation bundles were made for numpy_flight-0.0.11.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.11-py3-none-any.whl.

File metadata

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

File hashes

Hashes for numpy_flight-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 4e1d21544c40d5cc5626ac4c11197b4294abb9c198cbbf6e02a11305c3ad429e
MD5 04bfa22b99a1dfe681b5afc5bd680e26
BLAKE2b-256 79d373fcb8fe1553ff45c96e2ebb70a02d573b51933afecb08367ad39734e393

See more details on using hashes here.

Provenance

The following attestation bundles were made for numpy_flight-0.0.11-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