skillfed

libusb1

Pure-python wrapper for libusb-1.0

libusb1 v3.4.0 619.0K downloads/30d#5,731 on PyPI187
Copyleft license LGPL-2.1-or-later Active released

What it is and what it does

libusb1 is a pure-Python ctypes-based wrapper around the libusb-1.0 C library, exposing USB device enumeration, configuration, and data transfer operations as Python classes and methods. It maps libusb functions to object-oriented interfaces—for example, libusb_init becomes USBContext, and libusb_get_device_list becomes a context method returning USBDevice instances—while converting C error codes into Python exceptions.

The package supports both synchronous blocking I/O and asynchronous event-driven transfers with callbacks, allowing developers to build USB applications on GNU/Linux, Windows, OSX, FreeBSD, and OpenBSD without writing C code. It handles the complexity of device claiming, interface selection, and transfer lifecycle management, though users must still install the appropriate system libusb library and, on Windows, configure device drivers separately.

Use it for:

  • Read sensor data or control hardware devices connected via USB in embedded or IoT applications.
  • Build cross-platform USB diagnostic or firmware-flashing tools without rewriting logic per OS.
  • Implement high-throughput data acquisition from USB instruments using asynchronous transfer batching.
  • Enumerate and interact with multiple USB devices in a single Python process for device management utilities.
  • Prototype USB communication logic in Python before optimizing performance-critical paths in C.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python wrapper for libusb-1.0 that enables synchronous and asynchronous USB device communication across multiple operating systems.

Yes, if you need USB device access from Python and can install libusb-1.0 on your target OS. The package is actively maintained, has no known vulnerabilities, installs with low friction, and provides a clean Python API to libusb. The LGPL-2.1-or-later license is permissive for most use cases but requires disclosure if you distribute the library; check your project's licensing constraints. Windows users must handle driver setup separately.

Install

libusb1 on PyPI

pip

pip install libusb1

uv

uv add libusb1

poetry

poetry add libusb1

Installing libusb1

Before you install

Low friction installation; pure Python wheel with no compiled dependencies. Active maintenance with last commit on 2026-05-16 and release within 90 days. No known vulnerabilities.

License in practice

Licensed under LGPL-2.1-or-later (copyleft). Derivative works and modifications must be distributed under compatible terms; proprietary applications can link to it but must disclose the library and allow relinking.

Quickstart

pip install libusb1

import libusb1
with libusb1.USBContext() as context:
    handle = context.openByVendorIDAndProductID(VENDOR_ID, PRODUCT_ID)
    if handle:
        data = handle.bulkRead(ENDPOINT, BUFFER_SIZE)

Requires libusb-1.0 system library installed and accessible to ctypes; on Windows, driver setup (WinUSB or libusbk) needed per device; CPython 3.6+ or PyPy 2.0+ required.

Verify before relying

  • Whether the package maintains backward compatibility across major versions beyond what the changelog indicates.
  • Current test coverage and CI/CD pipeline maturity for the listed supported OSes.
  • Performance characteristics for high-throughput or low-latency transfer scenarios.

Package facts

License LGPL-2.1-or-later (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 90 days since the last release
Last repo commit
First released
Downloads 618,950/month — #5,731 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: libusb1-3.4.0-py3-none-any.whl

Keywords: usb, libusb

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: System :: Hardware :: Hardware Drivers

Tags

usb device communication pythonlibusb wrapperusb bulk transferusb async iohardware device control pythonusb endpoint read writecross-platform usb access
usb-hardwarecross-platformasync-io

More Libraries packages