vpelletier / python-libusb1

Python ctype-based wrapper around libusb1
GNU Lesser General Public License v2.1
168 stars 65 forks source link

question: comparison with pyusb #84

Open danielhrisca opened 2 years ago

danielhrisca commented 2 years ago

Hello all,

I would like to get your opinion about how python-libusb1 compares with pyusb. The license is obviously different but how about stability, ease of use?

Thank you!

vpelletier commented 2 years ago

Hello,

The reason why I implemented python-libusb1 is to have access to all the features libusb has, and especially the asynchronous API (on OSes where libusb supports it). In my understanding, pysub is instead targeted at supporting a variety of usb libraries, abstracting their differences, which means it mostly (only ?) allow access to a common subset of features - which meant (back when I started this project anyway) synchronous API only. I instead chose to rely on libusb to provide me with OS-independence, as it supports *nix, windows, OSX, and there is some android support being worked on AFAIK.

On the ease of use side, I must say that python-libusb1 has accumulated some historical baggage as I got better at abstracting details from C (especially getting the python garbage collector to respect necessary memory allocation lifespan without requiring the library user to have to think too hard about it), making its API larger than strictly necessary. I want to eventually drop such weight, but I have been also trying very hard to keep the existing API as stable as possible.

mcuee commented 1 year ago

It seems to me pyusb is more widely used as it started very earlier. It supports libusb-0.1 API and it supports libusb-1.0 API. It also supports OpenUSB (but OpenUSB is kind of dead now).

But yes pyusb still have some features not implemented, like asynchronous transfers and hotplug. But since libusb-1.0 Windows does not support hotplug yet -- it may not be easy to support hotplug under pyusb or python-libusb1.