Metadata-Version: 2.4
Name: esmd-pysdk
Version: 0.1.0
Summary: Asyncio-based Python driver for esmdMQ
Project-URL: Homepage, https://pypi.org/project/esmd-pysdk/
Project-URL: Repository, https://pypi.org/project/esmd-pysdk/
Project-URL: Documentation, https://pypi.org/project/esmd-pysdk/
Author: Liu Zhenhao
License-Expression: MIT
License-File: LICENSE
Keywords: asyncio,esmd,message-queue,mq,sdk
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
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Networking
Requires-Python: >=3.10
Requires-Dist: lz4
Description-Content-Type: text/markdown

# esmd-pysdk

Asyncio-based Python driver for esmdMQ. This project lives at the repo root and is parallel to `drivers/`.

## Requirements

- Python 3.10+
- `lz4` (see `requirements.txt` or `pyproject.toml`)

## Quick Start

```bash
pip install -r requirements.txt
```

Install from PyPI:

```bash
pip install esmd-pysdk
```

Check installed SDK version:

```bash
python -c "import esmd_pysdk; print(esmd_pysdk.__version__)"
```

Producer example:

```bash
python examples/producer.py
```

Consumer example:

```bash
python examples/consumer.py
```

Query example:

```bash
python examples/query.py
```

Matrix example:

```bash
python examples/matrix.py
```

Delete example:

```bash
python examples/delete.py
```

Schedule example (DelayTime + Punctual):

```bash
python examples/schedule.py
```

## Notes

- JSON serialization is canonicalized (sorted keys, compact separators) to keep hash routing consistent with Go.
- Driver uses asyncio; call APIs inside an event loop.
- Producer schedule:
  - `ScheduleMode.SERVER_TIME`: 服务端当前时间（默认）
  - `ScheduleMode.DELAY_TIME`: 延迟投递，参数单位为毫秒（例如 `2000`）
  - `ScheduleMode.PUNCTUAL`: 绝对时间投递，参数为 Unix 毫秒时间戳（例如 `int(time.time() * 1000) + 5000`）
- Consumer delay:
  - `DelayMode.BASE_SERVER`: 基于服务端时间消费（推荐默认）
  - `DelayMode.IGNORE_DELAY`: 忽略延迟立即消费
  - `DelayMode.TIME_DELAY`: 指定延迟窗口（毫秒）

## Recommended Demo Flow

```bash
# 1) 先写入一条固定索引数据
python examples/producer.py

# 2) 查询和矩阵查询（使用与 producer 一致的 filter）
python examples/query.py
python examples/matrix.py

# 3) 删除同一条件下的数据
python examples/delete.py
```

## Release Notes

- Version is managed in `pyproject.toml` (`[project].version`).
- Release guide: `RELEASING.md` (TestPyPI -> PyPI).

Pre-release checklist:

```bash
# 1) version check
python - <<'PY'
import re
print(re.search(r'^version\\s*=\\s*\"([^\"]+)\"', open('pyproject.toml').read(), re.M).group(1))
PY

# 2) tests
python -m pytest tests

# 3) build + metadata check
python -m build
python -m twine check dist/*

# 4) install/import smoke
python -m venv .venv-release
source .venv-release/bin/activate
python -m pip install --upgrade pip
python -m pip install dist/*.whl
python -c "import esmd_pysdk; print('import ok')"
```
