hydraflow 0.7.2__py3-none-any.whl → 0.7.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
hydraflow/cli.py ADDED
@@ -0,0 +1,75 @@
1
+ """Hydraflow CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Annotated
7
+
8
+ import typer
9
+ from omegaconf import DictConfig, OmegaConf
10
+ from rich.console import Console
11
+ from typer import Argument, Option
12
+
13
+ app = typer.Typer(add_completion=False)
14
+ console = Console()
15
+
16
+
17
+ @app.command()
18
+ def run(
19
+ names: Annotated[
20
+ list[str] | None,
21
+ Argument(help="Job names.", show_default=False),
22
+ ] = None,
23
+ ) -> None:
24
+ """Run jobs."""
25
+ typer.echo(names)
26
+
27
+ cfg = load_config()
28
+ typer.echo(cfg)
29
+
30
+
31
+ @app.command()
32
+ def show() -> None:
33
+ """Show the config."""
34
+ from rich.syntax import Syntax
35
+
36
+ cfg = load_config()
37
+ code = OmegaConf.to_yaml(cfg)
38
+ syntax = Syntax(code, "yaml")
39
+ console.print(syntax)
40
+
41
+
42
+ @app.callback(invoke_without_command=True)
43
+ def callback(
44
+ *,
45
+ version: Annotated[
46
+ bool,
47
+ Option("--version", help="Show the version and exit."),
48
+ ] = False,
49
+ ) -> None:
50
+ if version:
51
+ import importlib.metadata
52
+
53
+ typer.echo(f"hydraflow {importlib.metadata.version('hydraflow')}")
54
+ raise typer.Exit
55
+
56
+
57
+ def find_config() -> Path:
58
+ if Path("hydraflow.yaml").exists():
59
+ return Path("hydraflow.yaml")
60
+
61
+ if Path("hydraflow.yml").exists():
62
+ return Path("hydraflow.yml")
63
+
64
+ typer.echo("No config file found.")
65
+ raise typer.Exit(code=1)
66
+
67
+
68
+ def load_config() -> DictConfig:
69
+ cfg = OmegaConf.load(find_config())
70
+
71
+ if isinstance(cfg, DictConfig):
72
+ return cfg
73
+
74
+ typer.echo("Invalid config file.")
75
+ raise typer.Exit(code=1)
hydraflow/main.py CHANGED
@@ -23,10 +23,9 @@ def main(
23
23
  node: Any,
24
24
  config_name: str = "config",
25
25
  *,
26
- chdir: bool = True,
27
- skip_finished: bool = True,
26
+ chdir: bool = False,
28
27
  force_new_run: bool = False,
29
- override: bool = True,
28
+ skip_finished: bool = True,
30
29
  ):
31
30
  """Main decorator."""
32
31
 
@@ -42,7 +41,7 @@ def main(
42
41
  run = None
43
42
  else:
44
43
  rc = hydraflow.search_runs()
45
- run = rc.try_get(cfg, override=override)
44
+ run = rc.try_get(cfg, override=True)
46
45
 
47
46
  if skip_finished and run and run.info.status == FINISHED:
48
47
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
5
5
  Project-URL: Documentation, https://daizutabi.github.io/hydraflow/
6
6
  Project-URL: Source, https://github.com/daizutabi/hydraflow
@@ -38,6 +38,9 @@ Classifier: Programming Language :: Python :: 3.13
38
38
  Requires-Python: >=3.10
39
39
  Requires-Dist: hydra-core>=1.3
40
40
  Requires-Dist: mlflow>=2.15
41
+ Requires-Dist: omegaconf
42
+ Requires-Dist: rich
43
+ Requires-Dist: typer
41
44
  Description-Content-Type: text/markdown
42
45
 
43
46
  # Hydraflow
@@ -1,7 +1,8 @@
1
1
  hydraflow/__init__.py,sha256=rujOGabEPPhPfyqTHynem3unqIEQ1haTWWSMuu2LuoQ,898
2
+ hydraflow/cli.py,sha256=jxqFppNeJWAr2Tb-C_MQXEJtegJ6TXcd3C1CT7Jdb1A,1559
2
3
  hydraflow/config.py,sha256=MNX9da5bPVDcjnpji7Cm9ndK6ura92pt361m4PRh6_E,4326
3
4
  hydraflow/context.py,sha256=3xfKhMozkKFqtWeOp9Gie0A5o5URMta4US6iVD5TcLU,6002
4
- hydraflow/main.py,sha256=8DYYxyyS1sToEIoIQlzGcGDNgzIFg3fLnjBufQtQASc,1344
5
+ hydraflow/main.py,sha256=hroncI_SNpNgEtdxLgzI397J5S2Amv7J0atnPxwBePM,1314
5
6
  hydraflow/mlflow.py,sha256=imD3XL0RTlpnKrkyvO8FNy_Bv6hwSfLiOu1yJuL40ck,8773
6
7
  hydraflow/param.py,sha256=yu1aMNXRLegXGDL-68vwIkfeDF9CaU784WZENGLwl7Q,4572
7
8
  hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -9,7 +10,8 @@ hydraflow/run_collection.py,sha256=YCWg5Dz1j49xB2LA75onq5wsAeQQbifXpG4yPUwRN4I,2
9
10
  hydraflow/run_data.py,sha256=dpyyfnuH9mCtIZeigMo1iFQo9bafMdEL4i4uI2l0UqY,1525
10
11
  hydraflow/run_info.py,sha256=Jf5wrIjRLIV1-k-obHDqwKHa6j_ZonrY8od-rXlbtMo,1024
11
12
  hydraflow/utils.py,sha256=a9i5PEJn8Ssowv9dqHadAihZXlsqtVjHZ9MZvkPq1bY,4747
12
- hydraflow-0.7.2.dist-info/METADATA,sha256=TJfrv_OjNiZskkog8UFmJI9wXjatNBKFTovPdMjnbK8,4700
13
- hydraflow-0.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- hydraflow-0.7.2.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
15
- hydraflow-0.7.2.dist-info/RECORD,,
13
+ hydraflow-0.7.4.dist-info/METADATA,sha256=GTJi5z8TTIwPy6qpscw-t3Mb1V-GOR0iYU_IB-DB-UE,4766
14
+ hydraflow-0.7.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ hydraflow-0.7.4.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
16
+ hydraflow-0.7.4.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
17
+ hydraflow-0.7.4.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hydraflow = hydraflow.cli:app