Registry / data / rx
library3.2.0pypypi✓ verified 24d ago

Reactive Extensions for Python (RxPY) is a library for composing asynchronous and event-based programs using observable sequences and pipable query operators. It enables developers to represent asynchronous data streams with Observables, query them using a rich set of operators, and manage concurrency with Schedulers. The library (via the 'rx' PyPI package) is currently at version 3.2.0, providing a robust framework for reactive programming in Python.

pip install rx
INSTALL
IMPORT
SIG · RX
R
rx
datapythonv3.2.0
Install
1.7s avg
Import
238ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.254s · 20.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.222s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rx
import rx
import reactivex
The PyPI package `rx` (version 3.x) should be imported as `rx`. The `reactivex` import is for the newer v4+ generation of RxPY, typically installed via `pip install reactivex`.
operators
from rx import operators as ops
Operators are typically imported from the `rx.operators` submodule and aliased as `ops`.

This quickstart demonstrates creating an observable from a simple sequence, applying transformation and filtering operators using the `pipe` method, and subscribing with `on_next`, `on_error`, and `on_completed` handlers. This uses the pipe-based operator chaining introduced in v3.

import rx from rx import operators as ops # Create an observable from a sequence of items source = rx.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon") # Define a pipeline of operators composed = source.pipe( ops.map(lambda s: len(s)), ops.filter(lambda i: i >= 5) ) # Subscribe to the observable to start the data flow and print results composed.subscribe( on_next=lambda value: print(f"Received {value}"), on_error=lambda err: print(f"Error: {err}"), on_completed=lambda: print("Done!") )
Debug
Known issues
breakingThe official RxPY project renamed its main module from `rx` to `reactivex` starting with version 4.x. While `pip install rx` currently provides version 3.x, upgrading to the latest RxPY (installed as `reactivex`) will require changes to import statements.
fix
When migrating to RxPY v4+ (installed via `pip install reactivex`), update your imports from `import rx` to `import reactivex as rx` and `from rx import operators as ops` to `from reactivex import operators as ops`.
affects: 3.x users migrating to 4.x+
breakingIn RxPY v4, the `mapper` function argument was removed from operators that combine values from several observables (e.g., `combine_latest`, `group_join`, `join`, `with_latest_from`, `zip`, `zip_with_iterable`).
fix
Refactor code to apply transformations using separate `map` operators after the combining operation, instead of relying on the `mapper` argument within the combining operator itself.
affects: 3.x users migrating to 4.x+
breakingFor developers creating custom operators using functional composition, the global `rx.pipe` function (used as a helper to compose other operators) was renamed to `reactivex.compose` in version 4.x.
fix
If you defined custom operators using `rx.pipe` (e.g., `def custom_op(): return rx.pipe(ops.map(...))`), change it to `reactivex.compose` when using RxPY v4+ (`import reactivex`).
affects: 3.x users migrating to 4.x+
gotchaWhen using operators with multiple optional arguments, it is highly recommended to use named keyword arguments rather than positional arguments to prevent unexpected behavior due to argument order or future API changes.
fix
Always pass optional arguments to operators using their keyword names (e.g., `observable.pipe(ops.buffer_with_time(buffer_time_span=1.0, buffer_time_reset=0.5))`).
affects: All versions
Errors
Common errors & fixes
AttributeError: 'Observable' object has no attribute 'map'
In RxPY v3, operators like `map`, `filter`, and `flat_map` are not direct methods of the `Observable` object. They must be imported from `rx.operators` and applied using the `pipe()` method.
fix
Use `import rx.operators as ops` and apply operators via `observable.pipe(ops.map(lambda x: x*2))`.
ModuleNotFoundError: No module named 'rx'
The `rx` library has not been installed in the current Python environment.
fix
Install the library using pip: `pip install rx`.
AttributeError: module 'rx' has no attribute 'Observable'
In RxPY v3, the `Observable` class is not directly exposed as `rx.Observable` for public creation, nor is `Subject`.
fix
Use creation functions like `rx.from_([1, 2, 3])`, `rx.just('hello')`, or `rx.create(...)`. For `Subject`, import it explicitly: `from rx.subject import Subject`.
AttributeError: module 'rx' has no attribute 'of'
RxPY uses `rx.just()` for single values and `rx.from_()` for iterables, diverging from `rx.of()` found in some other reactive programming libraries (e.g., RxJS).
fix
Replace `rx.of(1, 2, 3)` with `rx.from_([1, 2, 3])` for multiple items, or `rx.just(value)` for a single item.
Upgrade
Version history
3.2.0latest on PyPI · released Apr 25, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
20
OpenAI (training)
2
Resources
rx — pip install rx · libregistry