-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxPY v3 Remaining Work #285
Comments
About Disposables, I must say that I'm really confused and don't understand quite well what is the rxjs way. subscription = source.subscribe()
subscription.unsubscribe() was the same as: disposable = source.subscribe()
disposable.dispose() With your proposal, would we still be able to 'dispose' in the sense of "hey, I don't need your data anymore"? |
Yes, want to keep disposables even if they are just an object wrapping of a function that takes nothing and returns nothing They are extremely useful for controlling the life-time of resources such as subscriptions. But we should remove the static disposable with methods and replace with create functions e.g. from rx.core import Disposable
Disposable.empty() Similar to what we have done for static create of Observables, e.g |
Thank you very much for your insight ! |
Just to make a small review about the removing of result_mapper:
There are still operators with a result_mapper that could be removed (in addition to
|
For def for_in(values, mapper) -> Observable:
"""Concatenates the observable sequences obtained by running the
specified result mapper for each element in source.
Args:
values: A list of values to turn into an observable sequence.
mapper: A function to apply to each item in the values
list to turn it into an observable sequence.
Returns:
An observable sequence from the concatenated observable
sequences.
"""
return concat(map(mapper, values)) I have removed the impl. file since it's so simple to construct and just added it to the |
Makes sense. But also: I notice that all the top-level schedulers (not within What is the purpose of these? If it is only for the unit-tests, can I suggest to remove them? |
Several operators needs a default scheduler and will use the the singleton schedulers if no scheduler is supplied (
If I remember correctly, only the |
All right, thanks for clearing that up! |
I've just checked in rxjs but I'm not familiar with javascript. For export function merge<T, R>(...observables: Array<ObservableInput<any> | SchedulerLike | number>): Observable<R> So they have a specific export type ObservableInput<T> = SubscribableOrPromise<T> | ArrayLike<T> | Iterable<T>; Don't know if it can help. |
Latest RxPY v3 and pipelining works like a charm with Coconut. |
I've digged into marbles to fix it but I think we need a complete rework. What I would like is to make it compliant with ASCII diagrams as defined in rxjs (marble-testing). This could be usefull for easily adding new tests as well as generate docs (render picture as you suggested). However, it would take me quite a lot of time but if it's ok, it could be great. |
We can use the ascii marble testing syntax for testing, but to generate diagram it lacks several features:
If this can be added on top of the existing syntax, then we would have a marble ascii syntax suitable for tests and doc. |
I've btw fixed |
Regarding the issue with |
I agree, from an user perspective, I prefer to write: rx.zip(o1, o2, o3) than rx.zip([o1, o2, o3]) For a list of observables, we just have to add a *, so it's not that much effort: rx.zip(*observables) |
Yes, I suggest we remove the support now, and add it later on demand with another name e.g |
While working on the examples in the documentation is saw a change I was not aware of: The subscription function provided in the create operator (or Observable) now takes two parameters: the observer and a scheduler. |
Yes, that is correct. This is the subscription default scheduler that you may use to set a scheduler once and for all for all operators in the chain. Check out the timeflies_tkinter.py that uses this feature. This means that when using RxPY with an UI library you don't need to set the scheduler on every operator. For operators such as _scheduler = scheduler or scheduler_ or timeout_scheduler Where For If the subscribe function given to The confusing part is how this relates to |
ok thanks for the clarification. I still find this parameter confusing: It has to be declared as a parameter of the subscribe function; but it's value is None unless a scheduler has been provided on subscription; and it is useful only when emitting items after the subscription call. |
It's not more confusing than the scheduler argument to every operator that currently needs a scheduler. Those operators cannot perform their action using |
We may have a problem with operators Other operators rely on the fact that the first argument as an Iterable can be an Iterator with possibly infinite length, or a length that could be unknown when calling *args is a tuple and cannot be mutated, so the length is set when calling the operator function. RxPY/rx/core/operators/repeat.py Lines 29 to 35 in 379b699
The operators that expect this behaviour are listed below:
For |
The right thing to do here is to create new functions (operators) that takes |
good idea 👍
def concat(*sources: Observable) -> Observable:
return concat_with_iterable(sources)
|
I've started to merge (clarification: each item in the list import the next item, see stack trace below)
The same thing happens with:
The first solution is to import 'isolated' modules (basic, priorityqueue, exceptions, ...) before other imports in rx.internal.__init__.py. But relying on imports order doesn't feel sane. Another solution is to import full path (relative or absolute) everywhere, e.g. What do you think ? EDIT: my comment is not very clear, a trace may be more appropriate: >>> import rx.internal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jehf/DEV/pyprojects/RxPY/rx/__init__.py", line 6, in <module>
from .internal import Observable, abc, typing, pipe
File "/home/jehf/DEV/pyprojects/RxPY/rx/internal/__init__.py", line 4, in <module>
from .observable import Observable, ConnectableObservable
File "/home/jehf/DEV/pyprojects/RxPY/rx/internal/observable/__init__.py", line 1, in <module>
from .observable import Observable
File "/home/jehf/DEV/pyprojects/RxPY/rx/internal/observable/observable.py", line 5, in <module>
from rx.disposable import Disposable
File "/home/jehf/DEV/pyprojects/RxPY/rx/disposable/__init__.py", line 3, in <module>
from .disposable import Disposable
File "/home/jehf/DEV/pyprojects/RxPY/rx/disposable/disposable.py", line 3, in <module>
from rx.internal import typing, noop
ImportError: cannot import name 'noop' from 'rx.internal' (/home/jehf/DEV/pyprojects/RxPY/rx/internal/__init__.py)
>>> |
Closing this as I don't see anything more that needs to be done for a v3 release from my side. There are some refactoring that can be done but nothing blocking a release IMO. At least we should postpone any further refactoring until a v3.1 release. |
* Fix typing for pipe using overloads. * Fix type typo in hint overload * Move pylint disables to the right line for the multi-line overloads * Add an Observable specific overload first with docstring to make pylint happy. * Remove ellpises from coverage
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This issue is for tracking the remaining work for RxPY v3.
create
,empty
etc.core/observer
.testing/marbles.py
.combine_latest
andwith_latest_from
.starmap
operator based on itertools for use withcombine_latest
et al.BlockingObservable
and methods and provide a blockingrun()
method instead.Iterable[Observable]
for all operators. Use*args
instead.Later, i.e v3.1
internal
andcore
tointernal
similar to RxJS.Generic[T]
instead ofGeneric[Any]
. The problem is what to do with vararg operators such aszip
,combine_latest
etc.The text was updated successfully, but these errors were encountered: