Skip to content

Commit f39abd4

Browse files
ENH: Updates for the spin bench command. (numpy#30175)
* MAINT: spin: Use sys.executable to run a Python script in the bench function. * ENH: spin: Expose --factor as an option for 'bench'
1 parent 15063ae commit f39abd4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.spin/cmds.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,19 @@ def lint(ctx, fix):
392392
'--quick', '-q', is_flag=True, default=False,
393393
help="Run each benchmark only once (timings won't be accurate)"
394394
)
395+
@click.option(
396+
'--factor', '-f', default=1.05,
397+
help="The factor above or below which a benchmark result is "
398+
"considered reportable. This is passed on to the asv command."
399+
)
395400
@click.argument(
396401
'commits', metavar='',
397402
required=False,
398403
nargs=-1
399404
)
400405
@meson.build_dir_option
401406
@click.pass_context
402-
def bench(ctx, tests, compare, verbose, quick, commits, build_dir):
407+
def bench(ctx, tests, compare, verbose, quick, factor, commits, build_dir):
403408
"""🏋 Run benchmarks.
404409
405410
\b
@@ -454,7 +459,7 @@ def bench(ctx, tests, compare, verbose, quick, commits, build_dir):
454459
meson._set_pythonpath(build_dir)
455460

456461
p = spin.util.run(
457-
['python', '-c', 'import numpy as np; print(np.__version__)'],
462+
[sys.executable, '-c', 'import numpy as np; print(np.__version__)'],
458463
cwd='benchmarks',
459464
echo=False,
460465
output=False
@@ -482,7 +487,7 @@ def bench(ctx, tests, compare, verbose, quick, commits, build_dir):
482487
)
483488

484489
cmd_compare = [
485-
'asv', 'continuous', '--factor', '1.05',
490+
'asv', 'continuous', '--factor', str(factor),
486491
] + bench_args + [commit_a, commit_b]
487492
_run_asv(cmd_compare)
488493

0 commit comments

Comments
 (0)