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.10.tar.gz (7.6 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.10-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: numpy_flight-0.0.10.tar.gz
  • Upload date:
  • Size: 7.6 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.10.tar.gz
Algorithm Hash digest
SHA256 828d396be87a86ba0505522bf1684f044f9d412e2d095fa858f48578c960bc62
MD5 7efe5ffd0d70363f47451dfe08c8f0d9
BLAKE2b-256 9c99fd1041f1434fabd476b158a98635068ae91e5035b453a3f7cf3a8b9a4df7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: numpy_flight-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 7.9 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 3bccf0044b50b42dcab8d28c586dda1de17d1eb1f746c43e62fcf67c9a32d773
MD5 198110a63985346900bb7d83b4c07849
BLAKE2b-256 5106eae9f5f0cd99d413c97f65e694c409d7784f894efcec43dc9a35fee0b516

See more details on using hashes here.

Provenance

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