Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SpecForge Python SDK

SpecForge Python SDKは、SpecForge APIと連携し、形式仕様のモニタリング、アニメーション、エクスポート、および例示を可能にするためのSDKです。

インストール

cd tools/python
pip install -e .

クイックスタート

from specforge_sdk import SpecForgeClient

# クライアントの初期化
client = SpecForgeClient(base_url="http://localhost:8080")

# APIの健全性チェック
if client.health_check():
    print("✓ SpecForge APIに接続しました")
    print(f"APIバージョン: {client.version()}")
else:
    print("✗ SpecForge APIに接続できません")

主な機能

SDKは、SpecForgeの主要な機能へのアクセスを提供します:

  • モニタリング: データに対して仕様をチェック
  • アニメーション: 時系列の可視化を作成
  • エクスポート: 仕様を異なる形式に変換
  • 例示: 仕様を満たすサンプルデータを生成

ドキュメント

包括的なデモノートブック sample-project/demo.ipynb をご覧ください。以下の内容が含まれています:

  • 詳細な使用例
  • Jupyter notebookとの統合
  • カスタムレンダリング機能
  • エラーハンドリングパターン
  • 完全なAPIリファレンス

APIメソッド

  • monitor(spec_file, definition, data_file, ...) - 仕様のモニタリング
  • animate(spec_file, data_file, svg_file, ...) - アニメーションの作成
  • export(spec_file, definition, export_type, ...) - 仕様のエクスポート
  • exemplify(spec_file, definition, n_points, ...) - サンプルの生成
  • health_check() - APIの可用性チェック
  • version() - APIバージョンの取得

対応ファイル形式

  • 仕様: .lilo ファイル
  • データ: .csv, .json, .jsonl ファイル
  • 可視化: .svg ファイル

必要要件

  • Python 3.12+
  • requests>=2.25.0
  • urllib3>=1.26.0