Skip to main content

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.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for famou-sdk 2.6.1
File Size Uploaded Provenance Actions
famou_sdk-2.6.1.tar.gz 195.7 kB Without provenance Details for famou_sdk-2.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for famou-sdk 2.6.1
File Interpreter ABI Platform Actions
famou_sdk-2.6.1-py3-none-any.whl Python 3 none any Details for famou_sdk-2.6.1-py3-none-any.whl

Total release size: 429.5 kB

Release files / famou_sdk-2.6.1.tar.gz

Download URL famou_sdk-2.6.1.tar.gz
Size 195.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e0bda019de102fa5211017bb2811d33ec1bdf5f7b2436f7352dd21e69b02a172
BLAKE2b-256 checksum
How to use checksums
9da1d79c28c9af84666ddb196518761b08ec87e026051f54fdfd003ffd68b8f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / famou_sdk-2.6.1-py3-none-any.whl

Download URL famou_sdk-2.6.1-py3-none-any.whl
Size 233.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaa7289ed435733409322ac4b5db4f6420997fb77a42eacda28a555b8e583206
BLAKE2b-256 checksum
How to use checksums
917c9e21bd164099b33873662459b1a938569a4ef3309fc6f7b19f6e2d116c37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for famou-sdk 2.6.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page