11PEP: 795
2- Title: A dedicated ``profilers `` module for organizing python profiling tools
2+ Title: A dedicated ``profilers `` package for organizing Python profiling tools
33Author: Pablo Galindo <pablogsal@python.org>,
4- László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
4+ László Kiss Kollár <kiss.kollar.laszlo@gmail.com>,
5+ Discussions-To: Pending
56Status: Draft
67Type: Standards Track
7- Created: 17 -Jul-2025
8+ Created: 21 -Jul-2025
89Python-Version: 3.15
910Post-History:
1011
1112Abstract
1213========
1314
1415This PEP proposes the creation of a new standard library module named
15- `` profilers ` ` to organize Python's built-in profiling tools under a single,
16+ :mod: ` ! profilers ` to organize Python's built-in profiling tools under a single,
1617coherent namespace.
1718
18- The `` profilers ` ` module will provide:
19+ The :mod: ` ! profilers ` module will provide:
1920
20- - `` profilers.tracing `` – an alias for `` cProfile ` `, the standard deterministic profiler
21- - `` profilers.sampling ` ` – the new sampling profiler introduced in Python 3.15,
22- currently exposed as `` profile.sample ` ` (see below)
23- - `` profilers.tachyon `` – an additional alias for `` profilers.sampling ` ` to improve discoverability
21+ - :mod: ` ! profilers.tracing ` – an alias for :mod: ` cProfile `, the standard deterministic profiler
22+ - :mod: ` ! profilers.sampling ` – the new sampling profiler introduced in Python 3.15,
23+ currently exposed as :mod: ` ! profile.sample ` (see below)
24+ - :mod: ` ! profilers.tachyon ` – an additional alias for :mod: ` ! profilers.sampling ` to improve discoverability
2425
25- This PEP also proposes the deprecation of the `` profile ` ` module, a legacy pure-Python tracing profiler.
26+ This PEP also proposes the deprecation of the :mod: ` profile ` module, a legacy pure-Python tracing profiler.
2627
2728Motivation
2829==========
@@ -61,7 +62,7 @@ introducing the ``profilers`` module, users will have a well-defined and
6162intuitive location to explore and access profiling functionality.
6263
6364Second, the proposal enhances **clarity ** by naming the submodules according to
64- their underlying methodology— ``profilers.tracing `` for deterministic tracing
65+ their underlying methodology -- ``profilers.tracing `` for deterministic tracing
6566profilers and ``profilers.sampling `` for statistical sampling profilers. This
6667explicit categorization makes it easier to understand the behavior and
6768limitations of each tool and aligns the API with the mental model users are
@@ -76,10 +77,9 @@ whether it involves low-overhead sampling or detailed tracing.
7677
7778Finally, this structure promotes **extensibility **. By consolidating profiling
7879tools under a unified namespace, it becomes straightforward to introduce future
79- profiling capabilities—such as memory profilers, I/O profilers, or hybrid
80- tools—without overloading unrelated modules or adding redundant top-level names.
81- The ``profilers `` module provides a natural home for the continued evolution of
82- Pytho
80+ profiling capabilities -- such as memory profilers, I/O profilers, or hybrid
81+ tools -- without overloading unrelated modules or adding redundant top-level names.
82+ The ``profilers `` module provides a natural home for this.
8383
8484Specification
8585=============
@@ -96,7 +96,7 @@ This PEP introduces a new ``profilers`` module containing:
9696Deprecation of ``profile ``
9797--------------------------
9898
99- The ``profile `` module will be deprecated starting in Python 3.16 .
99+ The ``profile `` module will be deprecated starting in Python 3.15 .
100100
101101- In Python 3.15:
102102 - Importing ``profile `` emits a ``DeprecationWarning ``.
@@ -105,20 +105,18 @@ The ``profile`` module will be deprecated starting in Python 3.16.
105105- In Python 3.17:
106106 - The module may be removed pending community feedback and migration metrics.
107107
108- Users will be encouraged to use `` profilers.tracing `` instead of `` profile ``, and
109- `` profilers.sampling `` instead of `` profile.sample `` .
108+ From Python 3.15, :mod: ` ! profilers.tracing ` will be preferred to :mod: ` !cProfile ` & :mod: ` ! profile `.
109+ The new :mod: ` ! profilers.sampling ` module will only exist in the :mod: ` profilers ` package .
110110
111111Documentation
112112=============
113113
114- The official Python documentation will reflect the new ``profilers `` module as the canonical
115- entry point for profiling functionality. It will describe:
116-
117- - The distinction between tracing and sampling profilers.
118- - Guidance on when each is appropriate.
114+ The Python documentation will use the new :mod: `!profilers ` module as the canonical
115+ entry point for profiling functionality. It will also describe the distinction between
116+ tracing and sampling profilers, and include guidance on when each type is most appropriate.
119117
120118Documentation for ``cProfile `` and ``profile.sample `` will remain available but will link to
121- the new ``profilers `` equivalents.
119+ the new ``profilers `` equivalents.
122120
123121Backwards Compatibility
124122=======================
0 commit comments