Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "hatchling.build"

[project]
name = "swankit"
version = "0.2.0"
version = "0.2.1"
dynamic = ["readme", "dependencies"]
description = "Base toolkit for SwanLab"
license = "Apache-2.0"
Expand Down
5 changes: 2 additions & 3 deletions swankit/callback/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class SwanKitCallback(ABC):
此处只定义会被调用的函数,用于接口规范
"""

def on_init(self, proj_name: str, workspace: str, logdir: str = None, *args, **kwargs):
def on_init(self, proj_name: str, workspace: str, public: bool = None, logdir: str = None, *args, **kwargs):
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordering the signature by inserting public before logdir may break existing implementations that rely on positional arguments. Consider placing public after logdir or supporting both signatures for backward compatibility.

Copilot uses AI. Check for mistakes.
"""
执行`swanlab.init`时调用,此时运行时环境变量没有被设置,此时修改环境变量还是有效的
:param logdir: str, 用户设置的日志目录
:param proj_name: str, 项目名称
:param public: bool, 是否为公开项目
:param workspace: str, 工作空间
:param kwargs: dict, 其他参数,为了增加灵活性,可以在on_init的时候设置一些其他类内参数
"""
Expand All @@ -42,7 +43,6 @@ def before_init_experiment(
run_id: str,
exp_name: str,
description: str,
num: int,
colors: Tuple[str, str],
*args,
**kwargs,
Expand All @@ -52,7 +52,6 @@ def before_init_experiment(
:param run_id: str, SwanLabRun的运行id
:param exp_name: str, 实验名称
:param description: str, 实验描述
:param num: int, 历史实验数量
:param colors: Tuple[str, str], 实验颜色,[light, dark]
"""
pass
Expand Down
4 changes: 2 additions & 2 deletions swankit/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SwanLabMode(Enum):

DISABLED = "disabled"
CLOUD = "cloud"
CLOUD_ONLY = "cloud-only"
BACKUP = "backup"
Comment thread
SAKURA-CAT marked this conversation as resolved.
LOCAL = "local"

@classmethod
Expand All @@ -49,7 +49,7 @@ class SwanLabSharedEnv(Enum):
"""
SWANLAB_MODE = "SWANLAB_MODE"
"""
swanlab的解析模式,涉及操作员注册的回调,目前有三种:local、cloud、disabled,默认为cloud
swanlab的解析模式,涉及操作员注册的回调,目前有四种:local、cloud、disabled 和 backup,默认为cloud
大小写不敏感
"""

Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_list_mode():
assert len(ms) == 4
assert "disabled" in ms
assert "cloud" in ms
assert "cloud-only" in ms
assert "backup" in ms
assert "local" in ms


Expand Down