Croupier Python SDK for Game Function Registration and File Transfer
Project description
Croupier Python SDK
同步 Python SDK,用于 Croupier 游戏函数注册与执行系统
简介
Croupier Python SDK 是 Croupier 游戏后端平台的官方 Python 客户端实现。它提供了同步的 gRPC 通信、心跳维护、线程安全的作业状态管理以及 Provider Manifest 上传功能。
系统要求
- Python ≥ 3.12
- grpcio, protobuf
安装
使用 pip(传统方式)
cd sdks/python
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
使用 uv(推荐,更快速)
pip install uv
cd croupier-sdk-python
uv sync --dev --all-extras
快速开始
import json
from croupier import CroupierClient, ClientConfig, FunctionDescriptor
config = ClientConfig(
agent_addr="127.0.0.1:19090",
control_addr="127.0.0.1:18080",
service_id="python-demo",
service_version="1.0.0",
)
client = CroupierClient(config)
def player_ban(_context: str, payload: bytes) -> str:
req = json.loads(payload.decode("utf-8"))
return json.dumps({
"status": "ok",
"player_id": req["player_id"],
})
client.register_function(FunctionDescriptor(id="player.ban", version="1.0.0"), player_ban)
client.connect()
print("✅ python-demo 已注册并正在服务 gRPC 流量")
开发指南
使用 uv 开发(推荐)
pip install uv
uv sync --dev --all-extras
uv run pytest
uv run python examples/main.py
uv build
使用 pip 开发
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
python -m pytest
python examples/main.py
其他语言 SDK
| 语言 | 仓库 | Nightly | Release | Docs | Coverage |
|---|---|---|---|---|---|
| C++ | croupier-sdk-cpp | ||||
| Go | croupier-sdk-go | ||||
| Java | croupier-sdk-java | ||||
| JS/TS | croupier-sdk-js | ||||
| C# | croupier-sdk-csharp | ||||
| Lua | croupier-sdk-cpp | - | - | - |
贡献指南
- 确保所有类型与 proto 定义对齐
- 为新功能添加测试
- 更新 API 变更的文档
- 遵循 Python 编码规范(PEP 8)
欢迎贡献!请随时提交 issue 或 PR。💡
许可证
本项目采用 Apache License 2.0 开源协议。
Project details
Release history Release notifications | RSS feed
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 croupier_sdk-0.1.0.tar.gz.
File metadata
- Download URL: croupier_sdk-0.1.0.tar.gz
- Upload date:
- Size: 33.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b636368adf52617e9a5393128a6a0d957bb801a6f0b0df2633720c0c83015ea8
|
|
| MD5 |
d5a9f9994f8f5975842ebb75c9925e95
|
|
| BLAKE2b-256 |
2e66cb13f05a74b4c1da5cd66eee5db4c0e38dd74b449ee5458ea68488e6a065
|
Provenance
The following attestation bundles were made for croupier_sdk-0.1.0.tar.gz:
Publisher:
publish.yml on cuihairu/croupier-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
croupier_sdk-0.1.0.tar.gz -
Subject digest:
b636368adf52617e9a5393128a6a0d957bb801a6f0b0df2633720c0c83015ea8 - Sigstore transparency entry: 832655258
- Sigstore integration time:
-
Permalink:
cuihairu/croupier-sdk-python@f1291a4e2ce5391b25ae28ffd3dff1c0ebd69f31 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cuihairu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1291a4e2ce5391b25ae28ffd3dff1c0ebd69f31 -
Trigger Event:
release
-
Statement type:
File details
Details for the file croupier_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: croupier_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a89dc5acdcf4b1c95e4b341f722a082b03dc71f7bb9844221cc7cbccc948ea8c
|
|
| MD5 |
1edc91bb3e17b4b626ec70bc0a3001e6
|
|
| BLAKE2b-256 |
2150d4497df1479827bb35af1bd0c9bee734917e00215363d159c08ab343762c
|
Provenance
The following attestation bundles were made for croupier_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on cuihairu/croupier-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
croupier_sdk-0.1.0-py3-none-any.whl -
Subject digest:
a89dc5acdcf4b1c95e4b341f722a082b03dc71f7bb9844221cc7cbccc948ea8c - Sigstore transparency entry: 832655260
- Sigstore integration time:
-
Permalink:
cuihairu/croupier-sdk-python@f1291a4e2ce5391b25ae28ffd3dff1c0ebd69f31 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cuihairu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1291a4e2ce5391b25ae28ffd3dff1c0ebd69f31 -
Trigger Event:
release
-
Statement type: