Skip to main content

Container 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's usb.core.find() that sets the backend parameter to a libusb1 backend created from the libusb library included in libusb_package. All other parameters are passed unmodified.

  • get_libusb1_backend(): Returns a pyusb backend object for the libusb version contained in libusb_package.

  • find_library(candidate): Lower level function that returns either the full path to a library contained in libusb_package with a name starting with candidate, or None if no matching library is found. This function is suitable for use with the find_library callback parameter for pyusb's get_backend() functions.

    If get_library_path() returns None, indicating there is no included library, this function will fall back to ctypes.util.find_library().

  • get_library_path(): Returns an absolute Path object for the included library. If there is not an included library, None is returned.

Both get_libusb1_backend() and get_library_path() cache their return values.

Versioning

The version of libusb-package is composed of the libusb version plus an additional field for the version of the Python code. For instance, 1.0.30.0. The Python code version will be reset to 0 when the libusb version is incremented for new libusb release.

Examples

Usage example for find():

import libusb_package

for dev in libusb_package.find(find_all=True):
    print(dev)

Usage example for find_library():

import libusb_package
import usb.core
import usb.backend.libusb1

libusb1_backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library)
# -> calls usb.libloader.load_locate_library(
#                ('usb-1.0', 'libusb-1.0', 'usb'),
#                'cygusb-1.0.dll', 'Libusb 1',
#                win_cls=win_cls,
#                find_library=find_library, check_symbols=('libusb_init',))
#
# -> calls find_library(candidate) with candidate in ('usb-1.0', 'libusb-1.0', 'usb')
#   returns lib name or path (as appropriate for OS) if matching lib is found

# It would also be possible to pass the output of libusb_package.get_libsusb1_backend()
# to the backend parameter here. In fact, that function is simply a shorthand for the line
# above.
print(list(usb.core.find(find_all=True, backend=libusb1_backend)))

Source distribution

Before building a source distribution, be sure to clean all untracked files from the libusb submodule using git -C src/libusb clean -dfx.

License

The Python code for libusb-package is licensed with Apache 2.0.
The libusb library and its source code are licensed with LGPLv2.1.

Metadata

Release files for libusb-package 1.0.30.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for libusb-package 1.0.30.1
File Actions
libusb_package-1.0.30.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for libusb_package-1.0.30.1-py3-none-win_amd64.whl
libusb_package-1.0.30.1-py3-none-win32.whl Python 3 none Windows x86-32 Details for libusb_package-1.0.30.1-py3-none-win32.whl
libusb_package-1.0.30.1-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for libusb_package-1.0.30.1-py3-none-musllinux_1_2_x86_64.whl
libusb_package-1.0.30.1-py3-none-musllinux_1_2_i686.whl Python 3 none Linux musl 1.2+ x86-32 Details for libusb_package-1.0.30.1-py3-none-musllinux_1_2_i686.whl
libusb_package-1.0.30.1-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for libusb_package-1.0.30.1-py3-none-musllinux_1_2_aarch64.whl
libusb_package-1.0.30.1-py3-none-manylinux_2_28_i686.whl Python 3 none Linux glibc 2.28+ x86-32 Details for libusb_package-1.0.30.1-py3-none-manylinux_2_28_i686.whl
libusb_package-1.0.30.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for libusb_package-1.0.30.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
libusb_package-1.0.30.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details for libusb_package-1.0.30.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
libusb_package-1.0.30.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for libusb_package-1.0.30.1-py3-none-macosx_11_0_arm64.whl
libusb_package-1.0.30.1-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for libusb_package-1.0.30.1-py3-none-macosx_10_9_x86_64.whl

Total release size: 753.5 kB

Release files / libusb_package-1.0.30.1-py3-none-win_amd64.whl

Download URL libusb_package-1.0.30.1-py3-none-win_amd64.whl
Size 88.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
57ed575796016854a85fb6e58a6735e26b166c46a98a6bd2d636caae98638a68
BLAKE2b-256 checksum
How to use checksums
da6808ff45393bf018d40c6a3483830c47a0fcc72b942f51f5b10ec41a214c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-win32.whl

Download URL libusb_package-1.0.30.1-py3-none-win32.whl
Size 76.8 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
868f1d9d340cbabecb11bd958e4ad5f93fff8dce69b1cca2b2c97dd8ec6e32fb
BLAKE2b-256 checksum
How to use checksums
8be6a2dbea1fce55020319bd9ec03d3275a69b7ac904faa75d6292b2a6610de0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-musllinux_1_2_x86_64.whl

Download URL libusb_package-1.0.30.1-py3-none-musllinux_1_2_x86_64.whl
Size 74.7 kB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
336d5638481b82116857d4d3515826aa2d2091c8a3c1757ab7cb36fa1e74a8c8
BLAKE2b-256 checksum
How to use checksums
b9f386d8d5e2da0c15ae23e85b3ebd254c6608e0f35b7484c945ca295b2838a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-musllinux_1_2_i686.whl

Download URL libusb_package-1.0.30.1-py3-none-musllinux_1_2_i686.whl
Size 80.3 kB
Tags Linux musl 1.2+ x86-32 Python 3
SHA-256 checksum
How to use checksums
5f3fc7b37a375679ba585341812a519dc2b38a4a9a4a5633af2135b8a2327981
BLAKE2b-256 checksum
How to use checksums
fab625a5b1c9eec55030e4d3bebcda411fa5623869072b5aebec176ffbc1417a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-musllinux_1_2_aarch64.whl

Download URL libusb_package-1.0.30.1-py3-none-musllinux_1_2_aarch64.whl
Size 75.1 kB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
eb908fe20c6ee85e85c3b02d2f4c960e435b37d84bbf19044689853efe85c9a3
BLAKE2b-256 checksum
How to use checksums
c2f3603d84592c641d2ac5a9c16aafd5f09e488803478c455eb73830a1be1b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-manylinux_2_28_i686.whl

Download URL libusb_package-1.0.30.1-py3-none-manylinux_2_28_i686.whl
Size 78.5 kB
Tags Linux glibc 2.28+ x86-32 Python 3
SHA-256 checksum
How to use checksums
d2f871b0b99baaa3801be8bab29e767fa29385ed18d480ac78af1e82f765c2d7
BLAKE2b-256 checksum
How to use checksums
387b078d16d95b97106fb694fe86452651fde1730463a6cff6e6aacaea77f3b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL libusb_package-1.0.30.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 74.1 kB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7fed1daa6fa8666fc0391ce3be2b1a5c61a9874017bc199dd328ea1a26a80549
BLAKE2b-256 checksum
How to use checksums
ab2a8fa636c24b108f88690310bde27c8cc42b60d1e211b98fc555bab7f92040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL libusb_package-1.0.30.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 74.2 kB
Tags Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
97392640556d696daee071f3f77b3d7778d937fd37d2cb0b900d23090be0624c
BLAKE2b-256 checksum
How to use checksums
4862b251d9c2889ab136e43fa1ee2dc7359b42381d3e06857ec34b265ac2ec12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-macosx_11_0_arm64.whl

Download URL libusb_package-1.0.30.1-py3-none-macosx_11_0_arm64.whl
Size 63.6 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
46c7ca9931c46cd63ff89ce17c947653c3c5dec46a441c6bc103f1fda86d52df
BLAKE2b-256 checksum
How to use checksums
52399da61be368c2d4b72a281e134783500282f723bb706adfe8b608976c5b6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / libusb_package-1.0.30.1-py3-none-macosx_10_9_x86_64.whl

Download URL libusb_package-1.0.30.1-py3-none-macosx_10_9_x86_64.whl
Size 67.6 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
7ee86d9e1092f22239be28ae45e12cd47d65f4fa19f71e83f1f1036b97295cdc
BLAKE2b-256 checksum
How to use checksums
fa969a8ee916d1503b4137a5684faacf02c3452c8c3d66959ebceb85ea54ad0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Security for libusb-package 1.0.30.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page