Metadata-Version: 2.4
Name: wave-python-sdk
Version: 0.2.8
Summary: Python SDK for wave-mq binary protocol
Author: Pavel
License: MIT License
        
        Copyright (c) 2026 C4erries
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/c4erries/wave-python-sdk
Keywords: wave-mq,messaging,client,binary-protocol
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# wavemq

`wavemq` is the Python SDK for `wave-mq`. It provides one client API over two transports:

- `transport="tcp"` for the custom binary protocol
- `transport="http"` for the broker HTTP API

TCP is the default and is the best fit for binary payloads. HTTP is useful for preview flows and simpler integrations.

## Install

```powershell
python -m pip install wave-python-sdk
```

## Quick start

```python
from wavemq import WaveMQClient

with WaveMQClient("127.0.0.1:7912") as client:
    client.ping()
    client.create_topic("demo", partitions=1, replication_factor=1)
    client.produce("demo", ["hello"], key="demo-key")
    result = client.fetch("demo", 0, offset=0)
    print(result.records[0].value)
```

HTTP uses the same surface:

```python
from wavemq import WaveMQClient

with WaveMQClient("http://127.0.0.1:8090", transport="http") as client:
    client.ping()
    client.create_topic("demo", partitions=1, replication_factor=1)
    client.produce("demo", ["hello"], key="demo-key")
    result = client.fetch("demo", 0, offset=0)
    print(result.records[0].value)
```

## Helper API

For tiny scripts and preview examples, the client also exposes additive helpers:

- `ensure_topic(...)`
- `produce_one(...)`
- `produce_many(...)`
- `produce_to_partition(...)`
- `produce_one_to_partition(...)`
- `produce_many_to_partition(...)`
- `fetch_from_offset(...)`
- `fetch_latest(...)`
- `resolve_consume_offset(...)`
- `consume_poll(...)`

`Record` also supports `content_type`, which maps to the canonical `content-type` header on TCP and to the `contentType` JSON field on HTTP.

By default, consumer helpers resume from `committed + 1` when a group already has state.
If the group has no committed offset yet, they start from the earliest available offset.
The high-level `produce` path routes by key and does not let you choose the partition directly.
If you need explicit partition control, use the `produce_*_to_partition(...)` variants.

## Examples

Runnable examples live in:

- `examples/python/sdk/tcp`
- `examples/python/sdk/http`

The TCP folder also contains `simple` in-file producer/consumer/replay scripts for quick manual checks and offset reruns.

## Notes

- Use `transport="tcp"` if you need raw bytes and the binary protocol.
- Use `transport="http"` if you want a broker-address-only integration path.
- The package is intentionally small and has no runtime dependencies beyond the standard library.
