Metadata-Version: 2.4
Name: python-usb
Version: 0.1.0
Summary: List all USB devices in a developer-friendly tree view (Windows/macOS/Linux)
Author: Peter
License: MIT
Project-URL: Homepage, https://github.com/peterdemin/python-usb
Project-URL: Issues, https://github.com/peterdemin/python-usb/issues
Keywords: usb,devices,hardware,tree,cli,debug
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Hardware
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# python-usb

List all USB devices in a developer-friendly tree view. Zero dependencies — works on **macOS**, **Linux**, and **Windows**.

## Dev

```
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python-usb
```

## Install

```
pip install python-usb
```

## Usage

```
python-usb
```

Example output (macOS):

```
└── USB 3.1 Bus
    ├── USB Keyboard [05ac:024f]
    │   Vendor:    Apple Inc.
    │   Serial:    ABCD1234
    │   Speed:     Full Speed
    │   Power:     50 mA
    ├── USB Mouse [046d:c077]
    │   Vendor:    Logitech
    │   Speed:     Low Speed
    └── USB Hub [2109:2817]
        Vendor:    VIA Labs, Inc.
        Speed:     Super Speed
        └── External SSD [0781:5583]
            Vendor:    SanDisk
            Serial:    12345678
            Speed:     Super Speed
            Power:     896 mA
```

### JSON output

```
python-usb --json
```

### What it shows

| Field     | Description                      |
|-----------|----------------------------------|
| Name      | Product / device name            |
| ID        | `vendor_id:product_id` (hex)     |
| Vendor    | Manufacturer name                |
| Serial    | Serial number                    |
| Speed     | Low / Full / High / Super Speed  |
| Class     | USB device class                 |
| Driver    | Kernel driver in use             |
| Location  | Bus and device number            |
| Power     | Max power draw                   |
| USB Ver   | USB specification version        |

## How it works

| Platform | Method                                    |
|----------|-------------------------------------------|
| macOS    | `system_profiler SPUSBDataType -json`      |
| Linux    | `/sys/bus/usb/devices` sysfs (or `lsusb`) |
| Windows  | PowerShell + WMI `Win32_PnPEntity`        |

No compiled extensions, no `libusb` dependency.

## Publish to PyPI

1. Update the version in `pyproject.toml`.
2. Create a PyPI API token at <https://pypi.org/manage/account/token/>.
3. Install the publishing tools:

```
python -m pip install --upgrade build twine
```

4. Build the distribution files:

```
python -m build
python -m twine check dist/*
```

5. Upload to PyPI:

```
python -m twine upload dist/*
```

Use `__token__` as the username and your PyPI API token as the password when prompted.

## License

MIT
