Skip to main content

Bluetooth Classic

CI Status Documentation Status Test coverage percentage

Poetry ruff pre-commit

PyPI Version Supported Python versions License

Bluetooth Classic (BR/EDR) discovery, pairing and presence on Linux, through BlueZ.

Python has good libraries for Bluetooth Low Energy, such as Bleak, but none of them handle Bluetooth Classic devices: speakers, headphones, printers and serial adapters. This library fills that gap for the housekeeping around such a device. It talks to BlueZ over D-Bus with dbus-fast, in your own asyncio event loop, without compiled extensions or command-line tools.

  • Discover nearby Classic devices, with their names, services and signal strength.
  • Pair with a built-in agent for devices without a screen or keyboard, and trust them.
  • Check presence: whether a known device is on, with a short Classic scan that never connects to it, so it does not wake a device that wakes when connected to.

Connections to a device's services are out of scope: use RFCOMM sockets, or a library such as aio-rfcomm.

Installation

Install this via pip (or your favourite package manager):

pip install bluetooth-classic

It needs Linux with BlueZ 5, and Python 3.11 or newer.

Usage

import asyncio

from bluetooth_classic import BluetoothClassic


async def main() -> None:
    async with await BluetoothClassic.connect() as bluetooth:
        for device in await bluetooth.discover(seconds=10):
            print(device.address, device.name, device.rssi)

        device = await bluetooth.pair("00:11:22:33:44:55")
        await bluetooth.trust(device.address)

        result = await bluetooth.check_presence(device.address)
        print("on" if result.present else "off")


asyncio.run(main())

A Classic scan uses the same radio as Low Energy scanning and interrupts it while it runs. Keep scans short, and in an application that also scans for Low Energy devices, let one part of it decide when they run.

Contributing

See CONTRIBUTING.md.

Credits

The project layout and tooling follow the Bluetooth-Devices libraries, which were created with browniebroke/cookiecutter-pypackage.

Metadata

Release files for bluetooth-classic 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bluetooth-classic 0.1.1
File Size Uploaded Provenance Actions
bluetooth_classic-0.1.1.tar.gz 16.4 kB With provenance Details for bluetooth_classic-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bluetooth-classic 0.1.1
File Interpreter ABI Platform Actions
bluetooth_classic-0.1.1-py3-none-any.whl Python 3 none any Details for bluetooth_classic-0.1.1-py3-none-any.whl

Total release size: 33.6 kB

Release files / bluetooth_classic-0.1.1.tar.gz

Download URL bluetooth_classic-0.1.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
99a0142aa98b6f347037b5a409b5ce46726c8823bb987fa75ec7cd0b3aacb590
BLAKE2b-256 checksum
How to use checksums
528c9587f3571b79eefc6f3dd0025b7646559b9c55bfffae0b883d722f9241e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / bluetooth_classic-0.1.1-py3-none-any.whl

Download URL bluetooth_classic-0.1.1-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a11650a3564c62ebd29db427ebe4944c08688a9e969d6a32ebb958d2cf4a08fd
BLAKE2b-256 checksum
How to use checksums
b96c0c0de6785c570b1e976187d83203a642ab86bed417051f90416a04c6c3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for bluetooth-classic 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bluetooth_classic-0.1.1.tar.gz

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 Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page