tiqi-group / pydase

A Python library for creating remote control interfaces of Python objects.
https://pydase.readthedocs.io
MIT License
2 stars 1 forks source link

Support for Dynamic Attribute Handling and Collection Management #72

Closed mosmuell closed 11 months ago

mosmuell commented 1 year ago

Is your feature request related to a problem? Please describe. The current implementation of pydase utilizes a callback system that effectively monitors attributes of a class and its child classes. However, this approach faces limitations when dealing with dynamic class structures, such as adding attributes after instantiation or modifying collections like lists.

Describe the solution you'd like I propose enhancing pydase with a more dynamic observer pattern that can handle changes in the class structure post-instantiation. Specifically, this would include:

  1. Dynamic Attribute Handling: Implementing a system where adding new attributes to an object after its creation would automatically register these attributes with the observer system. This could be achieved by overriding the __setattr__ method.

  2. Observable Collections: Creating custom collection classes (like ObservableList) that are aware of their content changes. These collections would notify observers on any modification, such as adding or removing elements.

  3. Nested Object Observation: Extending the observer pattern to seamlessly handle nested objects. Changes in attributes of nested objects should also trigger notifications to observers.

This approach aims to provide a more flexible and robust solution, allowing pydase to be used in a wider range of scenarios, especially those requiring dynamic modifications to object structures.