Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,58 @@

Pulsar Python clients support a variety of Pulsar features to enable building applications connecting to your Pulsar cluster. For the supported Pulsar features, see [Client Feature Matrix](https://pulsar.apache.org/client-feature-matrix/).

## Requirements
## Quick install

Install pre-built wheels for Python 3.10–3.15 from PyPI:

```bash
pip install pulsar-client
```

Optional extras are available for Avro schemas, Protobuf schemas, and Pulsar Functions:

```bash
pip install "pulsar-client[avro]"
pip install "pulsar-client[protobuf]"
pip install "pulsar-client[functions]"
pip install "pulsar-client[all]"
```

## Quickstart

Ensure a Pulsar broker is running locally (see the [standalone quick start](https://pulsar.apache.org/docs/getting-started-standalone)).

Produce a message:

```python
import pulsar

client = pulsar.Client("pulsar://localhost:6650")
try:
producer = client.create_producer("my-topic")
producer.send(b"Hello Pulsar!")
finally:
client.close()
```

Consume a message:

```python
import pulsar

client = pulsar.Client("pulsar://localhost:6650")
try:
consumer = client.subscribe("my-topic", "my-subscription")
msg = consumer.receive()
print(f"Received message '{msg.data().decode('utf-8')}' id='{msg.message_id()}'")
consumer.acknowledge(msg)
finally:
client.close()
```

## Building from source

### Requirements

- Python 3.10, 3.11, 3.12, 3.13, 3.14 or 3.15
- A C++ compiler that supports C++11
Expand Down
Empty file added pulsar/py.typed
Empty file.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def build_extension(self, ext):
name=NAME,
version=VERSION,
packages=['pulsar', 'pulsar.schema', 'pulsar.functions'],
package_data={'pulsar': ['py.typed']},
cmdclass={'build_ext': my_build_ext},
ext_modules=[Extension('_pulsar', [])],

Expand Down