Skip to main content

Reactive Extensions (Rx) for Python

Project description

https://img.shields.io/travis/ReactiveX/RxPY.svg https://img.shields.io/coveralls/ReactiveX/RxPY.svg https://img.shields.io/pypi/v/rx.svg Documentation Status

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

RxPY v3.0

This branch is work-in-progress.

FOR V 1.X PLEASE GO TO STABLE BRANCH.

RxPY v3.x runs on Python 3.6 or above. To install RxPY:

pip3 install --pre rx

About ReactiveX

Reactive Extensions for Python (RxPY) is a set of libraries 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 rx
from rx 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)))

Learning RxPY

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

I you need to migrate code from RxPY v1.x, read the migration section.

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

Community

Join the conversation on Slack!

The gracious folks at PySlackers have given us a home in the #rxpy Slack channel. Please join us there for questions, conversations, and all things related to RxPy.

To join, navigate the page above to receive an email invite. After signing up, join us in the #rxpy channel.

Please follow the community guidelines and terms of service.

Differences from .NET and RxJS

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

RxPY follows PEP 8, so all function and method names are 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:

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

With RxPY 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).

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

Rx-3.0.0.tar.gz (103.9 kB view details)

Uploaded Source

Built Distribution

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

Rx-3.0.0-py3-none-any.whl (195.3 kB view details)

Uploaded Python 3

File details

Details for the file Rx-3.0.0.tar.gz.

File metadata

  • Download URL: Rx-3.0.0.tar.gz
  • Upload date:
  • Size: 103.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for Rx-3.0.0.tar.gz
Algorithm Hash digest
SHA256 69e7dc76a4391910972f20316f9ccd4664b9694f21dace5a16519d56869e5d35
MD5 900ccabe9365ff400f78ea0f300dd3c2
BLAKE2b-256 de787e3a55098ede9d0d29037ae807b33a8c2c32ad6be31ac385aabda96fe0ca

See more details on using hashes here.

File details

Details for the file Rx-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: Rx-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 195.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for Rx-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ad01944a6b86ed2ef9f38d785c61d5074c40bbb0d60c72c55aaf6da13af1475
MD5 4c53ae756c11d2ffb845f7961867cecc
BLAKE2b-256 e354fbaa34bd80d3da115f70b399761c60a91bdbad7a329541558e5b1594f636

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