Skip to main content

Provides the interfaces of writing Python User Defined Functions and Sinks for NumaFlow.

Reason this release was yanked:

There is a breaking change in Sourcer abstract method compare to previous 0.12.x versions

Project description

Python SDK for Numaflow

Build black License Release Version

pynumaflow is the Python SDK for Numaflow, a Kubernetes-native stream processing framework. Write a Python function, wire it to a server class, and Numaflow handles the gRPC transport, autoscaling, and deployment — no boilerplate required. The SDK supports synchronous and asynchronous execution models, and both function-based and class-based handler styles.

Installation

pip install pynumaflow
Build & develop locally

This project uses uv for dependency management and packaging. To build the package locally, run the following command from the root of the project.

make setup

To run unit tests:

make test

To format code style using black and ruff:

make lint

Setup pre-commit hooks:

pre-commit install

Capabilities

The SDK covers the full range of Numaflow extension points. Each capability maps to a dedicated set of server classes and handler interfaces.

[!TIP] Each capability below links to working examples in both function-based and class-based handler styles. See the full examples directory for all implementations.

Description API Reference
User-Defined Functions (UDFs) Process and transform stream data — Map, Reduce, Reduce Stream, Map Stream, Batch Map, Accumulator Map · Reduce · Reduce Stream · Map Stream · Batch Map · Accumulator
User-Defined Sources (UDSource) Ingest data from custom sources with read, ack, pending, and partition handlers Sourcer · Source Transform
User-Defined Sinks (UDSink) Deliver data to custom destinations with per-message acknowledgment Sinker
Side Inputs Broadcast slow-changing reference data to UDF vertices without passing it through the pipeline Side Input

Choosing Your Server Type

Each functionality is served by a dedicated server class. Choose the server type that matches your workload characteristics:

Sync Async
Concurrency Model Multithreaded asyncio event loop
Handler Signature def handler(...) async def handler(...)
GIL Behaviour Subject to GIL Subject to GIL
Typical Workloads Stateless transforms I/O-bound operations

Server Class Reference

Functionality Server Class(es)
UDSource SourceAsyncServer
UDSink SinkServer, SinkAsyncServer
Side Input SideInputServer
Map MapServer, MapAsyncServer
Reduce ReduceAsyncServer
Reduce Stream ReduceStreamAsyncServer
Map Stream MapStreamAsyncServer
Batch Map BatchMapAsyncServer
Accumulator AccumulatorAsyncServer
Source Transform SourceTransformServer, SourceTransformAsyncServer

All server types accept handlers in two styles:

  • Function-based — pass a plain def or async def directly to the server. Best for simple, stateless logic.
  • Class-based — inherit from the corresponding base class (e.g., Mapper, Reducer, Sinker) and implement the handler method. Useful when your handler needs initialization arguments, internal state, or helper methods.

The linked examples above demonstrate both styles for each functionality.

Contributing

For SDK development workflow, testing against a live pipeline, and adding new examples, see the Developer Guide. For general contribution guidelines, see the Numaproj Contributing Guide.

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

pynumaflow-0.12.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

pynumaflow-0.12.2-py3-none-any.whl (172.4 kB view details)

Uploaded Python 3

File details

Details for the file pynumaflow-0.12.2.tar.gz.

File metadata

  • Download URL: pynumaflow-0.12.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pynumaflow-0.12.2.tar.gz
Algorithm Hash digest
SHA256 68af437040cd4d354efeb079663e5ac0999e3005177641b5e529eb9ffc239760
MD5 01a6f720a769841472cdd8ee26ee0620
BLAKE2b-256 150d891f38fbf0c412b99f7a6f23c12902b9b2092797504a3628f89a21bdce47

See more details on using hashes here.

File details

Details for the file pynumaflow-0.12.2-py3-none-any.whl.

File metadata

  • Download URL: pynumaflow-0.12.2-py3-none-any.whl
  • Upload date:
  • Size: 172.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pynumaflow-0.12.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c792b340531cb86f89fa674f0fbc01cabda642a18d19102cfbc8ab27024f8d70
MD5 ccd8b06c9721f8c1e5fbc5831cad6587
BLAKE2b-256 781c288bcdcc1b1ae40c1ef1ed024d8311ba906cdca10601deef43256a65a901

See more details on using hashes here.

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