diff --git a/README.md b/README.md index eff3dae..2ea30bc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pulsar/py.typed b/pulsar/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 370205d..f6dcacc 100755 --- a/setup.py +++ b/setup.py @@ -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', [])],