In RxPY 3.0 you can use the following construction:
res = rx.generate(0, lambda x: True, lambda x: x + 1).pipe(
ops.map(lambda x: rx.timer(random.random() * 0.4).pipe(ops.map(lambda y: x))),
ops.merge(max_concurrent=1),
ops.map(lambda x: {'count': x, 'value': random.randint(0, 5)}))
This produces an infinite stream of random integers between 0 and 5 at random times with interarrival time uniformly distributed on [0, 0.4].
In RxPY 3.0, operations like switchmap or concatmap are not implemented (as in @olsn's reply). The concat_all operation can be achieved by merge with max_concurrent=1.
Edit:
rx.generate(0, lambda x: True, lambda x: x + 1)
is blocking. Using an infinite vanilla python generator such as
import itertools
r = rx.from_iterable(_ for _ in itertools.count(start=0, step=1))
is also blocking. You can add some scheduler e.g.
from rx.scheduler.eventloop import AsyncIOScheduler
from rx.scheduler import ThreadPoolScheduler
import multiprocessing
scheduler = AsyncIOScheduler(asyncio.get_event_loop())
# scheduler = ThreadPoolScheduler(multiprocessing.cpu_count()) # alternatively
res = rx.generate(0, lambda x: True, lambda x: x + 1).pipe(
ops.map(lambda x: rx.timer(random.random() * 0.4).pipe(ops.map(lambda y: x))),
ops.merge(max_concurrent=1),
ops.map(lambda x: {'count': x, 'value': random.randint(0, 5)}),
ops.subscribe_on(scheduler)
)