Skip to main content

Python binding for the libusb C library.

Project description

libusb

Python binding for the libusb C library.

Overview

Python libusb module is a low-level binding for libusb C library.
It is an effort to allow python programs full access to the API implemented and provided by the well known *libusb* library.

PyPI record.

Documentation.

libusb is a lightweight Python package, based on the ctypes library.
It is fully compliant implementation of the original C libusb 1.0 API by implementing whole its functionality in a clean Python instead of C.

libusb API 1.0 documentation can be found at:

libusb-1.0 API Reference

libusb uses the underlying libusb C shared library as specified in libusb.cfg (included libusb-X.X.* is the default), but there is also ability to specify it programmatically by one of the following ways:

import libusb
libusb.config(LIBUSB="libusb C shared library absolute path")
# or
libusb.config(LIBUSB=None)  # included libusb-X.X.* will be used

About original libusb:

Borrowed from the original website:

libusb - A cross-platform user library to access USB devices

Overview

libusb is a C library that provides generic access to USB devices. It is intended to be used by developers to facilitate the production of applications that communicate with USB hardware.

It is portable: Using a single cross-platform API, it provides access to USB devices on Linux, OS X, Windows, Android, OpenBSD, etc.

It is user-mode: No special privilege or elevation is required for the application to communicate with a device.

It is version-agnostic: All versions of the USB protocol, from 1.0 to 3.1 (latest), are supported.

What platforms are supported?

Linux, OS X, Windows, Windows CE, Android, OpenBSD/NetBSD, Haiku.

For additional information, please consult the FAQ or the Wiki.

Requirements

  • It is a fully independent package.
    All necessary things are installed during the normal installation process.
  • ATTENTION: currently works and tested only for Windows.

Installation

Prerequisites:

To install run:

python -m pip install --upgrade libusb

Development

Prerequisites:

  • Development is strictly based on tox. To install it run:

    python -m pip install --upgrade tox

Visit Development page.

Installation from sources:

clone the sources:

git clone https://github.com/karpierz/libusb.git libusb

and run:

python -m pip install ./libusb

or on development mode:

python -m pip install --editable ./libusb

License

Copyright (c) 2016-2025 Adam Karpierz
Licensed under the zlib/libpng License
Please refer to the accompanying LICENSE file.

Authors

Changelog

1.0.29 (2025-06-30)

  • Libusb API update: v.1.0.28 -> v.1.0.29

  • Upgrade of dll-s for Windows: libusb v.1.0.28 -> v.1.0.29

  • Setup (dependencies) update.

1.0.28.post2 (2025-05-15)

  • The distribution is now created using ‘build’ instead of ‘setuptools’.

  • Setup (dependencies) update (due to regressions in tox and setuptools).

1.0.28.post1 (2025-05-04)

  • Setup (dependencies) update.

1.0.28 (2025-04-28)

  • Add support for Python 3.14

  • Drop support for Python 3.9 (due to compatibility issues).

  • Update readthedocs’s python to version 3.13

  • Update tox’s base_python to version 3.13

  • Libusb API update: v.1.0.27 -> v.1.0.28

  • Upgrade of dll-s for Windows: libusb v.1.0.27 -> v.1.0.28

  • Add support for PyPy 3.11

  • Drop support for PyPy 3.9

  • Setup (dependencies) update.

1.0.27.post4 (2025-02-14)

  • Windows shared libraries built with Visual Studio 2022.

  • Source distribution (*.tar.gz now) is compliant with PEP-0625.

  • 100% code linting.

  • Tox configuration is now in native (toml) format.

  • Copyright year update.

  • Setup (dependencies) update.

1.0.27.post3 (2024-10-09)

  • Setup (dependencies) update.

1.0.27.post2 (2024-09-30)

  • Drop support for Python 3.8

  • Setup (dependencies) update.

1.0.27.post1 (2024-08-13)

  • Add support for Python 3.13

  • Setup (dependencies) update.

  • Improvements and cleanup for win32.

  • Source code refactoring and cleanup.

1.0.27 (2024-02-05)

  • The API has been fully updated to version 1.0.27 (libusb v.1.0.27
    is fully backward compatible with v.1.0.26).
  • For Windows the shared library binaries have been updated to version
    1.0.27. For Linux and macOS, the shared library binaries remain at
    version 1.0.26.
  • Bugfixes for options -i and -w in examples/xusb.py

1.0.26 (2024-02-05)

  • The API has been partially updated to version 1.0.27, but still
    only supports version 1.0.26.
  • Improvements and some little bugfixes.

  • Examples and tests are upgraded to 1.0.27.

1.0.26rc4 (2024-01-25)

  • Setup update (now based on tox >= 4.0).

  • Cleanup.

1.0.26rc2 (2023-12-20)

  • Add linux aarch64 support.

1.0.26rc1 (2023-12-15)

  • Add support for Python 3.12

  • Drop support for Python 3.7

  • Add support for PyPy 3.10

  • Drop support for PyPy 3.7 and 3.8

  • Copyright year update.

1.0.26b5 (2022-09-10)

  • Tox configuration has been moved to pyproject.toml

1.0.26b4 (2022-08-25)

  • Downgrade of included shared libraries for Linux:
    libusb v.1.0.26 -> v.1.0.24 (for now based on Debian’s 11 (bullseye)),
    because of loading issues of v.1.0.26 from Debian’s 12 (bookworm)
    shared libraries.
  • Setup update.

1.0.26b3 (2022-07-25)

  • Setup update (currently based mainly on pyproject.toml).

  • Update for macOS (dlls are included for v.10.7+ and v.11.6+ 64bit).

1.0.26b2 (2022-07-18)

  • Upgrade for Windows: libusb v.1.0.24 -> v.1.0.26

  • Update for macOS (v.11.6 64bit).

  • Add support for Python 3.10 and 3.11

  • Add support for PyPy 3.7, 3.8 and 3.9

  • Setup update.

1.0.24b3 (2022-01-10)

  • Drop support for Python 3.6

  • Copyright year update.

  • Setup update.

1.0.24b1 (2021-11-10)

  • Upgrade for Windows: libusb v.1.0.23 -> v.1.0.24

  • Add support for macOS (thank you very much dccote@Github!).

  • Copyright year update.

  • backward incompatibility - libusb.cfg is now a regular INI file.

  • Fixes for examples (but still some examples don’t work properly).

  • Setup update.

1.0.23b7 (2020-11-19)

  • Ability to specify the underlying shared library programmatically.

  • General update and cleanup.

  • Setup update.

  • Removing dependence on atpublic.

  • Fixed docs setup.

  • Fix for hotplugtest example.

1.0.23b1 (2020-09-15)

  • Upgrade for Windows: libusb v.1.0.22 -> v.1.0.23
    (partially; without libusb_wrap_sys_device, because
    original Windows v.1.0.23 dlls do not export this function).
  • Add support for Python 3.9

  • Drop support for Python 3.5

  • Setup update.

  • Cleanup.

1.0.22b9 (2020-01-17)

  • Added ReadTheDocs config file.

  • Setup update.

1.0.22b8 (2019-11-24)

  • Upgrade for Linux: libusb x64 v.1.0.21 -> v.1.0.22

  • Fix for error when the shared library is configured.

  • Cleanup.

1.0.22b6 (2019-11-23)

  • Initial support for Linux (libusb v.1.0.21 x64).

1.0.22b5 (2019-11-14)

  • Drop support for Python 2

  • Drop support for Python 3.4

  • Add support for Python 3.8

  • Setup update and cleanup.

1.0.22b4 (2019-02-15)

  • Setup improvement.

  • Update required setuptools version.

  • Some updates of examples.

1.0.22b2 (2018-11-08)

  • Setup improvement.

  • Update required setuptools version.

1.0.22b1 (2018-03-30)

  • Upgrade to the libusb v.1.0.22

  • Setup improvement.

1.0.21b4 (2018-02-26)

  • Improve and simplify setup and packaging.

1.0.21b3 (2018-02-25)

  • Setup improvement.

1.0.21b2 (2017-12-18)

  • Fix the error of platform detecting.

1.0.21b1 (2017-10-11)

  • First beta release.

1.0.21a3 (2017-08-20)

  • Next alpha release.

1.0.21a0 (2016-09-24)

  • First alpha release.

0.0.1 (2016-09-23)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libusb-1.0.29.tar.gz (646.1 kB view details)

Uploaded Source

Built Distribution

libusb-1.0.29-py3-none-any.whl (588.8 kB view details)

Uploaded Python 3

File details

Details for the file libusb-1.0.29.tar.gz.

File metadata

  • Download URL: libusb-1.0.29.tar.gz
  • Upload date:
  • Size: 646.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for libusb-1.0.29.tar.gz
Algorithm Hash digest
SHA256 05f374384f93f4d6ef5d326a3154e58371a035e555ad2722d25b1e25a7d6f241
MD5 0607c57c2b18610be7a959029d0d8d5f
BLAKE2b-256 8c0d70c7e3282be54c8869ff03689a967979e4d2488f3b031affb0f3e13cf095

See more details on using hashes here.

File details

Details for the file libusb-1.0.29-py3-none-any.whl.

File metadata

  • Download URL: libusb-1.0.29-py3-none-any.whl
  • Upload date:
  • Size: 588.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for libusb-1.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 f26efe09595ed55f68695be550658e474f6f955c4f29c9ce43aaa4f3b2c143d3
MD5 1fc09c8a6e464475a64c138689be84a3
BLAKE2b-256 333d7d73065ed0ce778cf503a61ac3c654d9e20ea3f698143dae48f9304e59fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page