btpy
A comprehensive Python library for Bluetooth communication, providing unified interfaces for Bluetooth Low Energy (BLE), Classic Bluetooth, and Beacon devices.
Features
- Bluetooth Low Energy (BLE): Scan and interact with BLE devices using bleak
- Beacon Support: Detect and parse beacon advertisements using beacontools
- Classic Bluetooth: Work with classic Bluetooth devices via bumble
- Simple API: Easy-to-use interface for common Bluetooth operations
- Cross-platform: Works on Linux, macOS, and Windows (where supported by underlying libraries)
Requirements
- Python >= 3.10
- Compatible operating system (Linux, macOS, or Windows)
Installation
Using pip
pip3 install btpy
Using uv
uv pip install btpy
Or add to your project:
uv add btpy
Usage
The library provides three main device classes for different Bluetooth types:
Scanning for BLE Devices
from btpy import LEDevice
# Scan for BLE devices for 4 seconds
le_results = LEDevice.scan(4)
Scanning for Beacons
from btpy import Beacon
# Scan for beacons for 5 seconds
beacon_results = Beacon.scan(5)
Scanning for Classic Bluetooth Devices
from btpy import ClassicDevice
# Scan for classic Bluetooth devices for 6 seconds
classic_results = ClassicDevice.scan(6)
Combined Example
from btpy import LEDevice, Beacon, ClassicDevice
# Perform all scans
le_results = LEDevice.scan(4)
beacon_results = Beacon.scan(5)
classic_results = ClassicDevice.scan(6)
print(f"Found {len(le_results)} BLE devices")
print(f"Found {len(beacon_results)} beacons")
print(f"Found {len(classic_results)} classic devices")
Documentation
For more detailed documentation, please visit the Wiki.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
TODO
- Add comprehensive tests
Metadata
Release files for btpy 2.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| btpy-2.0.9.tar.gz | 113.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| btpy-2.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 120.7 kB
Release files / btpy-2.0.9.tar.gz
| Download URL | btpy-2.0.9.tar.gz |
|---|---|
| Size | 113.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7aa975aae597c005d1265922ee03520089fec6e87ab6d68c3a67790d7a05705
|
|
BLAKE2b-256 checksum How to use checksums |
56b3987bb765c86fb5ebbfb51f0631bbdff605f81d7d51eb83cd2f6f46739112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.
Transparency logRelease files / btpy-2.0.9-py3-none-any.whl
| Download URL | btpy-2.0.9-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6123bc742d938adfa2027f36ca138c7c72a085d13b4096fcc7f57ff9b4e2bec4
|
|
BLAKE2b-256 checksum How to use checksums |
7837b836e276b766e917e2393536cadc9f5693b8e6828ae5c85e09e9a4e0bb89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.
Transparency log