{"id":6522,"library":"asv","title":"Airspeed Velocity (ASV)","description":"Airspeed Velocity (asv) is a tool for benchmarking Python packages over their lifetime. It is primarily designed to benchmark a single project over its lifetime using a given suite of benchmarks. The results are displayed in an interactive web frontend that requires only a basic static webserver to host. The current version is 0.6.5, released in September 2025, and it maintains a relatively active release cadence with several updates per year.","status":"active","version":"0.6.5","language":"en","source_language":"en","source_url":"https://github.com/airspeed-velocity/asv","tags":["benchmarking","performance","profiling","cli-tool","version-control-integration"],"install":[{"cmd":"pip install asv","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required Python version.","package":"python","optional":false}],"imports":[{"note":"ASV is primarily a command-line interface (CLI) tool. While it uses Python for defining benchmarks, its core functionality is exposed via shell commands like `asv run`, `asv publish`, etc., rather than direct programmatic Python imports in user applications.","wrong":"import asv; asv.run()","symbol":"asv","correct":"asv <command>"}],"quickstart":{"code":"# 1. Initialize a new ASV benchmark suite\n# Run this in your project's root or a dedicated benchmark directory.\nasv quickstart\n\n# 2. Add a benchmark to benchmarks/benchmarks.py (example content below)\n# Create or edit 'benchmarks/benchmarks.py' with content like:\n# import numpy as np\n# \n# class TimeSuite:\n#     def setup(self):\n#         self.x = np.random.rand(1000, 1000)\n# \n#     def time_sum_array(self):\n#         np.sum(self.x)\n# \n#     def time_dot_product(self):\n#         np.dot(self.x, self.x)\n# \n#     def teardown(self):\n#         self.x = None\n# \n# class MemSuite:\n#     def mem_full_array(self):\n#         return np.random.rand(1000, 1000)\n\n# 3. Run the benchmarks\nasv run\n\n# 4. Publish the results to a web frontend\nasv publish\n\n# 5. Open the results in a web browser\nasv browse","lang":"bash","description":"To get started, navigate to your project directory (or a new directory for benchmarks) and run `asv quickstart` to set up the basic configuration and an example benchmark file. Then, define your benchmarks in Python files within the `benchmarks/` directory, typically as classes with `time_` or `mem_` prefixed methods. Finally, execute `asv run` to collect benchmark data and `asv publish` to generate the interactive web report, which can be viewed with `asv browse`."},"warnings":[{"fix":"Carefully consider benchmark naming conventions from the start. If changes are necessary, acknowledge that historical data for that specific benchmark series will be lost or fragmented. Documentation advises on pitfalls of changing `benchmark_name` attributes.","message":"Changing benchmark names, class names, or parameter names within your `benchmarks.py` files can invalidate historical data in ASV's reports. This makes it difficult to compare new results with past performance for the renamed benchmarks, essentially starting a new series.","severity":"breaking","affected_versions":"All versions"},{"fix":"Interact with ASV via its command-line interface. Benchmark definitions are Python code, but the execution and reporting are driven by the `asv` command.","message":"ASV is fundamentally a command-line tool (`asv quickstart`, `asv run`, `asv publish`, etc.). It's not typically imported as a Python library for direct programmatic use in application code. Attempting `import asv` to access benchmark running logic directly is not the intended usage model for most users.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be mindful of the precedence: `environment_matrix` in `asv.conf.json` takes priority. Ensure your dependency specifications are consistent or intentionally configured across both files if you use both methods.","message":"When configuring benchmark dependencies, `asv.conf.json` can specify `environment_matrix` settings (e.g., Python versions, specific package versions). If you also use `conda` or `mamba` with an `environment.yml` file, the explicit dependencies listed in `environment_matrix` within `asv.conf.json` will override those in `environment.yml`.","severity":"gotcha","affected_versions":">=0.6.1"},{"fix":"Ensure your project is under version control (Git or Mercurial) and that the `repo` path in `asv.conf.json` correctly points to your repository.","message":"ASV relies on Git or Mercurial for tracking project history and associating benchmark results with specific commits. While it can run benchmarks locally, its primary strength—historical performance tracking—requires an initialized Git or Mercurial repository.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Specify 'Python asv' or 'Airspeed Velocity' when referring to this library.","message":"The acronym 'ASV' is also used in other contexts, such as Adaptive Servo-Ventilation (medical devices for sleep apnea) and ASV Inventions (motorcycle parts). When searching for or discussing the Python benchmarking tool, ensure the context is clear to avoid confusion.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[{"fix":"Ensure that the 'asv' package is installed correctly by running 'pip install asv'.","cause":"This error occurs when the 'asv_runner' module is not installed or not found in the Python environment.","error":"ImportError: No module named 'asv_runner'"},{"fix":"Check if the regular expression search result is not 'None' before calling 'group()'. For example: 'match = re.search(pattern, string); if match: result = match.group()'.","cause":"This error occurs when a regular expression search returns 'None', and the code attempts to call the 'group()' method on it.","error":"AttributeError: 'NoneType' object has no attribute 'group'"},{"fix":"Install the 'asv' package using 'pip install asv'.","cause":"This error occurs when the 'asv' module is not installed or not found in the Python environment.","error":"ModuleNotFoundError: No module named 'asv'"},{"fix":"Ensure that the 'asv' package is installed and that the installation directory is included in the system's PATH.","cause":"This error occurs when the 'asv' command-line tool is not installed or not found in the system's PATH.","error":"asv: command not found"},{"fix":"Check the 'asv' command-line interface documentation for the correct usage and available arguments.","cause":"This error occurs when invalid or unrecognized arguments are passed to the 'asv' command.","error":"asv: error: unrecognized arguments"}]}