Famou SDK
Famou OpenAPI 的 Python SDK,提供同步/异步客户端和命令行工具。
安装
pip install famou-sdk
快速开始
同步客户端
from famou_sdk import FamouClient
client = FamouClient(
endpoint="https://famou.example.com",
api_key="your-api-key"
)
# 1. 上传物料包
pkg = client.package_create(
file_path="./data.tar.gz",
upload_mode="full"
)
print(f"File ID: {pkg.data.file_id}")
# 2. 创建实验
exp = client.experiment_create(
name="my-experiment",
file_id=pkg.data.file_id
)
print(f"Experiment ID: {exp.data.exp_id}")
# 3. 查看实验状态
info = client.experiment_info(exp.data.exp_id)
print(f"Status: {info.data.status}")
异步客户端
import asyncio
from famou_sdk import AsyncFamouClient
async def main():
async with AsyncFamouClient(
endpoint="https://famou.example.com",
api_key="your-api-key"
) as client:
pkg = await client.package_create("./data.tar.gz", "full")
exp = await client.experiment_create("my-exp", pkg.data.file_id)
info = await client.experiment_info(exp.data.exp_id)
print(f"Status: {info.data.status}")
asyncio.run(main())
API
初始化参数
| 参数 | 类型 | 说明 |
|---|---|---|
| endpoint | str | API 服务端点 |
| api_key | str | API 密钥 |
| timeout | float | 请求超时(秒),默认 30.0 |
物料包管理
| 方法 | 说明 |
|---|---|
package_create(file_path, upload_mode, file_id?, delete_files?) |
新建/更新物料包(仅支持 tar.gz) |
package_info(file_id) |
查询物料包详情 |
package_list() |
列出所有物料包 |
实验管理
| 方法 | 说明 |
|---|---|
experiment_create(name, file_id) |
创建实验 |
experiment_update(exp_id, name, file_id) |
更新实验 |
experiment_info(exp_id) |
获取实验详情 |
experiments_list() |
列出所有实验 |
experiment_pause(exp_id) |
暂停实验 |
experiment_resume(exp_id) |
继续实验 |
experiment_cancel(exp_id) |
取消实验 |
experiment_delete(exp_id) |
删除实验 |
experiment_report(exp_id) |
获取实验报告下载地址 |
experiment_result(exp_id) |
获取最优解下载地址 |
experiment_log(exp_id, playback?, timeout?) |
获取实验日志(SSE 流式) |
experiment_log_to_file(exp_id, output_path, playback?, timeout?) |
日志保存到文件 |
评测管理
| 方法 | 说明 |
|---|---|
evaluation_create(evaluation_id, exp_id, code, dependencies?, iteration?, timeout?) |
创建评测任务 |
evaluation_get(evaluation_id, exp_id) |
获取评测任务详情 |
evaluation_assign(exp_id, evaluator?, max_count?) |
分配评测任务 |
evaluation_submit_result(evaluators) |
提交评测结果 |
认证
| 方法 | 说明 |
|---|---|
login() |
登录认证 |
错误处理
from famou_sdk import FamouAPIError
try:
client.experiment_info("exp-xxx")
except FamouAPIError as e:
print(f"Error: {e.code} - {e.message}")
日志设置
from famou_sdk import set_log_level
# 设置日志级别,可选值: DEBUG, INFO, WARNING, ERROR, CRITICAL
set_log_level("DEBUG") # 输出详细调试信息
set_log_level("INFO") # 输出一般信息
set_log_level("WARNING") # 默认级别,仅输出警告和错误
CLI 工具
安装后自动创建 famou-ctl 命令。
# 登录认证
famou-ctl login
# 初始化项目
famou-ctl init my-project
# 本地测试
famou-ctl test --config config.yaml
# 物料包管理
famou-ctl package create ./project
famou-ctl package upload ./package.tar.gz
famou-ctl package info <package_id>
# 实验管理
famou-ctl experiment create --config ./project/config.yaml --experiment-name my-exp
famou-ctl experiment list
famou-ctl experiment status <exp_id>
famou-ctl experiment pause <exp_id>
famou-ctl experiment resume <exp_id>
famou-ctl experiment cancel <exp_id>
famou-ctl experiment delete <exp_id>
famou-ctl experiment update <exp_id> --config config.yaml
famou-ctl experiment logs <exp_id>
famou-ctl experiment results <exp_id>
famou-ctl experiment report <exp_id>
# 混合云评测
famou-ctl evaluator start --experiment-id <exp_id> --evaluator-path ./evaluator.py
# 升级
famou-ctl upgrade
# 登出
famou-ctl logout
许可证
Apache License 2.0
Metadata
Release files for famou-sdk 2.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| famou_sdk-2.5.2.tar.gz | 137.6 kB | Without provenance | Details for famou_sdk-2.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| famou_sdk-2.5.2-py3-none-any.whl | Python 3 | none | any | Details for famou_sdk-2.5.2-py3-none-any.whl |
Total release size: 296.1 kB
Release files / famou_sdk-2.5.2.tar.gz
| Download URL | famou_sdk-2.5.2.tar.gz |
|---|---|
| Size | 137.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cc297e9f67c6508cba3c8a04bf173101324db58d5d1d63ab05ea3d3dcc168a8
|
|
BLAKE2b-256 checksum How to use checksums |
138f4c0a2e7afc3bce1a1bd10bb1cc165e57918113608959b4c3f1ce94c9d522
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / famou_sdk-2.5.2-py3-none-any.whl
| Download URL | famou_sdk-2.5.2-py3-none-any.whl |
|---|---|
| Size | 158.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d220af9d45651ab667ee708c43ef4e7d1b1d7977cf7510cc8c89e36ef08823c4
|
|
BLAKE2b-256 checksum How to use checksums |
542818ae040adc9929e43f4680a3343d0a1056ebcde5051c88b01a8d577dc83d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for famou-sdk 2.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.