Questions tagged [rx-py]

Reactive Extensions for Python

RxPY is a library for composing asynchronous and event-based programs using observable collections and LINQ-style query operators in Python.

RxPY is open sourced and available under the Apache License, Version 2.0

96 questions
0
votes
1 answer

subscribe not work after upgrading RxPy from 1.x to 3.x

I am using Python 3.7.3. I try to upgrade RxPy from 1.6.1 (1.x) to 3.0.0a3 (3.x). Old code using RxPy 1.x from rx import Observable import psutil import numpy as np import pylab as plt cpu_data = (Observable .interval(100) # Each 100…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
0
votes
1 answer

How can I save data in ReactiveX

I'm new to ReactiveX and I have a question. How can I save data in ReactiveX. For example. I have this code. last_price = market_data_service.get_last_price("IBM") difference = previous_last_price - last_price For its correct work, I need to know…
user45245
  • 845
  • 1
  • 8
  • 18
0
votes
2 answers

How to monitor the execution of a series of functions? Maybe RxPy?

I have a list of functions that I want to execute, like in a pipeline. pipeline = [f1, f2, f3, f4] (Basically I compose the functions on the list see: https://mathieularose.com/function-composition-in-python/): def run(pipeline): return…
nanounanue
  • 7,942
  • 7
  • 41
  • 73
0
votes
0 answers

RxPy: How to convert stream of sets of elements into a stream of single elements

I have two pieces of code s.t. - one produces stream of sets of active alerts in the system. - second consumes events of raise/fall of an alert. assuming the first part produces the following stream ["a", "b"], ["c"], ["e", "f", "g"], I want to push…
0
votes
1 answer

RX stream of start and stop events with late subscription

I'm trying to make a subject of start and stop events where late subscribers only receive the outstanding start events. ie. those that haven't had a corresponding stop event. Here's some RxPY code: from rx.subjects import ReplaySubject start =…
MarkNS
  • 3,811
  • 2
  • 43
  • 60
0
votes
1 answer

Void/Unit type for calling the on_next function with no arguments

I feel like I might be missing something very obvious here, but anyway... When using RxPY, is there an equivalent of the C# RX System.Reactive.Unit type for calling the on_next function with no arguments? from rx import Observable source =…
MarkNS
  • 3,811
  • 2
  • 43
  • 60
0
votes
0 answers

Why does this list of different RxPY observables always emit the same thing?

Using a list comprehension I have created a list of 10 different observables. However they always print the same things ("ticker_9") despite their timings being different. from __future__ import print_function from rx import Observable import…
Thomas Browne
  • 23,824
  • 32
  • 78
  • 121
0
votes
1 answer

How to use RxPY (or RxJS) combine_latest with a group_by observable

In ReactiveX I can take the latest value out of each of a number of observables, which each may or may not be emitting at different frequencies, as follows (using RxPY): from __future__ import print_function from rx import Observable import…
Thomas Browne
  • 23,824
  • 32
  • 78
  • 121
0
votes
1 answer

Batching Results from ReactiveX Observable

Say I have an observable that looks like this (this is Python, but should be general to all languages): rx.Observable.from_iterable([[1],[],[2],[3],[],[],[4],[5,6],[7],[8,9],[10]]) I want to ultimately be able to batch the Integers into lists of…
rumdrums
  • 1,322
  • 2
  • 11
  • 25
0
votes
2 answers

reactive programming store result in a variable

quick (trivial) question: I cannot find a way to store the output of a series of operation on an observable in an external variable. For instance something like that: mylist = [] Observable.from_([1, 2, 3]).to_list().store(mylist) Not sure this is…
Charlie
  • 1,750
  • 15
  • 20
0
votes
1 answer

Rx: get first item, but throw exception when the second item arrives

Using Rx observable stream, is there an effective way to get the first item, complete the source observable, but throw an exception if the second item arrives? Sounds like not a good situation to use Rx for, but is there a clever way to handle it?
Jaewan Kim
  • 45
  • 5
0
votes
1 answer

How to properly recombine grouped observables?

I'm trying to create a tool for analysing stock prices. I've got a stream of price data for different stocks, and I want to have an observable to emit events whenever it receives a new, distinct and complete set of prices. My plan: grouping the…
0
votes
1 answer

rxpy inject items into observable

This question is regarding rxpy. I am trying to build a reactive system that handles messages from a source observable. In addition to that, I am trying to integrate it with a leader election system based on zookeeper. This combination will allow…
Jaewan Kim
  • 45
  • 5
0
votes
0 answers

Is there Intellisense / auto-complete in VisualStudio for the Reactive Extension rx.py?

I'm Visual Studio and I've started a new Python project in a Python 3 environment. Rx has been pip installed and I have the following code from rx import Observable xs = Observable.range(1, 10) q = xs.where(lambda x: x % 2 ==0).select(lambda x:…
Robino
  • 4,530
  • 3
  • 37
  • 40
0
votes
1 answer

RxPY - How to use stop_and_wait?

I tried to translate the following JavaScript code example in Python: import Rx from "rx" let source = Rx.Observable.interval(1000) .timestamp() .controlled(); source.stopAndWait().subscribe( (result) => console.log("onNext: ", result), …