Skip to main content

Pulse Python SDK

Official Python client for Pulse Broker.

Installation

pip install pulse-broker

Configuration

The SDK looks for a pulse.yaml (or pulse.yml) file in your project root. If not found, it defaults to localhost:5555 (HTTP) and localhost:5556 (gRPC).

Example pulse.yaml

# Connection Settings
broker:
  host: "localhost"
  http_port: 5555
  grpc_port: 5556
  timeout_ms: 5000

# Client Defaults
client:
  id: "my-python-app"
  auto_commit: true       # Automatically commit offsets after successful processing
  max_retries: 3

# Topic Configuration
topics:
  - name: "events"
    create_if_missing: true
    config:
      fifo: false
      retention_bytes: 1073741824  # 1GB
    consume:
      auto_commit: true

  - name: "transactions"
    create_if_missing: true
    config:
      fifo: true
    consume:
      auto_commit: false  # Manual commit required

  - name: "logs"
    create_if_missing: true
    config:
      fifo: false
    consume:
      auto_commit: true

Usage

Producer

You can send dictionaries (automatically serialized to JSON) or raw bytes.

from pulse import Producer

# Initialize (uses pulse.yaml or defaults)
# You can override settings: Producer(host="10.0.0.1", port=9090)
producer = Producer()

# Send JSON
producer.send("events", {"type": "user_created", "id": 123})

# Send Bytes
producer.send("logs", b"raw log line")

producer.close()

Consumer

Use the @consumer decorator to register message handlers.

from pulse import consumer, commit, run

# Simple Consumer (uses auto_commit from config)
@consumer("events")
def handle_event(msg):
    print(f"Received event: {msg.payload}")
    # msg.payload is a dict if JSON, else bytes

# Manual Commit Consumer
# Override config params directly in the decorator if needed
@consumer("transactions", auto_commit=False)
def handle_transaction(msg):
    try:
        process_payment(msg.payload)
        commit()  # Manually commit offset
        print(f"Processed transaction {msg.offset}")
    except Exception as e:
        print(f"Failed to process: {e}")
        # Do not commit, message will be redelivered on restart/rebalance

if __name__ == "__main__":
    print("Starting consumers...")
    run()  # Blocks and runs all registered consumers

Metadata

Release files for pulse-broker 1.0.14

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

Source distribution (sdist)

Source distribution for pulse-broker 1.0.14
File Size Uploaded Provenance Actions
pulse_broker-1.0.14.tar.gz 12.8 kB Without provenance Details for pulse_broker-1.0.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pulse-broker 1.0.14
File Interpreter ABI Platform Actions
pulse_broker-1.0.14-py3-none-any.whl Python 3 none any Details for pulse_broker-1.0.14-py3-none-any.whl

Total release size: 26.3 kB

Release files / pulse_broker-1.0.14.tar.gz

Download URL pulse_broker-1.0.14.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e750413f5e0f3a4ad682ce9b43a151f5122590d2081749dc4517010fb50b2d3e
BLAKE2b-256 checksum
How to use checksums
0f491b7853b868967fdfc065553bd63040e9217fff8a0da77a1b19d30fbbec47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / pulse_broker-1.0.14-py3-none-any.whl

Download URL pulse_broker-1.0.14-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93cf653a9f89095b19253b085f7fd40e0c721898dfa39494bc0c6649ede31443
BLAKE2b-256 checksum
How to use checksums
9e928e6ff23cd3ee2fff931be486a371b3f49ab60163362dca2e4e5e2c875e3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for pulse-broker 1.0.14

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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