fish-edge-gateway-sdk (Python)
接入 apex-edge-gateway 的服务侧 SDK:manifest 声明与暴露、internal auth、trace 透传。协议契约见仓库 docs/contracts/。
安装(不发布 PyPI,直接 git 依赖)
# requirements.txt / pyproject dependency(锁 tag 或 commit,不要追 main)
fish-edge-gateway-sdk @ git+ssh://git@github.com/fishaudio/apex-edge-gateway.git@<tag-or-sha>#subdirectory=sdk-python
# 本地开发
pip install "fish-edge-gateway-sdk @ git+ssh://git@github.com/fishaudio/apex-edge-gateway.git@main#subdirectory=sdk-python"
# uv
uv add "fish-edge-gateway-sdk @ git+ssh://git@github.com/fishaudio/apex-edge-gateway.git@main#subdirectory=sdk-python"
# CI / Docker(https + token,避免挂 ssh key)
pip install "fish-edge-gateway-sdk @ git+https://${GITHUB_TOKEN}@github.com/fishaudio/apex-edge-gateway.git@<sha>#subdirectory=sdk-python"
版本锁定约定:SDK 变更打 sdk-python/vX.Y.Z 形式的 git tag,服务锁 tag 升级;紧急验证可锁 commit sha。
集成
from fastapi import Depends, FastAPI
from fish_edge_gateway_sdk import edge_route, mount_edge, require_gateway
app = FastAPI()
@app.post("/internal/asr", dependencies=[Depends(require_gateway)])
@edge_route(auth="internal")
async def asr(payload: dict) -> dict: ...
mount_edge(app, service="omni-asr") # 挂载 GET /.edge/manifest
k8s Service 侧标注(manifest 契约 §2.1):
metadata:
annotations:
fish.audio/edge-discovery: enable
# 可选:manifest 端点与业务端口分离时
# fish.audio/edge-discovery-port: "9090"
# fish.audio/edge-discovery-url: /.edge/manifest
gateway 侧无需额外授权:发现 namespace 的成员资格就是信任边界(manifest 契约 §11),被发现的 manifest 其 route 直接编译。
环境变量
| 变量 | 语义 |
|---|---|
FISH_EDGE_GATEWAY_TOKEN |
期望的 x-fish-gateway-token。未设 = 观察模式(只记日志) |
FISH_EDGE_REQUIRE_GATEWAY |
1 时强制校验(403 拒绝非 gateway 流量)。P6 gateway 下发 token 后开启 |
开发
pip install -e "sdk-python[dev]"
pytest sdk-python/tests -q
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fish_edge_gateway_sdk-0.1.0.tar.gz.
File metadata
- Download URL: fish_edge_gateway_sdk-0.1.0.tar.gz
- Upload date:
- Size: 38.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
820d9147ab9b8b008bbea0ac810a115c28a12de4899cb9e517d2fccb5131b8f3
|
|
| MD5 |
592ecf7c3d63306f970fdaabd8244d59
|
|
| BLAKE2b-256 |
a0df06aa2016c02c4ab0d4e2ca0170db6ff72260568b78812d23faf5c90019b4
|
File details
Details for the file fish_edge_gateway_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fish_edge_gateway_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41ced9ddefe3c3c6714a419da6a33dfb5003f7db27789b221e0ddcd9ef9bf9ed
|
|
| MD5 |
f677faf338c74188ee8f7382f9e74e4b
|
|
| BLAKE2b-256 |
74d725fec9b325bd677c225616874cc88bfa8ff3467c146f63ce39b84c86d53c
|