labnotes 0.0.17__tar.gz → 0.0.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {labnotes-0.0.17 → labnotes-0.0.18}/PKG-INFO +5 -1
- {labnotes-0.0.17 → labnotes-0.0.18}/README.md +4 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/context.md +4 -0
- labnotes-0.0.18/src/labnotes/create_experiment.py +32 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/experiments.py +15 -2
- {labnotes-0.0.17 → labnotes-0.0.18}/.gitignore +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/CHANGELOG.md +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/MIGRATIONS.md +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/pyproject.toml +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/__init__.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/asset_url.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/cell_progress.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/cli.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/context_guide.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/count_runs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/create_app.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/data_html.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/default_config_text.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/drain_watch.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/format_value.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/init.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/list_experiments.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/list_runs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/load_config.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/load_experiment.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/models.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/notebook_kernel.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/open_experiments.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/open_runs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/output_html.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/parse_run_view.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/pivot_cells.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/print_rows.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/python_blocks.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/read_config.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/read_design.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/read_note.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/read_path.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/render_markdown.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/run_columns.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/__init__.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/describe_event.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/execute_run.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/lock_path.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/new_run_id.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/param_args.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/param_grid.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/plan_runs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/read_experiment_config.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/run_experiment.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/run_folder.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/run_headless.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/shell_command.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/start_experiment.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/stop_then_kill.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/runner/write_run_json.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/saved_outputs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/serve_app.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/server.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/sort_href.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/sql_quote.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/static/labnotes.css +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/static/row-link.js +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/static/run-cell.js +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/static/view-toggle.js +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/stop_idle_kernels.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/study_progress.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/summarize_design.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/__init__.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/experiment_rows.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/file_prefix.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/iso_time.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/list_experiment_runs.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/open_tables.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/path_glob.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/path_pattern.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/read_experiment.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/read_file.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/read_run.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tables/summarize_experiments.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/templates/base.html +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/templates/experiment.html +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/templates/index.html +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/templates/macros.html +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tui/__init__.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tui/format_elapsed.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tui/run_app.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/src/labnotes/tui/run_tui.py +0 -0
- {labnotes-0.0.17 → labnotes-0.0.18}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: labnotes
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.18
|
|
4
4
|
Summary: Browse experiment designs, notes, and run data from a folder.
|
|
5
5
|
Project-URL: Repository, https://github.com/thekevinscott/labnotes
|
|
6
6
|
Author-email: Kevin Scott <me@thekevinscott.com>
|
|
@@ -69,6 +69,10 @@ labnotes experiments foo runs # foo's runs, oldest first
|
|
|
69
69
|
|
|
70
70
|
Each takes `--format table` (the default) or `--format json`.
|
|
71
71
|
|
|
72
|
+
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
73
|
+
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
74
|
+
be an experiment name.
|
|
75
|
+
|
|
72
76
|
`labnotes experiments foo run` runs `foo` from its `experiment.toml`, in the
|
|
73
77
|
experiments folder:
|
|
74
78
|
|
|
@@ -46,6 +46,10 @@ labnotes experiments foo runs # foo's runs, oldest first
|
|
|
46
46
|
|
|
47
47
|
Each takes `--format table` (the default) or `--format json`.
|
|
48
48
|
|
|
49
|
+
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
50
|
+
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
51
|
+
be an experiment name.
|
|
52
|
+
|
|
49
53
|
`labnotes experiments foo run` runs `foo` from its `experiment.toml`, in the
|
|
50
54
|
experiments folder:
|
|
51
55
|
|
|
@@ -36,6 +36,10 @@ labnotes experiments foo runs # foo's runs, oldest first
|
|
|
36
36
|
|
|
37
37
|
Each takes `--format table` (the default) or `--format json`; use `--format json` when you parse the output.
|
|
38
38
|
|
|
39
|
+
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
40
|
+
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
41
|
+
be an experiment name.
|
|
42
|
+
|
|
39
43
|
`labnotes experiments foo run` runs `foo` from its `experiment.toml`, in the
|
|
40
44
|
experiments folder:
|
|
41
45
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from labnotes.models import LabnotesConfig
|
|
4
|
+
from labnotes.runner.new_run_id import new_run_id
|
|
5
|
+
|
|
6
|
+
STARTER = """\
|
|
7
|
+
# Runs from the project root. {run_dir} becomes the run's folder.
|
|
8
|
+
command = "uv run script.py --output {run_dir}"
|
|
9
|
+
repeats = 1
|
|
10
|
+
|
|
11
|
+
# Each combination runs `repeats` times, passed as --name value.
|
|
12
|
+
[params]
|
|
13
|
+
# model = ["opus", "sonnet"]
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def create_experiment(config: LabnotesConfig, name: str | None) -> Path:
|
|
18
|
+
def folder(candidate: str) -> Path:
|
|
19
|
+
return config.root / config.experiments.replace("{experiment}", candidate)
|
|
20
|
+
|
|
21
|
+
if name is None:
|
|
22
|
+
name = new_run_id(lambda candidate: folder(candidate).exists())
|
|
23
|
+
if name == "new":
|
|
24
|
+
raise ValueError("new is reserved; pick another name.")
|
|
25
|
+
if "/" in name or name.startswith("."):
|
|
26
|
+
raise ValueError(f"{name} can't be an experiment name.")
|
|
27
|
+
path = folder(name)
|
|
28
|
+
if path.exists():
|
|
29
|
+
raise ValueError(f"{name} already exists at {path}.")
|
|
30
|
+
path.mkdir(parents=True)
|
|
31
|
+
(path / "experiment.toml").write_text(STARTER, encoding="utf-8")
|
|
32
|
+
return path
|
|
@@ -4,6 +4,7 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
6
|
|
|
7
|
+
from labnotes.create_experiment import create_experiment
|
|
7
8
|
from labnotes.load_config import load_config
|
|
8
9
|
from labnotes.print_rows import print_rows
|
|
9
10
|
from labnotes.read_config import CONFIG_FILE
|
|
@@ -13,9 +14,12 @@ from labnotes.tables.experiment_rows import experiment_rows
|
|
|
13
14
|
from labnotes.tui.run_tui import run_tui
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
@click.command(
|
|
17
|
+
@click.command(
|
|
18
|
+
help="List experiments, show one, list its runs, or run it."
|
|
19
|
+
" `new [NAME]` creates one."
|
|
20
|
+
)
|
|
17
21
|
@click.argument("name", required=False)
|
|
18
|
-
@click.argument("action", required=False,
|
|
22
|
+
@click.argument("action", required=False, metavar="[runs|run]")
|
|
19
23
|
@click.option(
|
|
20
24
|
"--format",
|
|
21
25
|
"output_format",
|
|
@@ -57,6 +61,13 @@ def experiments(
|
|
|
57
61
|
f"No {CONFIG_FILE} here. Run labnotes init, or pass -c PATH."
|
|
58
62
|
)
|
|
59
63
|
match name, action:
|
|
64
|
+
case "new", _:
|
|
65
|
+
try:
|
|
66
|
+
path = create_experiment(config, action)
|
|
67
|
+
except ValueError as error:
|
|
68
|
+
raise click.ClickException(str(error)) from error
|
|
69
|
+
click.echo(f"Created {path / 'experiment.toml'}")
|
|
70
|
+
return
|
|
60
71
|
case str(), "run":
|
|
61
72
|
live = sys.stdout.isatty() and sys.stderr.isatty() and not no_tui
|
|
62
73
|
drive = run_tui if live else lambda start, title: run_headless(start)
|
|
@@ -69,6 +80,8 @@ def experiments(
|
|
|
69
80
|
failed = sum(result["exit_code"] != 0 for result in results)
|
|
70
81
|
click.echo(f"{len(results) - failed} passed, {failed} failed.")
|
|
71
82
|
ctx.exit(1 if failed else 0)
|
|
83
|
+
if action not in (None, "runs"):
|
|
84
|
+
raise click.UsageError(f"Unknown action {action}. Use runs or run.")
|
|
72
85
|
rows = asyncio.run(experiment_rows(config, name, action))
|
|
73
86
|
if rows is None:
|
|
74
87
|
raise click.ClickException(f"No experiment named {name}.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|