'How to convert RxPy subject to observable

I have worked with RxJs and RxJava in the past and I common practice I adopted was to not exposed Subjects on the public interface of my classes to not allow other parts of the code to publish new values. In rxjs, for example, I would do:

const myPrivateSubject = new Subject();
const myPublicObservable = myPrivateSubject.asObservable();

in rxjava, for example, I would do:

Subject privateSubject = new Subject();
Observable publicObservable = privateSubject.hide();

Lately, however, I have been working with RxPy but I couldn't find the equivalent of asObservable or hide in RxPy. Can someone please help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source