11PEP: 799
2- Title: A dedicated ``profilers `` package for organizing Python profiling tools
2+ Title: A dedicated ``profiling `` package for organizing Python profiling tools
33Author: Pablo Galindo <pablogsal@python.org>,
4- László Kiss Kollár <kiss.kollar.laszlo@gmail.com>,
5- Discussions-To: Pending
4+ László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
5+ Discussions-To: https://discuss.python.org/t/pep-799-a-dedicated-profilers-package-for-organizing-python-profiling-tool/100898
66Status: Draft
77Type: Standards Track
88Created: 21-Jul-2025
@@ -13,7 +13,7 @@ Abstract
1313========
1414
1515This PEP proposes the creation of a new standard library module named
16- :mod: `!profilers ` to organize Python's built-in profiling tools under a single,
16+ :mod: `!profiling ` to organize Python's built-in profiling tools under a single,
1717coherent namespace.
1818
1919This PEP also proposes the deprecation of the :mod: `profile ` module, a legacy
@@ -54,42 +54,43 @@ This reorganization addresses several long-standing issues with Python’s profi
5454First, it improves **discoverability ** by collecting all built-in profilers
5555under a single, clearly named namespace. Currently, profiling tools are
5656scattered across modules with inconsistent naming and unclear relationships. By
57- introducing the ``profilers `` module, users will have a well-defined and
57+ introducing the ``profiling `` module, users will have a well-defined and
5858intuitive location to explore and access profiling functionality.
5959
6060Second, the proposal enhances **clarity ** by naming the submodules according to
61- their underlying methodology -- ``profilers .tracing `` for deterministic tracing
62- profilers and ``profilers .sampling `` for statistical sampling profilers. This
61+ their underlying methodology -- ``profiling .tracing `` for deterministic tracing
62+ profilers and ``profiling .sampling `` for statistical sampling profilers. This
6363explicit categorization makes it easier to understand the behavior and
6464limitations of each tool and aligns the API with the mental model users are
6565encouraged to adopt.
6666
6767Third, it provides **guidance ** to developers by making the recommended tools
6868easier to find and use. The current structure can mislead users into relying on
6969outdated or less performant modules like ``profile ``, simply because of naming
70- precedence. With the ``profilers `` namespace and its clearer semantics, users
70+ precedence. With the ``profiling `` namespace and its clearer semantics, users
7171are more likely to choose the appropriate profiler for their specific use case,
7272whether it involves low-overhead sampling or detailed tracing.
7373
7474Finally, this structure promotes **extensibility **. By consolidating profiling
7575tools under a unified namespace, it becomes straightforward to introduce future
7676profiling capabilities -- such as memory profilers, I/O profilers, or hybrid
7777tools -- without overloading unrelated modules or adding redundant top-level names.
78- The ``profilers `` module provides a natural home for this.
78+ The ``profiling `` module provides a natural home for this.
7979
8080Specification
8181=============
8282
8383New Module Structure
8484--------------------
8585
86- This PEP introduces a new ``profilers `` module containing:
86+ This PEP introduces a new ``profiling `` module containing:
8787
88- - ``profilers .tracing ``: an alias for ``cProfile ``, providing deterministic function-call tracing .
89- - ``profilers .sampling ``: an alias for `` profilers.tachyon ``, improving visibility and semantic clarity .
88+ - ``profiling .tracing ``: deterministic function-call tracing (relocated from ``cProfile ``) .
89+ - ``profiling .sampling ``: the statistical sampling profiler (tachyon) .
9090
91- Additionally the **code ** for the ``tachyon `` profiler will be also relocated to
92- the module as ``profilers.tachyon ``.
91+ The ``cProfile `` implementation will be relocated to ``profiling.tracing ``, with ``cProfile ``
92+ remaining as an alias for backwards compatibility. The tachyon sampling profiler will be
93+ available at ``profiling.sampling ``.
9394
9495Deprecation of ``profile ``
9596--------------------------
@@ -100,20 +101,20 @@ The ``profile`` module will be deprecated starting in Python 3.15.
100101- In Python 3.16: all uses of ``profile `` emit a ``DeprecationWarning ``.
101102- In Python 3.17: the module will be removed from the standard library.
102103
103- From Python 3.15, :mod: `!profilers .tracing ` will be preferred to :mod: `!cProfile ` & :mod: `!profile `.
104+ From Python 3.15, :mod: `!profiling .tracing ` will be preferred to :mod: `!cProfile ` & :mod: `!profile `.
104105
105106The code that, at the time of writing, is in the :mod: `!profile.sampling `
106- module will be moved to the :mod: `!profilers ` package.
107+ module will be moved to the :mod: `!profiling ` package.
107108
108109Documentation
109110=============
110111
111- The Python documentation will use the new :mod: `!profilers ` module as the canonical
112+ The Python documentation will use the new :mod: `!profiling ` module as the canonical
112113entry point for profiling functionality. It will also describe the distinction between
113114tracing and sampling profilers, and include guidance on when each type is most appropriate.
114115
115- Documentation for ``cProfile `` and `` profile.sample `` will remain available but will link to
116- the new ``profilers `` equivalents.
116+ Documentation for ``cProfile `` will remain available but will link to
117+ the new ``profiling `` equivalents.
117118
118119Backwards Compatibility
119120=======================
@@ -134,13 +135,30 @@ Renaming ``cProfile``
134135
135136Renaming ``cProfile `` to ``profile.tracing `` was considered, but this change would impact a
136137large amount of existing code. Maintaining the original name while aliasing it under
137- ``profilers.tracing `` strikes a balance between compatibility and clarity.
138+ ``profiling.tracing `` strikes a balance between compatibility and clarity.
139+
140+ Using ``profilers `` as the Module Name
141+ ---------------------------------------
142+
143+ The module was initially proposed as ``profilers `` (plural) but was changed to ``profiling ``
144+ (gerund form) based on community feedback. The gerund form is more consistent with other
145+ Python standard library modules that represent categories of functionality.
146+
147+ Multiple Names for the Sampling Profiler
148+ -----------------------------------------
149+
150+ An earlier version of this PEP proposed having the sampling profiler available under two names:
151+ ``profiling.sampling `` and ``profiling.tachyon ``. This was rejected to avoid confusion - when
152+ introducing new functionality, it's better to have a single, clear path to access it rather than
153+ multiple aliases. The name ``profiling.sampling `` was chosen as it clearly describes the
154+ profiling methodology, while "tachyon" remains as an internal codename that may be mentioned
155+ in documentation.
138156
139157Top-Level ``tachyon `` Module
140158----------------------------
141159
142160Introducing ``import tachyon `` as a new top-level module was rejected. Grouping tachyon under
143- ``profilers `` helps establish a logical structure and prevents proliferation of top-level modules
161+ ``profiling `` helps establish a logical structure and prevents proliferation of top-level modules
144162and also minimizes the usage of global namespace as requested by the Python Steering Council.
145163
146164Copyright
0 commit comments