Skip to content

Commit e3f75db

Browse files
committed
Address comments in pull request
1 parent 92e27e9 commit e3f75db

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

doc/custom_benchmarks.rst

+14-13
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,17 @@ All other PEP 621 fields are optional (e.g. ``requires-python = ">=3.8"``,
324324
The ``[tool.pyperformance]`` Section
325325
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
326326

327-
=============== ===== === === ===
328-
field type R B F
329-
=============== ===== === === ===
330-
tool.name str X X
331-
tool.tags [str] X
332-
tool.extra_opts [str] X
333-
tool.inherits file
334-
tool.runscript file X
335-
tool.datadir file X
336-
tool.setup_py bool
337-
=============== ===== === === ===
327+
================== ===== === === ===
328+
field type R B F
329+
================== ===== === === ===
330+
tool.name str X X
331+
tool.tags [str] X
332+
tool.extra_opts [str] X
333+
tool.inherits file
334+
tool.runscript file X
335+
tool.datadir file X
336+
tool.install_setup bool
337+
================== ===== === === ===
338338

339339
"R": required
340340
"B": inferred from the inherited metadata
@@ -343,5 +343,6 @@ tool.setup_py bool
343343
* tags: optional list of names to group benchmarks
344344
* extra_opts: optional list of args to pass to ``tool.runscript``
345345
* runscript: the benchmark script to use instead of run_benchmark.py.
346-
* setup_py: when ``true``, run the setup.py in the benchmark directory to build
347-
and install artifacts, such as C extensions
346+
* install_setup: when ``true`` (default), run ``pip install -e .`` in the
347+
benchmark directory to install it in the virtual environment. This has the
348+
effect of running a ``setup.py`` file, if present.

pyperformance/_benchmark.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ def extra_opts(self):
165165
return self._get_metadata_value('extra_opts', ())
166166

167167
@property
168-
def setup_py(self):
169-
return self._get_metadata_value('setup_py', False)
168+
def install_setup(self):
169+
return self._get_metadata_value('install_setup', True)
170170

171171
# Other metadata keys:
172172
# * base

pyperformance/_benchmark_metadata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
'datadir': None,
3333
'runscript': None,
3434
'extra_opts': None,
35-
'setup_py': None,
35+
'install_setup': None,
3636
}
3737

3838

@@ -229,9 +229,9 @@ def _resolve_value(field, value, rootdir):
229229
for opt in value:
230230
if not opt or not isinstance(opt, str):
231231
raise TypeError(f'extra_opts should be a list of strings, got {value!r}')
232-
elif field == 'setup_py':
232+
elif field == 'install_setup':
233233
if not isinstance(value, bool):
234-
raise TypeError(f'setup_py should be a bool, got {value!r}')
234+
raise TypeError(f'install_setup should be a bool, got {value!r}')
235235
else:
236236
raise NotImplementedError(field)
237237
return value

pyperformance/data-files/benchmarks/bm_ctypes/bm_ctypes_argtypes.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ dynamic = ["version"]
88
[tool.pyperformance]
99
name = "ctypes_argtypes"
1010
tags = "extension"
11-
extra_args = "--argtypes"
12-
setup_py = true
11+
extra_opts = ["--argtypes"]

pyperformance/data-files/benchmarks/bm_ctypes/pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ dynamic = ["version"]
77

88
[tool.pyperformance]
99
name = "ctypes"
10-
tags = "extension"
11-
setup_py = true
10+
tags = "extension"

pyperformance/data-files/benchmarks/bm_ctypes/run_benchmark.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def benchmark(loops):
9494
runner = pyperf.Runner()
9595
runner.metadata["description"] = "ctypes function call overhead benchmark"
9696

97-
runner.argparser.add_argument("--argtypes")
97+
runner.argparser.add_argument("--argtypes", action="store_true")
9898
options = runner.parse_args()
9999

100100
if options.argtypes:

pyperformance/venv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def from_benchmarks(cls, benchmarks):
2424
for bench in benchmarks or ():
2525
filename = bench.requirements_lockfile
2626
self._add_from_file(filename)
27-
if bench.setup_py:
27+
if bench.install_setup:
2828
self._add(os.path.dirname(bench.metafile))
2929
return self
3030

0 commit comments

Comments
 (0)