holobench 1.24.0__tar.gz → 1.25.1__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.
Files changed (49) hide show
  1. {holobench-1.24.0/holobench.egg-info → holobench-1.25.1}/PKG-INFO +5 -5
  2. {holobench-1.24.0 → holobench-1.25.1}/bencher/__init__.py +1 -1
  3. {holobench-1.24.0 → holobench-1.25.1}/bencher/bencher.py +36 -23
  4. {holobench-1.24.0 → holobench-1.25.1/holobench.egg-info}/PKG-INFO +5 -5
  5. {holobench-1.24.0 → holobench-1.25.1}/holobench.egg-info/SOURCES.txt +1 -0
  6. {holobench-1.24.0 → holobench-1.25.1}/holobench.egg-info/requires.txt +4 -4
  7. {holobench-1.24.0 → holobench-1.25.1}/pyproject.toml +16 -9
  8. holobench-1.25.1/test/test_bch_p.py +37 -0
  9. {holobench-1.24.0 → holobench-1.25.1}/test/test_bench_examples.py +15 -0
  10. {holobench-1.24.0 → holobench-1.25.1}/LICENSE +0 -0
  11. {holobench-1.24.0 → holobench-1.25.1}/README.md +0 -0
  12. {holobench-1.24.0 → holobench-1.25.1}/bencher/bench_cfg.py +0 -0
  13. {holobench-1.24.0 → holobench-1.25.1}/bencher/bench_plot_server.py +0 -0
  14. {holobench-1.24.0 → holobench-1.25.1}/bencher/bench_report.py +0 -0
  15. {holobench-1.24.0 → holobench-1.25.1}/bencher/bench_runner.py +0 -0
  16. {holobench-1.24.0 → holobench-1.25.1}/bencher/caching.py +0 -0
  17. {holobench-1.24.0 → holobench-1.25.1}/bencher/class_enum.py +0 -0
  18. {holobench-1.24.0 → holobench-1.25.1}/bencher/job.py +0 -0
  19. {holobench-1.24.0 → holobench-1.25.1}/bencher/optuna_conversions.py +0 -0
  20. {holobench-1.24.0 → holobench-1.25.1}/bencher/utils.py +0 -0
  21. {holobench-1.24.0 → holobench-1.25.1}/bencher/video_writer.py +0 -0
  22. {holobench-1.24.0 → holobench-1.25.1}/bencher/worker_job.py +0 -0
  23. {holobench-1.24.0 → holobench-1.25.1}/holobench.egg-info/dependency_links.txt +0 -0
  24. {holobench-1.24.0 → holobench-1.25.1}/holobench.egg-info/not-zip-safe +0 -0
  25. {holobench-1.24.0 → holobench-1.25.1}/holobench.egg-info/top_level.txt +0 -0
  26. {holobench-1.24.0 → holobench-1.25.1}/package.xml +0 -0
  27. {holobench-1.24.0 → holobench-1.25.1}/resource/bencher +0 -0
  28. {holobench-1.24.0 → holobench-1.25.1}/setup.cfg +0 -0
  29. {holobench-1.24.0 → holobench-1.25.1}/setup.py +0 -0
  30. {holobench-1.24.0 → holobench-1.25.1}/test/test_bench_report.py +0 -0
  31. {holobench-1.24.0 → holobench-1.25.1}/test/test_bench_result_base.py +0 -0
  32. {holobench-1.24.0 → holobench-1.25.1}/test/test_bench_runner.py +0 -0
  33. {holobench-1.24.0 → holobench-1.25.1}/test/test_bencher.py +0 -0
  34. {holobench-1.24.0 → holobench-1.25.1}/test/test_cache.py +0 -0
  35. {holobench-1.24.0 → holobench-1.25.1}/test/test_class_enum.py +0 -0
  36. {holobench-1.24.0 → holobench-1.25.1}/test/test_combinations.py +0 -0
  37. {holobench-1.24.0 → holobench-1.25.1}/test/test_composable_container_base.py +0 -0
  38. {holobench-1.24.0 → holobench-1.25.1}/test/test_composable_container_video.py +0 -0
  39. {holobench-1.24.0 → holobench-1.25.1}/test/test_float_formatter.py +0 -0
  40. {holobench-1.24.0 → holobench-1.25.1}/test/test_job.py +0 -0
  41. {holobench-1.24.0 → holobench-1.25.1}/test/test_meta_tests.py +0 -0
  42. {holobench-1.24.0 → holobench-1.25.1}/test/test_parametrized_sweep.py +0 -0
  43. {holobench-1.24.0 → holobench-1.25.1}/test/test_plot_filter.py +0 -0
  44. {holobench-1.24.0 → holobench-1.25.1}/test/test_plot_server.py +0 -0
  45. {holobench-1.24.0 → holobench-1.25.1}/test/test_sample_cache.py +0 -0
  46. {holobench-1.24.0 → holobench-1.25.1}/test/test_sweep_base.py +0 -0
  47. {holobench-1.24.0 → holobench-1.25.1}/test/test_sweep_vars.py +0 -0
  48. {holobench-1.24.0 → holobench-1.25.1}/test/test_utils.py +0 -0
  49. {holobench-1.24.0 → holobench-1.25.1}/test/test_vars.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: holobench
3
- Version: 1.24.0
3
+ Version: 1.25.1
4
4
  Summary: A package for benchmarking the performance of arbitrary functions
5
5
  Author-email: Austin Gregg-Smith <blooop@gmail.com>
6
6
  Maintainer: austin.gregg-smith
@@ -29,11 +29,11 @@ Requires-Dist: scoop<=0.7.2.0,>=0.7.0
29
29
  Requires-Dist: moviepy<=1.0.3,>=1.0.3
30
30
  Provides-Extra: test
31
31
  Requires-Dist: black<=24.4.2,>=23; extra == "test"
32
- Requires-Dist: pylint<=3.2.2,>=2.17.7; extra == "test"
32
+ Requires-Dist: pylint<=3.2.3,>=2.17.7; extra == "test"
33
33
  Requires-Dist: pytest-cov<=5.0.0,>=4.1; extra == "test"
34
- Requires-Dist: pytest<=8.2.1,>=7.4; extra == "test"
35
- Requires-Dist: hypothesis<=6.103.0,>=6.82; extra == "test"
36
- Requires-Dist: ruff<=0.4.7,>=0.3; extra == "test"
34
+ Requires-Dist: pytest<=8.2.2,>=7.4; extra == "test"
35
+ Requires-Dist: hypothesis<=6.103.1,>=6.82; extra == "test"
36
+ Requires-Dist: ruff<=0.4.8,>=0.0.280; extra == "test"
37
37
  Requires-Dist: coverage<=7.5.3,>=7.2.7; extra == "test"
38
38
 
39
39
  # Bencher
@@ -6,7 +6,7 @@ from .variables.sweep_base import hash_sha1
6
6
  from .variables.inputs import IntSweep, FloatSweep, StringSweep, EnumSweep, BoolSweep, SweepBase
7
7
  from .variables.time import TimeSnapshot
8
8
 
9
- from .variables.inputs import box
9
+ from .variables.inputs import box, p
10
10
  from .variables.results import (
11
11
  ResultVar,
12
12
  ResultVec,
@@ -2,7 +2,7 @@ import logging
2
2
  from datetime import datetime
3
3
  from itertools import product, combinations
4
4
 
5
- from typing import Callable, List
5
+ from typing import Callable, List, Optional
6
6
  from copy import deepcopy
7
7
  import numpy as np
8
8
  import param
@@ -315,13 +315,27 @@ class Bench(BenchPlotServer):
315
315
  else:
316
316
  const_vars = deepcopy(const_vars)
317
317
 
318
+ if run_cfg is None:
319
+ if self.run_cfg is None:
320
+ run_cfg = BenchRunCfg()
321
+ logging.info("Generate default run cfg")
322
+ else:
323
+ run_cfg = deepcopy(self.run_cfg)
324
+ logging.info("Copy run cfg from bench class")
325
+
326
+ if run_cfg.only_plot:
327
+ run_cfg.use_cache = True
328
+
329
+ self.last_run_cfg = run_cfg
330
+
318
331
  if isinstance(input_vars, dict):
319
332
  input_lists = []
320
333
  for k, v in input_vars.items():
321
- param_var = self.convert_vars_to_params(k, "input")
334
+ param_var = self.convert_vars_to_params(k, "input", run_cfg)
322
335
  if isinstance(v, list):
323
336
  assert len(v) > 0
324
337
  param_var = param_var.with_sample_values(v)
338
+
325
339
  else:
326
340
  raise RuntimeError("Unsupported type")
327
341
  input_lists.append(param_var)
@@ -329,9 +343,9 @@ class Bench(BenchPlotServer):
329
343
  input_vars = input_lists
330
344
  else:
331
345
  for i in range(len(input_vars)):
332
- input_vars[i] = self.convert_vars_to_params(input_vars[i], "input")
346
+ input_vars[i] = self.convert_vars_to_params(input_vars[i], "input", run_cfg)
333
347
  for i in range(len(result_vars)):
334
- result_vars[i] = self.convert_vars_to_params(result_vars[i], "result")
348
+ result_vars[i] = self.convert_vars_to_params(result_vars[i], "result", run_cfg)
335
349
 
336
350
  for r in result_vars:
337
351
  logging.info(f"result var: {r.name}")
@@ -342,22 +356,9 @@ class Bench(BenchPlotServer):
342
356
  for i in range(len(const_vars)):
343
357
  # consts come as tuple pairs
344
358
  cv_list = list(const_vars[i])
345
- cv_list[0] = self.convert_vars_to_params(cv_list[0], "const")
359
+ cv_list[0] = self.convert_vars_to_params(cv_list[0], "const", run_cfg)
346
360
  const_vars[i] = cv_list
347
361
 
348
- if run_cfg is None:
349
- if self.run_cfg is None:
350
- run_cfg = BenchRunCfg()
351
- logging.info("Generate default run cfg")
352
- else:
353
- run_cfg = deepcopy(self.run_cfg)
354
- logging.info("Copy run cfg from bench class")
355
-
356
- if run_cfg.only_plot:
357
- run_cfg.use_cache = True
358
-
359
- self.last_run_cfg = run_cfg
360
-
361
362
  if title is None:
362
363
  if len(input_vars) > 0:
363
364
  title = "Sweeping " + " vs ".join([i.name for i in input_vars])
@@ -485,7 +486,12 @@ class Bench(BenchPlotServer):
485
486
  self.results.append(bench_res)
486
487
  return bench_res
487
488
 
488
- def convert_vars_to_params(self, variable: param.Parameter, var_type: str):
489
+ def convert_vars_to_params(
490
+ self,
491
+ variable: param.Parameter | str | dict | tuple,
492
+ var_type: str,
493
+ run_cfg: Optional[BenchRunCfg],
494
+ ) -> param.Parameter:
489
495
  """check that a variable is a subclass of param
490
496
 
491
497
  Args:
@@ -497,10 +503,17 @@ class Bench(BenchPlotServer):
497
503
  """
498
504
  if isinstance(variable, str):
499
505
  variable = self.worker_class_instance.param.objects(instance=False)[variable]
500
- if isinstance(variable, tuple):
501
- variable = self.worker_class_instance.param.objects(instance=False)[
502
- variable[0]
503
- ].with_sample_values(variable[1])
506
+ if isinstance(variable, dict):
507
+ param_var = self.worker_class_instance.param.objects(instance=False)[variable["name"]]
508
+ if variable.get("values"):
509
+ param_var = param_var.with_sample_values(variable["values"])
510
+
511
+ if variable.get("samples"):
512
+ param_var = param_var.with_samples(variable["samples"])
513
+ if variable.get("max_level"):
514
+ if run_cfg is not None:
515
+ param_var = param_var.with_level(run_cfg.level, variable["max_level"])
516
+ variable = param_var
504
517
  if not isinstance(variable, param.Parameter):
505
518
  raise TypeError(
506
519
  f"You need to use {var_type}_vars =[{self.worker_input_cfg}.param.your_variable], instead of {var_type}_vars =[{self.worker_input_cfg}.your_variable]"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: holobench
3
- Version: 1.24.0
3
+ Version: 1.25.1
4
4
  Summary: A package for benchmarking the performance of arbitrary functions
5
5
  Author-email: Austin Gregg-Smith <blooop@gmail.com>
6
6
  Maintainer: austin.gregg-smith
@@ -29,11 +29,11 @@ Requires-Dist: scoop<=0.7.2.0,>=0.7.0
29
29
  Requires-Dist: moviepy<=1.0.3,>=1.0.3
30
30
  Provides-Extra: test
31
31
  Requires-Dist: black<=24.4.2,>=23; extra == "test"
32
- Requires-Dist: pylint<=3.2.2,>=2.17.7; extra == "test"
32
+ Requires-Dist: pylint<=3.2.3,>=2.17.7; extra == "test"
33
33
  Requires-Dist: pytest-cov<=5.0.0,>=4.1; extra == "test"
34
- Requires-Dist: pytest<=8.2.1,>=7.4; extra == "test"
35
- Requires-Dist: hypothesis<=6.103.0,>=6.82; extra == "test"
36
- Requires-Dist: ruff<=0.4.7,>=0.3; extra == "test"
34
+ Requires-Dist: pytest<=8.2.2,>=7.4; extra == "test"
35
+ Requires-Dist: hypothesis<=6.103.1,>=6.82; extra == "test"
36
+ Requires-Dist: ruff<=0.4.8,>=0.0.280; extra == "test"
37
37
  Requires-Dist: coverage<=7.5.3,>=7.2.7; extra == "test"
38
38
 
39
39
  # Bencher
@@ -24,6 +24,7 @@ holobench.egg-info/not-zip-safe
24
24
  holobench.egg-info/requires.txt
25
25
  holobench.egg-info/top_level.txt
26
26
  resource/bencher
27
+ test/test_bch_p.py
27
28
  test/test_bench_examples.py
28
29
  test/test_bench_report.py
29
30
  test/test_bench_result_base.py
@@ -18,9 +18,9 @@ moviepy<=1.0.3,>=1.0.3
18
18
 
19
19
  [test]
20
20
  black<=24.4.2,>=23
21
- pylint<=3.2.2,>=2.17.7
21
+ pylint<=3.2.3,>=2.17.7
22
22
  pytest-cov<=5.0.0,>=4.1
23
- pytest<=8.2.1,>=7.4
24
- hypothesis<=6.103.0,>=6.82
25
- ruff<=0.4.7,>=0.3
23
+ pytest<=8.2.2,>=7.4
24
+ hypothesis<=6.103.1,>=6.82
25
+ ruff<=0.4.8,>=0.0.280
26
26
  coverage<=7.5.3,>=7.2.7
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "holobench"
3
- version = "1.24.0"
3
+ version = "1.25.1"
4
4
 
5
5
  authors = [{ name = "Austin Gregg-Smith", email = "blooop@gmail.com" }]
6
6
  description = "A package for benchmarking the performance of arbitrary functions"
@@ -42,14 +42,17 @@ python = "3.11.*"
42
42
  [tool.pixi.pypi-dependencies]
43
43
  holobench = { path = ".", editable = true }
44
44
 
45
+ [tool.pixi.feature.devenv.pypi-dependencies]
46
+ deps-rocker = ">=0.2"
47
+
45
48
  [project.optional-dependencies]
46
49
  test = [
47
50
  "black>=23,<=24.4.2",
48
- "pylint>=2.17.7,<=3.2.2",
51
+ "pylint>=2.17.7,<=3.2.3",
49
52
  "pytest-cov>=4.1,<=5.0.0",
50
- "pytest>=7.4,<=8.2.1",
51
- "hypothesis>=6.82,<=6.103.0",
52
- "ruff>=0.3,<=0.4.7",
53
+ "pytest>=7.4,<=8.2.2",
54
+ "hypothesis>=6.82,<=6.103.1",
55
+ "ruff>=0.0.280,<=0.4.8",
53
56
  "coverage>=7.2.7,<=7.5.3",
54
57
  ]
55
58
 
@@ -64,9 +67,13 @@ build-backend = "setuptools.build_meta"
64
67
 
65
68
  # Environments
66
69
  [tool.pixi.environments]
67
- default = { features = ["test"], solve-group = "default" }
68
- py310 = ["py310", "test"]
69
- py311 = ["py311", "test"]
70
+ default = {features = ["test"], solve-group = "default" }
71
+ py310 = ["py310","test"]
72
+ py311 = ["py311","test"]
73
+ devenv =["devenv"]
74
+
75
+ [tool.pixi.feature.devenv.tasks]
76
+ code = "scripts/launch_vscode.sh"
70
77
 
71
78
  [tool.pixi.tasks]
72
79
  format = "black ."
@@ -106,7 +113,7 @@ extension-pkg-whitelist = ["numpy", "scipy"]
106
113
  jobs = 16 #detect number of cores
107
114
 
108
115
  [tool.pylint.'MESSAGES CONTROL']
109
- disable = "C,logging-fstring-interpolation,line-too-long,fixme,missing-module-docstring,too-many-instance-attributes,too-few-public-methods,too-many-arguments,too-many-locals,too-many-branches,too-many-statements,use-dict-literal,duplicate-code,too-many-public-methods,too-many-nested-blocks"
116
+ disable = "C,logging-fstring-interpolation,line-too-long,fixme,missing-module-docstring,too-many-instance-attributes,too-few-public-methods,too-many-arguments,too-many-locals,too-many-branches,too-many-statements,use-dict-literal,duplicate-code,too-many-public-methods,too-many-nested-blocks,cyclic-import"
110
117
  enable = "no-else-return,consider-using-in"
111
118
 
112
119
  [tool.black]
@@ -0,0 +1,37 @@
1
+ # Generated by CodiumAI
2
+
3
+ import pytest
4
+ from bencher import p
5
+
6
+
7
+ class TestP:
8
+
9
+ # returns correct dictionary with all parameters provided
10
+ def test_returns_correct_dict_all_params(self):
11
+ result = p(name="param1", values=[1, 2, 3], samples=10, max_level=5)
12
+ assert result == {"name": "param1", "values": [1, 2, 3], "samples": 10, "max_level": 5}
13
+
14
+ # returns correct dictionary with only name provided
15
+ def test_returns_correct_dict_name_only(self):
16
+ result = p(name="param1")
17
+ assert result == {"name": "param1", "values": None, "samples": None, "max_level": None}
18
+
19
+ # returns correct dictionary with name and values provided
20
+ def test_returns_correct_dict_name_and_values(self):
21
+ result = p(name="param1", values=[1, 2, 3])
22
+ assert result == {"name": "param1", "values": [1, 2, 3], "samples": None, "max_level": None}
23
+
24
+ # raises ValueError when max_level is 0
25
+ def test_raises_value_error_max_level_zero(self):
26
+ with pytest.raises(ValueError, match="max_level must be greater than 0"):
27
+ p(name="param1", max_level=0)
28
+
29
+ # raises ValueError when max_level is negative
30
+ def test_raises_value_error_max_level_negative(self):
31
+ with pytest.raises(ValueError, match="max_level must be greater than 0"):
32
+ p(name="param1", max_level=-1)
33
+
34
+ # raises ValueError when samples is 0
35
+ def test_raises_value_error_samples_zero(self):
36
+ with pytest.raises(ValueError, match="samples must be greater than 0"):
37
+ p(name="param1", samples=0)
@@ -4,12 +4,15 @@ from bencher.example.example_floats2D import example_floats2D
4
4
  from bencher.example.example_pareto import example_pareto
5
5
  from bencher.example.example_simple_cat import example_1D_cat
6
6
  from bencher.example.example_simple_float import example_1D_float
7
+ from bencher.example.example_simple_float2d import example_2D_float
8
+ from bencher.example.example_consts import example_2D_float_const
7
9
  from bencher.example.example_float_cat import run_example_float_cat
8
10
  from bencher.example.example_time_event import run_example_time_event
9
11
  from bencher.example.example_float3D import example_floats3D
10
12
 
11
13
  from bencher.example.example_custom_sweep import example_custom_sweep
12
14
  from bencher.example.example_custom_sweep2 import example_custom_sweep2
15
+ from bencher.example.example_levels2 import example_levels2
13
16
  from bencher.example.example_workflow import example_floats2D_workflow, example_floats3D_workflow
14
17
  from bencher.example.example_holosweep import example_holosweep
15
18
  from bencher.example.example_holosweep_tap import example_holosweep_tap
@@ -74,6 +77,15 @@ class TestBenchExamples(unittest.TestCase):
74
77
  def test_example_simple_float(self) -> None:
75
78
  self.examples_asserts(example_1D_float(self.create_run_cfg()))
76
79
 
80
+ def test_example_simple_float1D(self) -> None:
81
+ self.examples_asserts(example_1D_float(self.create_run_cfg()))
82
+
83
+ def test_example_simple_float2D(self) -> None:
84
+ self.examples_asserts(example_2D_float(self.create_run_cfg()))
85
+
86
+ def test_example_2D_float_const(self) -> None:
87
+ self.examples_asserts(example_2D_float_const(self.create_run_cfg()))
88
+
77
89
  def test_example_float_cat(self) -> None:
78
90
  self.examples_asserts(run_example_float_cat(self.create_run_cfg()))
79
91
 
@@ -89,6 +101,9 @@ class TestBenchExamples(unittest.TestCase):
89
101
  def test_example_custom2(self) -> None:
90
102
  self.examples_asserts(example_custom_sweep2(self.create_run_cfg()))
91
103
 
104
+ def test_example_level2(self) -> None:
105
+ self.examples_asserts(example_levels2(self.create_run_cfg()))
106
+
92
107
  def test_example_floats2D_workflow(self) -> None:
93
108
  self.examples_asserts(example_floats2D_workflow(self.create_run_cfg()))
94
109
 
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