Package containing libusb so it can be installed via Python package managers
Maintained. Last release 3 weeks ago, commits in 5 of the last 26 weeks. Weaker on commit activity.
pip install libusb-packageContainer package for libusb
This Python package functions as an installation vehicle for libusb shared libraries, to simplify installation of tools that require libusb. The main use case is so that users don't have to install libusb manually for projects that use pyusb. However, any Python project that uses a libusb wrapper can also benefit.
See libusb.info for more information about libusb.
Note: Currently the included libusb is built without udev support on Linux.
Note: The libusb upstream git repository is included as a submodule, so you need to clone with submodules
enabled. You can either clone with --recurse-submodules or run git submodule update --init after cloning.
Installation
All releases include wheels for Linux, macOS, and Windows for multiple architectures. In addition, a source distribution is released.
If a matching wheel is not available, the source distribution will be installed and libusb will be compiled. This means the libusb build requirements must be installed:
- Linux and macOS: autoconf, automake, libtool, and m4. As mentioned above, libusb is built without udev support, so libudev-dev is not required on Linux.
- Windows: Visual Studio 2019 or later (Community is ok).
If the libusb build fails when installing from a source distribution, the libusb-package install will still
succeed. In this case, an "empty" libusb-package is installed that doesn't contain a libusb shared library.
get_library_path() returns None and find_library() falls back to returning a system installation of libusb,
if available.
You can also install from a clone of the git repository by running pip install . from the repository root directory.
Editable installs are supported. Please note that running setup.py directly is no longer supported for PEP 517
compliant packages. Building libusb is done out of tree in an automatically created build directory for libusb 1.0.25
and later.
APIs
There are four public functions exported by libusb_package.
-
find(*args, **kwargs): Wrapper around pyusb'susb.core.find()that sets thebackendparameter to a libusb1 backend created from the libusb library included inlibusb_package. All other parameters are passed unmodified. -
get_libusb1_backend(): Returns apyusbbackend object for the libusb version contained in .