SwanLab Toolkit

raw JSON →
0.2.4 verified Fri May 01 auth: no python

Base toolkit for SwanLab, a machine learning experiment tracking and visualization platform. Version 0.2.4 provides core utilities like data models, chart types (ECharts), and helper functions for building SwanLab extensions. Released on PyPI with active development.

pip install swankit
error ModuleNotFoundError: No module named 'swankit'
cause swankit is not installed.
fix
Run: pip install swankit
error ImportError: cannot import name 'System' from 'swankit'
cause Incorrect import path; System is in swankit.env submodule.
fix
Use: from swankit.env import System
error AttributeError: module 'swankit' has no attribute 'ChartType'
cause ChartType is not directly in swankit; it's in swankit.chart.
fix
Use: from swankit.chart import ChartType
error TypeError: Can't instantiate abstract class SwanLabModel with abstract methods
cause SwanLabModel is an abstract base class; use a concrete subclass or implement required methods.
fix
Create a subclass that implements all abstract methods, or use a provided concrete model from swankit.models.
gotcha Do not import directly from swankit (e.g., from swankit import ...). Many classes are in submodules like swankit.env, swankit.chart, swankit.models.
fix Use the correct submodule import path (e.g., from swankit.env import System).
gotcha swankit is separate from swanlab; installing swankit does not install swanlab. If you need full experiment tracking, install swanlab explicitly.
fix Install swanlab via pip install swanlab if needed.
gotcha The API is still evolving; breaking changes may occur between minor versions (e.g., v0.1.x to v0.2.0). Check changelog before upgrading.
fix Pin exact version or review release notes.

Basic usage of swankit: access environment system info and chart type enum.

from swankit.env import System
from swankit.chart import ChartType

# Access system info
sys_info = System(info={'python_version': '3.10', 'os': 'Linux'})
print(sys_info.info)

# Use chart types
chart_type = ChartType.LINE
print(chart_type)