asv_runner.benchmarks#

Variables#

pkgname (str)

The name of the current package.

pkgpath (_frozen_importlib_external._NamespacePath)

The path of the current package.

module_names (List[str])

The names of all submodules in the current package that don’t contain an underscore.

benchmark_types (List[Type])

A list to hold all benchmark classes from the submodules.

Raises#

NotRequired (Exception)

If a submodule raises a NotRequired exception during import, it is ignored.

Notes#

This module first identifies all submodules in the current package that don’t contain an underscore in their names. It then iterates over these submodules, imports each one, and checks if it contains an attribute named “export_as_benchmark”.

If such an attribute exists, its contents (which should be a list of benchmark classes) are added to the benchmark_types list. If a submodule raises a NotRequired exception during the import, it is ignored, and the loop continues with the next submodule.

This code is useful in a benchmarking suite where new benchmarks can be added simply by adding a new submodule with an “export_as_benchmark” attribute.

Automatically discovers and imports benchmark classes from all submodules in the current package.

Submodules#

Package Contents#

Data#

API#

asv_runner.benchmarks.pkgname#

None

asv_runner.benchmarks.pkgpath#

None

asv_runner.benchmarks.module_names#

None

asv_runner.benchmarks.benchmark_types#

[]