{"id":19214917,"url":"https://github.com/pyocd/libusb-package","last_synced_at":"2025-08-21T09:32:55.043Z","repository":{"id":43673370,"uuid":"425635105","full_name":"pyocd/libusb-package","owner":"pyocd","description":"Packaged libusb shared libraries for Python.","archived":false,"fork":false,"pushed_at":"2025-04-02T11:10:53.000Z","size":56,"stargazers_count":30,"open_issues_count":9,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T23:04:57.813Z","etag":null,"topics":["libusb","python","pyusb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyocd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-07T22:52:54.000Z","updated_at":"2025-04-27T16:29:10.000Z","dependencies_parsed_at":"2025-05-18T00:13:28.909Z","dependency_job_id":null,"html_url":"https://github.com/pyocd/libusb-package","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":0.5,"last_synced_commit":"7a62b644f3cc075a37e8d2e255ee9941ce2ca752"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/pyocd/libusb-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyocd%2Flibusb-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyocd%2Flibusb-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyocd%2Flibusb-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyocd%2Flibusb-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyocd","download_url":"https://codeload.github.com/pyocd/libusb-package/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyocd%2Flibusb-package/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271455663,"owners_count":24762771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libusb","python","pyusb"],"created_at":"2024-11-09T14:11:51.863Z","updated_at":"2025-08-21T09:32:54.720Z","avatar_url":"https://github.com/pyocd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Container package for libusb\n\nThis Python package functions as an installation vehicle for libusb shared libraries, to\nsimplify installation of tools that require libusb. The main use case is so that users\ndon't have to install libusb manually for projects that use pyusb. However, any Python\nproject that uses a libusb wrapper can also benefit.\n\nSee [libusb.info](https://libusb.info) for more information about libusb.\n\nNote: Currently the included libusb is built _without_ udev support on Linux.\n\nNote: The libusb upstream git repository is included as a submodule, so you need to clone with submodules\nenabled. You can either clone with `--recurse-submodules` or run `git submodule update --init` after cloning.\n\n\n## Installation\n\nAll releases include wheels for Linux, macOS, and Windows for multiple architectures. In addition, a source\ndistribution is released.\n\nIf a matching wheel is not available, the source distribution will be installed and libusb will be compiled.\nThis means the libusb build requirements must be installed:\n\n- Linux and macOS: autoconf, automake, libtool, and m4. As mentioned above, libusb is built without udev support,\n    so libudev-dev is not required on Linux.\n- Windows: Visual Studio 2019 (Community is ok).\n\nIf the libusb build fails when installing from a source distribution, the `libusb-package` install _will still\nsucceed_. In this case, an \"empty\" `libusb-package` is installed that doesn't contain a libusb shared library.\n`get_library_path()` returns None and `find_library()` falls back to returning a system installation of libusb,\nif available.\n\nYou can also install from a clone of the git repository by running `pip install .` from the repository root directory.\nEditable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517\ncompliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is\ndone in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build.\n\n\n## APIs\n\nThere are four public functions exported by `libusb_package`.\n\n- `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend`\n    parameter to a libusb1 backend created from the libusb library included in `libusb_package`.\n    All other parameters are passed unmodified\n\n- `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained\n    in `libusb_package`.\n\n- `find_library(candidate)`: Lower level function that returns either the full path to a\n    library contained in `libusb_package` with a name starting with `candidate`, or None if\n    no matching library is found. This function is suitable for use with the `find_library`\n    callback parameter for pyusb's `get_backend()` functions.\n\n    If `get_library_path()` returns None, indicating there is no included library, this function\n    will fall back to `ctypes.util.find_library()`.\n\n- `get_library_path()`: Returns an absolute Path object for the included library. If there is not\n    an included library, None is returned.\n\nBoth `get_libusb1_backend()` and `get_library_path()` cache their return values.\n\n\n## Versioning\n\nThe version of libusb-package is composed of the libusb version plus an additional field for\nthe version of the Python code. For instance, 1.0.24.0. The Python code version will be reset\nto 0 when the libusb version is incremented for new libusb release.\n\n\n## Examples\n\nUsage example for `find()`:\n\n```py\nimport libusb_package\n\nfor dev in libusb_package.find(find_all=True):\n    print(dev)\n```\n\n\nUsage example for `find_library()`:\n\n```py\nimport libusb_package\nimport usb.core\nimport usb.backend.libusb1\n\nlibusb1_backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library)\n# -\u003e calls usb.libloader.load_locate_library(\n#                ('usb-1.0', 'libusb-1.0', 'usb'),\n#                'cygusb-1.0.dll', 'Libusb 1',\n#                win_cls=win_cls,\n#                find_library=find_library, check_symbols=('libusb_init',))\n#\n# -\u003e calls find_library(candidate) with candidate in ('usb-1.0', 'libusb-1.0', 'usb')\n#   returns lib name or path (as appropriate for OS) if matching lib is found\n\n# It would also be possible to pass the output of libusb_package.get_libsusb1_backend()\n# to the backend parameter here. In fact, that function is simply a shorthand for the line\n# above.\nprint(list(usb.core.find(find_all=True, backend=libusb1_backend)))\n```\n\n\n### Source distribution\n\nBefore building a source distribution, be sure to clean all untracked files from the libusb\nsubmodule using `git -C src/libusb clean -dfx`.\n\n\n### License\n\nThe Python code for `libusb-package` is licensed with Apache 2.0.\\\nThe libusb library and its source code are licensed with GPLv2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyocd%2Flibusb-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyocd%2Flibusb-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyocd%2Flibusb-package/lists"}