Build any realtime experience using Ably’s Pub/Sub Python SDK.
Ably Pub/Sub provides flexible APIs that deliver features such as pub-sub messaging, message history, presence, and push notifications. Utilizing Ably’s realtime messaging platform, applications benefit from its highly performant, reliable, and scalable infrastructure.
Find out more:
Everything you need to get started with Ably:
Ably aims to support a wide range of platforms. If you experience any compatibility issues, open an issue in the repository or contact Ably support.
The following platforms are supported:
| Platform | Support |
|---|---|
| Python | Python 3.7+ through 3.13 |
Note
This SDK works across all major operating platforms (Linux, macOS, Windows) as long as Python 3.7+ is available.
Important
SDK versions < 2.0.0-beta.6 will be deprecated from November 1, 2025.
To get started with your project, install the package:
pip install ablyNote
Install Python version 3.8 or greater.
The following code connects to Ably's realtime messaging service, subscribes to a channel to receive messages, and publishes a test message to that same channel.
# Initialize Ably Realtime clientasyncwithAblyRealtime('your-ably-api-key', client_id='me') asrealtime_client: # Wait for connection to be establishedawaitrealtime_client.connection.once_async('connected') print('Connected to Ably') # Get a reference to the 'test-channel' channelchannel=realtime_client.channels.get('test-channel') # Subscribe to all messages published to this channeldefon_message(message): print(f'Received message: {message.data}') awaitchannel.subscribe(on_message) # Publish a test message to the channelawaitchannel.publish('test-event', 'hello world')The CHANGELOG.md contains details of the latest releases for this SDK. You can also view all Ably releases on changelog.ably.com.
Read the CONTRIBUTING.md guidelines to contribute to Ably.
For help or technical support, visit Ably's support page or GitHub Issues for community-reported bugs and discussions.
This SDK currently supports only Ably REST and basic realtime message subscriptions. To access full Ably Realtime features in Python, consider using the MQTT adapter.
