You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CHANGERLOG.rst
- Reworded previous entry (pyutils#338)
- Reworded entry
kernprof.py
__doc__
Updated
_normalize_profiling_targets.__doc__
_restore_list.__doc__
pre_parse_single_arg_directive.__doc__
Reformatted to be more `sphinx`-friendly
main()
- Removed the `-e`/`--eager-preimports` flag
- Made eager pre-imports the default for `--prof-mod`
- Added new flag `--no-preimports` for restoring the old
behavior
Copy file name to clipboardExpand all lines: CHANGELOG.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,8 @@ Changes
11
11
* FIX: Fixed explicit profiling of class methods; added handling for profiling static, bound, and partial methods, ``functools.partial`` objects, (cached) properties, and async generator functions
12
12
* FIX: Fixed namespace bug when running ``kernprof -m`` on certain modules (e.g. ``calendar`` on Python 3.12+).
13
13
* FIX: Fixed ``@contextlib.contextmanager`` bug where the cleanup code (e.g. restoration of ``sys`` attributes) is not run if exceptions occurred inside the context
14
-
* ENH: Added CLI arguments ``-c`` to ``kernprof`` for (auto-)profiling module/package/inline-script execution instead of that of script files; passing ``'-'`` as the script-file name now also reads from and profiles ``stdin``
15
-
* ENH: Added CLI argument ``-e``/``--eager-preimports`` to profile target entities even when they aren't directly imported in the run script/module; made on-import profiling more aggressive so that it doesn't miss entities like class methods and properties
14
+
* ENH: Added CLI arguments ``-c`` to ``kernprof`` for (auto-)profiling inline-script execution instead of that of script files; passing ``'-'`` as the script-file name now also reads from and profiles ``stdin``
15
+
* ENH: ``kernprof --prof-mod`` target entities are now imported and profiled regardless of whether they are directly imported in the run script/module/code (old behavior recoed by passing ``--no-preimports``); made on-import profiling more aggressive so that it doesn't miss entities like class methods and properties
List of modules, functions and/or classes to profile specified by their name or path. These profiling targets can be supplied both as comma-separated
93
+
items, or separately with multiple copies of this flag. Adding the current script/module profiles the entirety of it. Only works with line_profiler -l,
94
+
--no-preimports Instead of eagerly importing all profiling targets specified via -p and profiling them, only profile those that are directly imported in the profiled
95
+
code. Only works with line_profiler -l, --line-by-line.
99
96
--prof-imports If specified, modules specified to `--prof-mod` will also autoprofile modules that they import. Only works with line_profiler -l, --line-by-line
97
+
98
+
NOTE:
99
+
100
+
New in 4.3.0: For more intuitive profiling behavior, profiling
101
+
targets in ``--prof-mod`` (except the profiled script/code) are now
102
+
eagerly pre-imported to be profiled
103
+
(see :py:mod:`line_profiler.autoprofile.eager_preimports`),
104
+
regardless of whether those imports directly occur in the profiled
105
+
script/module/code.
106
+
To restore the old behavior, pass the ``--no-preimports`` flag.
100
107
"""
101
108
importbuiltins
102
109
importfunctools
@@ -249,12 +256,13 @@ def _python_command():
249
256
250
257
def_normalize_profiling_targets(targets):
251
258
"""
252
-
Normalize the parsed `--prof-mod` and `--eager-preimports` by:
253
-
- Normalizing file paths with `find_script()`, and subsequently
254
-
to absolute paths.
255
-
- Splitting non-file paths at commas into (presumably) file paths
259
+
Normalize the parsed ``--prof-mod`` by:
260
+
261
+
* Normalizing file paths with :py:func:`find_script()`, and
262
+
subsequently to absolute paths.
263
+
* Splitting non-file paths at commas into (presumably) file paths
256
264
and/or dotted paths.
257
-
- Removing duplicates.
265
+
* Removing duplicates.
258
266
"""
259
267
deffind(path):
260
268
try:
@@ -277,8 +285,8 @@ def find(path):
277
285
278
286
class_restore_list:
279
287
"""
280
-
Restore a list like `sys.path` after running code which potentially
281
-
modifies it.
288
+
Restore a list like ``sys.path`` after running code which
0 commit comments