Skip to main content

The ReactiveX for Python (RxPY)

Build Status Coverage Status PyPY Package Version Documentation Status

A library for composing asynchronous and event-based programs using observable collections and query operator functions in Python

Installation

ReactiveX for Python runs on Python 3.11 or above. To install:

pip3 install reactivex

About ReactiveX

ReactiveX for Python (RxPY) is a library for composing asynchronous and event-based programs using observable sequences and pipable query operators in Python. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize concurrency in data/event streams using Schedulers.

import reactivex as rx
from reactivex import operators as ops

source = rx.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon")

composed = source.pipe(
    ops.map(lambda s: len(s)),
    ops.filter(lambda i: i >= 5)
)
composed.subscribe(lambda value: print("Received {0}".format(value)))

Fluent and Functional Syntax

RxPY supports both fluent (method chaining) and functional (pipe-based) syntax, giving you the flexibility to choose the style that works best for your codebase:

Fluent style - Method chaining for a more Pythonic feel:

import reactivex as rx

result = (rx.of(1, 2, 3, 4, 5)
    .map(lambda x: x * 2)
    .filter(lambda x: x > 5)
    .reduce(lambda acc, x: acc + x, 0)
)
result.subscribe(print)  # Output: 24

Functional style - Pipe-based for functional composition:

import reactivex as rx
from reactivex import operators as ops

result = rx.of(1, 2, 3, 4, 5).pipe(
    ops.map(lambda x: x * 2),
    ops.filter(lambda x: x > 5),
    ops.reduce(lambda acc, x: acc + x, 0)
)
result.subscribe(print)  # Output: 24

Both styles are fully supported and can even be mixed in the same pipeline. Choose the style that best fits your team’s preferences and coding standards.

Learning ReactiveX

Read the documentation to learn the principles of ReactiveX and get the complete reference of the available operators.

If you need to migrate code from RxPY v1.x, v3.x, or v4.x, read the migration section.

There is also a list of third party documentation available here.

Community

Join the conversation on GitHub Discussions! if you have any questions or suggestions.

Differences from .NET and RxJS

ReactiveX for Python is a fairly complete implementation of Rx with more than 150 operators, and over 1300 passing unit-tests. RxPY is mostly a direct port of RxJS, but also borrows a bit from Rx.NET and RxJava in terms of threading and blocking operators.

ReactiveX for Python follows PEP 8, so all function and method names are snake_cased i.e lowercase with words separated by underscores as necessary to improve readability.

Thus .NET code such as:

var group = source.GroupBy(i => i % 3);

need to be written with an _ in Python:

# Functional style
group = source.pipe(ops.group_by(lambda i: i % 3))

# Or fluent style
group = source.group_by(lambda i: i % 3)

With ReactiveX for Python you should use named keyword arguments instead of positional arguments when an operator has multiple optional arguments. RxPY will not try to detect which arguments you are giving to the operator (or not).

Development

This project is managed using uv, with common commands defined in just. Code is formatted using Ruff and statically type checked using pyright.

After cloning the repository, install dependencies with the uv-backed Justfile:

just install

Run unit tests:

just test

Run all formatting, linting, type checks, and tests:

just check

Build the package:

just build

Metadata

Release files for reactivex 6.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reactivex 6.1.1
File Size Uploaded Provenance Actions
reactivex-6.1.1.tar.gz 140.3 kB Without provenance Details for reactivex-6.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reactivex 6.1.1
File Interpreter ABI Platform Actions
reactivex-6.1.1-py3-none-any.whl Python 3 none any Details for reactivex-6.1.1-py3-none-any.whl

Total release size: 401.3 kB

Release files / reactivex-6.1.1.tar.gz

Download URL reactivex-6.1.1.tar.gz
Size 140.3 kB
Tags Source
SHA-256 checksum
How to use checksums
565105732fd6c6bb2eb0ce12f8252da76c3c8529bc65637e8cf5f7c0f12bc07f
BLAKE2b-256 checksum
How to use checksums
5690210e87d54570413d5daccd2b17cdef89819541f16c2b6891c66fdf7a0a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / reactivex-6.1.1-py3-none-any.whl

Download URL reactivex-6.1.1-py3-none-any.whl
Size 261.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f68874c0dc7a597ebd675385c90728576daf96e4d6be8138e7783a0d5013999
BLAKE2b-256 checksum
How to use checksums
532da5678a84dc3dd9d222ea83de88fc0a8ad255f390da0d4e70af9820d198dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for reactivex 6.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page