---
source: https://iinventedlight.com/library/notes/python-profile.md
title: "Python profile: a deprecated pure Python deterministic profiler"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, profile: Pure Python profiler (deprecated); CPython, profile documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-profile"
tags: [python, profile, profiler, cProfile, pstats]
client: Librarian
sources:
  - id: S1
    title: "profile: Pure Python profiler (deprecated)"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/profile.html
    accessed: 2026-11-26
    license: "PSF License Version 2"
  - id: S2
    title: "profile documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/profile.rst
    accessed: 2026-11-26
    license: "PSF License Version 2"
---
# Python profile: a deprecated pure Python deterministic profiler
**Answer:** The profile module is a deprecated deterministic profiler in pure Python, and most work should use profiling.tracing or profiling.sampling instead.

## What the module is

The profile module is a deterministic profiler implemented in pure Python.

The module helps with understanding profiler internals. Subclassing can extend profiler behavior.

Compared with the C-based profiling.tracing module, this implementation has significant overhead.

The documentation marks the module as deprecated and says it will be removed in Python 3.17.

## What to use instead

For most tasks, the docs recommend profiling.sampling when you need production debugging with zero overhead.

They recommend profiling.tracing for development and testing.

The cProfile module remains available as a backward-compatible alias to profiling.tracing.

The run routine executes a command and gathers profiling statistics, and can print a simple profiling report if no file name is present.

The Profile class offers tighter control, including a custom timer and a time unit such as 0.001.

Version 3.8 added context manager support.

If the interpreter exits during the run, the report is not printed.

## See also

- [python-cprofile](https://iinventedlight.com/library/notes/python-cprofile/)
- [python-pstats](https://iinventedlight.com/library/notes/python-pstats/)
- [python-timeit](https://iinventedlight.com/library/notes/python-timeit/)

## Claims

- id: C1
  claim: The profile module is deprecated and will be removed in Python 3.17.
  source: S1
  evidence: "The profile module is deprecated and will be removed"

- id: C2
  claim: It provides a pure Python deterministic profiler with higher overhead than profiling.tracing.
  source: S2
  evidence: "provides a pure Python implementation of a deterministic profiler"

- id: C3
  claim: cProfile remains as a backward-compatible alias to profiling.tracing.
  source: S1
  evidence: "The cProfile module remains available as a backward-compatible alias"

## Sources

- [S1] profile: Pure Python profiler (deprecated). Python Software Foundation. https://docs.python.org/3/library/profile.html . License: PSF License Version 2. Accessed 2026-11-26.

- [S2] profile documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/profile.rst . License: PSF License Version 2. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, profile: Pure Python profiler (deprecated); CPython, profile documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
