hydraflow 0.6.1__tar.gz → 0.6.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. {hydraflow-0.6.1 → hydraflow-0.6.2}/PKG-INFO +1 -1
  2. {hydraflow-0.6.1 → hydraflow-0.6.2}/pyproject.toml +1 -1
  3. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/run_collection.py +25 -17
  4. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/test_collection.py +6 -0
  5. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/utils/test_utils.py +1 -1
  6. {hydraflow-0.6.1 → hydraflow-0.6.2}/.devcontainer/devcontainer.json +0 -0
  7. {hydraflow-0.6.1 → hydraflow-0.6.2}/.devcontainer/postCreate.sh +0 -0
  8. {hydraflow-0.6.1 → hydraflow-0.6.2}/.devcontainer/starship.toml +0 -0
  9. {hydraflow-0.6.1 → hydraflow-0.6.2}/.gitattributes +0 -0
  10. {hydraflow-0.6.1 → hydraflow-0.6.2}/.gitignore +0 -0
  11. {hydraflow-0.6.1 → hydraflow-0.6.2}/LICENSE +0 -0
  12. {hydraflow-0.6.1 → hydraflow-0.6.2}/README.md +0 -0
  13. {hydraflow-0.6.1 → hydraflow-0.6.2}/apps/quickstart.py +0 -0
  14. {hydraflow-0.6.1 → hydraflow-0.6.2}/mkdocs.yml +0 -0
  15. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/__init__.py +0 -0
  16. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/config.py +0 -0
  17. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/context.py +0 -0
  18. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/mlflow.py +0 -0
  19. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/param.py +0 -0
  20. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/py.typed +0 -0
  21. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/run_data.py +0 -0
  22. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/run_info.py +0 -0
  23. {hydraflow-0.6.1 → hydraflow-0.6.2}/src/hydraflow/utils.py +0 -0
  24. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/__init__.py +0 -0
  25. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/config/__init__.py +0 -0
  26. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/config/overrides.py +0 -0
  27. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/config/test_config.py +0 -0
  28. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/config/test_overrides.py +0 -0
  29. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/config/test_params.py +0 -0
  30. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/conftest.py +0 -0
  31. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/__init__.py +0 -0
  32. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/chdir.py +0 -0
  33. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/context.py +0 -0
  34. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/logging.py +0 -0
  35. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/preemption.py +0 -0
  36. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/rerun.py +0 -0
  37. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/test_chdir.py +0 -0
  38. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/test_context.py +0 -0
  39. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/test_logging.py +0 -0
  40. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/test_preemption.py +0 -0
  41. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/context/test_rerun.py +0 -0
  42. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/param/__init__.py +0 -0
  43. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/param/params.py +0 -0
  44. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/param/test_param.py +0 -0
  45. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/param/test_params.py +0 -0
  46. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/__init__.py +0 -0
  47. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/filter.py +0 -0
  48. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/run.py +0 -0
  49. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/test_data.py +0 -0
  50. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/test_filter.py +0 -0
  51. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/test_info.py +0 -0
  52. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/run/test_run.py +0 -0
  53. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/test_mlflow.py +0 -0
  54. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/utils/__init__.py +0 -0
  55. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/utils/test_run.py +0 -0
  56. {hydraflow-0.6.1 → hydraflow-0.6.2}/tests/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.6.1
3
+ Version: 0.6.2
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hydraflow"
7
- version = "0.6.1"
7
+ version = "0.6.2"
8
8
  description = "Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments."
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -236,7 +236,7 @@ class RunCollection:
236
236
 
237
237
  def filter(
238
238
  self,
239
- config: object | None = None,
239
+ config: object | Callable[[Run], bool] | None = None,
240
240
  *,
241
241
  override: bool = False,
242
242
  select: list[str] | None = None,
@@ -257,11 +257,13 @@ class RunCollection:
257
257
  - Membership checks for lists of values.
258
258
  - Range checks for tuples of two values (inclusive of both the lower
259
259
  and upper bound).
260
+ - Callable that takes a `Run` object and returns a boolean value.
260
261
 
261
262
  Args:
262
- config (object | None): The configuration object to filter the runs.
263
- This can be any object that provides key-value pairs through
264
- the `iter_params` function.
263
+ config (object | Callable[[Run], bool] | None): The configuration object
264
+ to filter the runs. This can be any object that provides key-value
265
+ pairs through the `iter_params` function, or a callable that
266
+ takes a `Run` object and returns a boolean value.
265
267
  override (bool): If True, override the configuration object with the
266
268
  provided key-value pairs.
267
269
  select (list[str] | None): The list of parameters to select.
@@ -711,7 +713,7 @@ def _param_matches(run: Run, key: str, value: Any) -> bool:
711
713
 
712
714
  def filter_runs(
713
715
  runs: list[Run],
714
- config: object | None = None,
716
+ config: object | Callable[[Run], bool] | None = None,
715
717
  *,
716
718
  override: bool = False,
717
719
  select: list[str] | None = None,
@@ -735,9 +737,11 @@ def filter_runs(
735
737
 
736
738
  Args:
737
739
  runs (list[Run]): The list of runs to filter.
738
- config (object | None, optional): The configuration object to filter the
739
- runs. This can be any object that provides key-value pairs through
740
- the `iter_params` function. Defaults to None.
740
+ config (object | Callable[[Run], bool] | None, optional): The
741
+ configuration object to filter the runs. This can be any object
742
+ that provides key-value pairs through the `iter_params` function.
743
+ This can also be a callable that takes a `Run` object and returns
744
+ a boolean value. Defaults to None.
741
745
  override (bool, optional): If True, filter the runs based on
742
746
  the overrides. Defaults to False.
743
747
  select (list[str] | None, optional): The list of parameters to select.
@@ -750,15 +754,19 @@ def filter_runs(
750
754
  A list of runs that match the specified configuration and key-value pairs.
751
755
 
752
756
  """
753
- if override:
754
- config = select_overrides(config)
755
- elif select:
756
- config = select_config(config, select)
757
-
758
- for key, value in chain(iter_params(config), kwargs.items()):
759
- runs = [run for run in runs if _param_matches(run, key, value)]
760
- if not runs:
761
- return []
757
+ if callable(config):
758
+ runs = [run for run in runs if config(run)]
759
+
760
+ else:
761
+ if override:
762
+ config = select_overrides(config)
763
+ elif select:
764
+ config = select_config(config, select)
765
+
766
+ for key, value in chain(iter_params(config), kwargs.items()):
767
+ runs = [run for run in runs if _param_matches(run, key, value)]
768
+ if not runs:
769
+ return []
762
770
 
763
771
  if status is None:
764
772
  return runs
@@ -129,6 +129,12 @@ def test_filter_list_none(runs: list[Run]):
129
129
  assert not filter_runs(runs, ["invalid=0"])
130
130
 
131
131
 
132
+ def test_filter_callable(runs: list[Run]):
133
+ runs = filter_runs(runs, lambda run: run.data.params["r"] == "0")
134
+ assert len(runs) == 2
135
+ assert all(run.data.params["q"] == "0" for run in runs)
136
+
137
+
132
138
  @pytest.mark.parametrize(
133
139
  ("status", "n"),
134
140
  [
@@ -39,7 +39,7 @@ def test_file_uri_to_path(uri, path):
39
39
 
40
40
 
41
41
  @pytest.mark.skipif(sys.platform != "win32", reason="This test is for Windows")
42
- def test_file_uri_to_path_win10_11():
42
+ def test_file_uri_to_path_win_python_310_311():
43
43
  from hydraflow.utils import file_uri_to_path
44
44
 
45
45
  assert file_uri_to_path("file:///C:/a/b/c").as_posix() == "C:/a/b/c"
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