Skip to content

Commit 11f33c2

Browse files
committed
add docstrings
1 parent 0cd338d commit 11f33c2

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

trackio/__init__.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,20 @@
2929

3030

3131
def init(
32-
project: str, name: str | None = None, space_id=None, config: dict | None = None
32+
project: str,
33+
name: str | None = None,
34+
space_id: str | None = None,
35+
config: dict | None = None,
3336
) -> Run:
37+
"""
38+
Creates a new Trackio project and returns a Run object.
39+
40+
Args:
41+
project: The name of the project (can be an existing project to continue tracking or a new project to start tracking from scratch).
42+
name: The name of the run (if not provided, a default name will be generated).
43+
space_id: If provided, the project will be logged to a Hugging Face Space instead of a local directory. Should be a complete Space name like "username/reponame". If the Space does not exist, it will be created. If the Space already exists, the project will be logged to it.
44+
config: A dictionary of configuration options. Provided for compatibility with wandb.init()
45+
"""
3446
if not current_server.get():
3547
if space_id is None:
3648
_, url, _ = demo.launch(
@@ -89,18 +101,33 @@ def init(
89101

90102

91103
def log(metrics: dict) -> None:
104+
"""
105+
Logs metrics to the current run.
106+
107+
Args:
108+
metrics: A dictionary of metrics to log.
109+
"""
92110
if current_run.get() is None:
93111
raise RuntimeError("Call trackio.init() before log().")
94112
current_run.get().log(metrics)
95113

96114

97115
def finish():
116+
"""
117+
Finishes the current run.
118+
"""
98119
if current_run.get() is None:
99120
raise RuntimeError("Call trackio.init() before finish().")
100121
current_run.get().finish()
101122

102123

103124
def show(project: str | None = None):
125+
"""
126+
Launches the Trackio dashboard.
127+
128+
Args:
129+
project: The name of the project whose runs to show. If not provided, all projects will be shown and the user can select one.
130+
"""
104131
_, url, share_url = demo.launch(
105132
show_api=False,
106133
quiet=True,

0 commit comments

Comments
 (0)