$npx skillfedfor your agent

pytest-memray

A simple plugin to use with pytest

Worth itPyPI DebuggersReleased Aug 20262.9M downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_memray-1.10.0-py3-none-any.whl
v1.10.0 · released 2026-08-07 · Python >=3.8 · 2 runtime deps: memray, pytest

Yes. The plugin is actively maintained, has low install friction, carries no security vulnerabilities, and solves a real problem—memory profiling in tests—that is otherwise tedious to set up. It's well-suited for projects concerned with memory efficiency or regression detection. The Apache-2.0 license is permissive and poses no barrier to adoption.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8 or higher; memray itself only runs on Linux and macOS.
  • Low friction install with a pure-Python wheel.
  • Actively maintained with a release within the past week.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions; you must include a copy of the license.

last release 2026-08-07 (7 days) · last repo commit 2026-08-11 · 422 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,893,206 downloads/mo, #2,836 on PyPI

Verify before relying

pip install pytest-memray

pytest --memray tests/

# In a test file:
import pytest

@pytest.mark.limit_memory("100.0KiB")
def test_my_function():
    data = [i for i in range(10)]
    assert len(data) == 10
  • Whether the plugin works with pytest fixtures and parametrized tests without additional configuration.
  • Performance overhead of native frame tracking and Python allocator tracing modes on large test suites.
  • Compatibility with other pytest plugins that also instrument memory or test execution.
Same gist for agents: .md · .json

What it is and what it does

pytest-memray is a pytest plugin that wraps memray's memory profiling capabilities for test-driven memory debugging. It activates via the `--memray` CLI flag and tracks heap allocations throughout each test, then generates a summary report showing total memory used, allocation counts, and the call stacks responsible for the largest allocations. You can set per-test memory limits using the `limit_memory` marker and fail tests that exceed them; the plugin also supports tracking memory growth across runs with `--fail-on-increase` to catch regressions.

The plugin is designed for developers who need to catch memory leaks or excessive allocations in their test suite without manually instrumenting code. It outputs allocation histograms, identifies the functions and line numbers responsible for the biggest memory consumers, and can optionally show native C-level frames for deeper profiling. Configuration is available both via CLI flags and pytest INI settings.

Use it for

  • Catch memory leaks in unit tests by setting per-test memory limits and failing tests that exceed them.
  • Identify which functions allocate the most memory during test execution for optimization.
  • Track memory usage trends across test runs and fail if a test's memory footprint grows unexpectedly.
  • Debug memory issues in CI/CD pipelines by generating detailed allocation reports for each test.
  • Profile Python allocator behavior separately from native allocations using `--trace-python-allocators`.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The plugin is actively maintained, has low install friction, carries no security vulnerabilities, and solves a real problem—memory profiling in tests—that is otherwise tedious to set up. It's well-suited for projects concerned with memory efficiency or regression detection. The Apache-2.0 license is permissive and poses no barrier to adoption.

Install

pytest-memray on PyPI

Before you install

Low friction install with a pure-Python wheel. Actively maintained with a release within the past week. Requires only memray and pytest as runtime dependencies, both widely available.

Requires Python 3.8 or higher; memray itself only runs on Linux and macOS.

License in practice

Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions; you must include a copy of the license.

Quickstart

pip install pytest-memray

pytest --memray tests/

# In a test file:
import pytest

@pytest.mark.limit_memory("100.0KiB")
def test_my_function():
    data = [i for i in range(10)]
    assert len(data) == 10

Verify before relying

  • Whether the plugin works with pytest fixtures and parametrized tests without additional configuration.
  • Performance overhead of native frame tracking and Python allocator tracing modes on large test suites.
  • Compatibility with other pytest plugins that also instrument memory or test execution.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
memraypytest
MaintenanceActively maintained 7 days since the last release
Last repo commit
First released
Downloads2,893,206 / month, #2,836 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: POSIX :: LinuxProgramming 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.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Debuggers

Evidence: pytest_memray-1.10.0-py3-none-any.whl

Tags

Capabilities
pytest memory profiling plugintest memory trackingmemory allocation debuggingpytest memray integrationmemory limit testingallocation tracking pytestmemory regression detection
Topics
memory-profilingpytest-pluginperformance-testing

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 › “pytest memory profiling plugin”

  • pytest-memrayA pytest plugin that integrates memray memory profiling into test…
  • pytest-monitorA pytest plugin that automatically measures and logs resource…
  • pytest-profilingPytest plugin that profiles test execution using cProfile and…

Give your agent the search over MCP, or paste the wish link into any chat.

More Debuggers packages

stack-data Worth it
PyPI · Debuggers · released Sep 2023

Extracts and displays stack frame and traceback data with context-aware source code rendering, used to power enhanced tracebacks in IPython and similar tools.

Install it if you need to display or inspect stack frames with source context; skip it if your use case doesn't involve frame introspection.

MITpure Python
124.3Mdownloads / mo
debugpy Worth it
PyPI · Debuggers · released Jun 2026

debugpy is a Debug Adapter Protocol implementation for Python that enables remote debugging of Python scripts and modules through standard DAP clients, with support for breakpoints, exception handling, and subprocess debugging.

Install it if you need remote debugging, DAP client integration, or programmatic control over breakpoints and exception handling.

MITpure Python · 3.8+
107.6Mdownloads / mo
pylint Worth it
PyPI · Testing · released Aug 2026

Pylint is a static code analyzer that checks Python code for errors, enforces coding standards, detects code smells, and suggests refactoring improvements without executing the code.

Install it if you need thorough code analysis with inference-based bug detection; if speed is critical, consider pairing it with faster linters like ruff for…

GPL-2.0-or-laterpure Python · 3.10.0+
69.0Mdownloads / mo
yamllint Worth it
PyPI · Software Development · released Jan 2026

yamllint checks YAML files for syntax errors, style violations, and structural problems like key repetition, line length, trailing spaces, and indentation issues.

GPL-3.0-or-laterpure Python · 3.10+
40.4Mdownloads / mo
ipdb Worth it
PyPI · Debuggers · released Mar 2023

ipdb is an IPython-enabled debugger that replaces Python's standard pdb with tab completion, syntax highlighting, and better introspection while maintaining the same pdb interface.

BSD-3-Clausepure Python
18.4Mdownloads / mo
memray With conditions
PyPI · Debuggers · released Aug 2026

Memray is a memory profiler for Python that traces every function call to track memory allocations across Python code, native extensions, and the interpreter itself, generating reports like flame graphs and tables to analyze memory usage.

Apache-2.0compiled wheel · 3.9.0+
16.1Mdownloads / mo

See also pytest-testmon · pystack · pytest-cache · omnimalloc · pyroscope-io · py-spy · pytest-isort · pytest-html · pytest-skip-slow