pytest-codspeed
Pytest plugin to create CodSpeed benchmarks
Decision gist · record as of 2026-08-14
Yes. The plugin is actively maintained, has low install friction, carries a permissive MIT license, and integrates seamlessly into existing pytest workflows. It's suitable for teams wanting to track performance without setting up separate benchmarking infrastructure, especially when paired with CodSpeed's cloud service for CI/CD integration.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; pytest must be installed.
- Low friction install with only 3 runtime dependencies (pytest, rich, importlib-metadata).
- The project is actively maintained with a recent release 84 days ago and shows steady development activity.
License · maintenance · safety
permissive license (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-05-22 (84 days) · last repo commit 2026-07-29 · 133 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,883,538 downloads/mo, #2,844 on PyPI
Alternatives
Verify before relying
pip install pytest-codspeed
# In your test file:
import pytest
@pytest.mark.benchmark
def test_my_performance():
result = sum(i**2 for i in range(100))
assert result == 55
# Or with the fixture for precise measurement:
def test_with_fixture(benchmark):
result = benchmark(lambda: sum(i**2 for i in range(100)))
assert result == 55- Whether CodSpeed cloud integration requires a paid account or if local benchmarking is fully free.
- Performance overhead of the plugin itself when running non-benchmark tests.
- Whether the plugin works with all pytest versions or has specific compatibility constraints.
What it is and what it does
pytest-codspeed is a pytest plugin that adds performance benchmarking capabilities to your test suite. It lets you mark entire test functions with @pytest.mark.benchmark for automatic measurement, or use a benchmark fixture to measure specific code blocks with fine-grained control. The plugin integrates with CodSpeed, a performance monitoring platform, allowing you to track performance changes over time and detect regressions in CI/CD pipelines.
The plugin supports measurement modes including walltime. You can run benchmarks locally with the --codspeed flag to see timing results in a formatted table, or integrate them into GitHub Actions workflows to report results to CodSpeed on every push and pull request. The package depends on pytest, rich, and importlib-metadata, making it lightweight to add to existing test suites.
Use it for
- Detect performance regressions in pull requests by running benchmarks in CI and comparing against baseline results.
- Measure the execution time of critical functions locally during development with the --codspeed flag.
- Track performance trends over time by uploading benchmark results to CodSpeed after each commit.
- Benchmark specific code sections precisely using the fixture approach rather than measuring entire test functions.
- Integrate performance testing into your existing pytest workflow without restructuring your test suite.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The plugin is actively maintained, has low install friction, carries a permissive MIT license, and integrates seamlessly into existing pytest workflows. It's suitable for teams wanting to track performance without setting up separate benchmarking infrastructure, especially when paired with CodSpeed's cloud service for CI/CD integration.
Install
pytest-codspeed on PyPI
Before you install
Low friction install with only 3 runtime dependencies (pytest, rich, importlib-metadata). The project is actively maintained with a recent release 84 days ago and shows steady development activity.
Requires Python 3.9 or later; pytest must be installed.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install pytest-codspeed
# In your test file:
import pytest
@pytest.mark.benchmark
def test_my_performance():
result = sum(i**2 for i in range(100))
assert result == 55
# Or with the fixture for precise measurement:
def test_with_fixture(benchmark):
result = benchmark(lambda: sum(i**2 for i in range(100)))
assert result == 55
Verify before relying
- Whether CodSpeed cloud integration requires a paid account or if local benchmarking is fully free.
- Performance overhead of the plugin itself when running non-benchmark tests.
- Whether the plugin works with all pytest versions or has specific compatibility constraints.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagespytestrichimportlib-metadata |
| Maintenance | Actively maintained 84 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,883,538 / month, #2,844 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Topic :: Software Development :: TestingTopic :: System :: BenchmarkTopic :: UtilitiesTyping :: Typed |
Evidence: pytest_codspeed-5.0.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “measure code execution time pytest”
- pytest-codspeedA pytest plugin that integrates performance benchmarking into your…
- pytest-timerPytest plugin that measures and reports the execution time of…
- codetimingMeasures elapsed time in Python code using a flexible Timer class…
Give your agent the search over MCP, or paste the wish link into any chat.
More System packages
Provides a platform-independent file locking mechanism to coordinate access to files across processes and threads.
Distro provides a reliable, machine-readable API to query the Linux or BSD distribution name, version, codename, and other OS platform details, replacing Python's deprecated `platform.linux_distribution` function.
Install it if you need to detect or report the Linux/BSD distribution your code runs on.
psutil retrieves real-time information about running processes and system resources (CPU, memory, disks, network, sensors) across multiple operating systems, enabling system monitoring, process profiling, and resource management.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Provides asynchronous file I/O operations for asyncio programs, with automatic selection of the best available backend (io_uring, libaio, thread-based, or pure Python) depending on your system.
Portalocker provides cross-platform file locking with support for exclusive and shared locks, plus Redis-based distributed locks and process-aware PID file locking.
Install it if you need file or process coordination; the optional extras (pywin32, redis) are only required for specific lock types.
See also pyperf · pytest-benchmark · asv · codeflash-benchmark · pytest-isort · pytest-rabbitmq · pytest-durations · pytest-redis · pytest-github-actions-annotate-failures · rtest