跳到主要内容

安装

aiosignalr 发布在 PyPI 上。用你喜欢的 Python 包管理器安装即可。

pip

pip install aiosignalr

uv

uv add aiosignalr

Poetry

poetry add aiosignalr

环境要求

  • Python 3.11 或更高(支持 3.11、3.12、3.13、3.14)。

  • 以下依赖会自动安装:

    版本用途
    aiohttp>=3.9,<4HTTP 协商、SSE 与 Long Polling 传输
    websockets>=16,<17WebSocket 传输
    msgpack>=1.0,<2MessagePack 协议编码

验证安装

import aiosignalr

print(aiosignalr.__version__ if hasattr(aiosignalr, "__version__") else "ok")

或者直接导入两个顶层模块:

from aiosignalr.client import HubConnection
from aiosignalr.server import Hub, SignalRServer

开发安装

要自己开发 aiosignalr,克隆仓库并安装开发依赖:

git clone https://github.com/TrueRou/aiosignalr.git
cd aiosignalr
uv sync # 安装运行时 + 开发依赖

运行检查:

uv run ruff format .
uv run ruff check .
uv run mypy src
uv run pytest # 自测
uv run pytest tests/interop # 互操作测试(需要 dotnet)

下一步