2021-09-17 13:15:37

by Marijn Suijten

[permalink] [raw]
Subject: Re: Deprecated Python Libraries

Hi Barry,

On 2021-09-17 08:03:36, Barry Byford wrote:
> The Python examples in the test directory have some dependencies that
> have issues:
> [..]
> Would there be any interest in getting patches to change to these
> different libraries?
> Are these test scripts used in any of the automated tests?
> Can I submit a PR via https://github.com/bluez/bluez/pulls?

Perhaps of relevance: Sanchayan (cc'd) imporved some scripts for Python
3 compatibility (Python 2 is already deprecated for the better part of
1.5 years) and proper formatting [1] while working on BT LDAC [2], some
patches made it to the list [3] but were ultimately never merged.
Sanchayan, would you be willing to resubmit these? Alternatively Barry
can pick them up as part of their quest to improve the scripts for
longevity?

Disclaimer: I'm not a maintainer, merely a passer-by so don't take my
comment as an acknowledgement to go ahead with the changes. But if you
do I think everyone appreciates improved shebangs and PEP8 style
formatting (I find `black` to perform formatting nicely) along the way
just like Sanchayan's patches.

[1]: https://gitlab.freedesktop.org/SanchayanMaity/bluez/-/commits/python3/
[2]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1621
[3]: https://lore.kernel.org/linux-bluetooth/?q=sanchayan

Thanks!
- Marijn


2021-09-19 19:23:24

by Barry Byford

[permalink] [raw]
Subject: Re: Deprecated Python Libraries

Hello Marijn,

On Fri, 17 Sept 2021 at 09:04, Marijn Suijten
<[email protected]> wrote:
>
> Hi Barry,
>
> On 2021-09-17 08:03:36, Barry Byford wrote:
> > The Python examples in the test directory have some dependencies that
> > have issues:
> > [..]
> > Would there be any interest in getting patches to change to these
> > different libraries?
> > Are these test scripts used in any of the automated tests?
> > Can I submit a PR via https://github.com/bluez/bluez/pulls?
>
> Perhaps of relevance: Sanchayan (cc'd) imporved some scripts for Python
> 3 compatibility (Python 2 is already deprecated for the better part of
> 1.5 years) and proper formatting [1] while working on BT LDAC [2], some
> patches made it to the list [3] but were ultimately never merged.
> Sanchayan, would you be willing to resubmit these? Alternatively Barry
> can pick them up as part of their quest to improve the scripts for
> longevity?
>
> Disclaimer: I'm not a maintainer, merely a passer-by so don't take my
> comment as an acknowledgement to go ahead with the changes. But if you
> do I think everyone appreciates improved shebangs and PEP8 style
> formatting (I find `black` to perform formatting nicely) along the way
> just like Sanchayan's patches.
>
> [1]: https://gitlab.freedesktop.org/SanchayanMaity/bluez/-/commits/python3/
> [2]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1621
> [3]: https://lore.kernel.org/linux-bluetooth/?q=sanchayan
>

Thanks for the feedback and references.

I'm not quite sure of the purpose of the the Python scripts in the
test directory.
Do they serve the automated tests? In which case any changes need to
be carefully considered.
Or are they a base for people to interactively test BlueZ and see how
to do an implementation with the D-Bus API.
The use of bluezutils.py file seems to be inconsistent so I'm not sure
if it is preferred or not.
I regularly refer people to the Python scripts as an example of using
the BlueZ D-Bus APi and that is my motivation for wanting to see them
be improved.

I've taken a look at moving the test-adapter script across to the Gio
bindings and argparse.
This meant updating the bluezutils.py also. Once I started
restructuring things I may have got slightly carried away. I've also
added some functionality such as being able to Introspect the
interface.

Anyway, the result of my experiment is at:
https://github.com/ukBaz/bluez/commit/44f9c205f798232f9417879401b2baefa1ef01ac

Any guidance from the maintainers as to what is required of the Python
scripts in the test directory would be appreciated. Are there any
scripts in the directory that you think are good examples of what you
are looking for?

Regards,
Barry


> Thanks!
> - Marijn