altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
187 stars 59 forks source link

Invert proxy object attribute mapping. #105

Closed jameshilliard closed 2 years ago

jameshilliard commented 2 years ago

This is an experiment to see if the translation between functions and dbus methods/props/signals can be inverted(seems to work). This technique should in theory be able to be extended to allow receiving signals without introspection(I think).

This also should allow the methods to be loaded on an as needed basis as we now have name based getters in the introspection data structures and can follow those instead of having to preload all introspection data.

acrisci commented 2 years ago

Why is this useful?

acrisci commented 2 years ago

I like it how it is now because you can dir() the ProxyObject and see what methods are there. I've used that for debugging a few times.

extended to allow receiving signals without introspection

I don't like this idea. Type checking is such an important part of the library and introspection is necessary for that because it specifies the types.

acrisci commented 2 years ago

If you have a big plan, open an issue to discuss the design approach before you start to work. I don't know how to evaluate something that isn't a feature or bug fix without knowing why it's being done.

jameshilliard commented 2 years ago

I don't like this idea. Type checking is such an important part of the library and introspection is necessary for that because it specifies the types.

Proxy object would still be fully type checked, but the method attribute technique would allow a signal receiver(via separate codepaths) to be created without introspection.

jameshilliard commented 2 years ago

I like it how it is now because you can dir() the ProxyObject and see what methods are there. I've used that for debugging a few times.

Oh, I def want to keep that supported, it should still work with this technique(I just to add a ProxyObject method to generate that from the introspection object), this was groundwork for improving handling for those sort of inspection operations beyond proxy objects.

jameshilliard commented 2 years ago

If you have a big plan, open an issue to discuss the design approach before you start to work. I don't know how to evaluate something that isn't a feature or bug fix without knowing why it's being done.

Yeah, I was playing with a few things to see what design approaches might work well. I'll open an issue now that I've got a better idea of how things work internally.