Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f4e7e50
WIP: eager on-import profiling
TTsangSC Apr 20, 2025
2783640
Tests: `~.autoprofile.eager_preimports`
TTsangSC Apr 20, 2025
0a9fc72
Eager pre-importing in `kernprof`
TTsangSC Apr 20, 2025
a5017f3
Extended `--eager-preimports`
TTsangSC Apr 20, 2025
51484cb
More aggressive on-import profiling
TTsangSC Apr 20, 2025
9cf3f95
Stub files
TTsangSC Apr 21, 2025
4b16b86
Test for `--eager-preimports`
TTsangSC Apr 21, 2025
090309f
Profiling-target-adding tests
TTsangSC Apr 21, 2025
7938681
Fixed recursion bug
TTsangSC Apr 21, 2025
0b0dbb0
CHANGELOG entry and doc fix
TTsangSC Apr 21, 2025
388d2dd
Compatibility fix with `pytest < 8`
TTsangSC Apr 21, 2025
d3026ef
Fixed `traceback` call (Python < 3.10 compat.)
TTsangSC Apr 21, 2025
410f9c9
Scope matching for `LineProfiler.add_*()`
TTsangSC Apr 24, 2025
ab2a716
Tests and fixes
TTsangSC Apr 27, 2025
a2bf845
Fixed typo
TTsangSC Apr 27, 2025
635f49f
Refactoring: default to eager imports
TTsangSC May 18, 2025
cc77994
Updated tests
TTsangSC May 18, 2025
1620fee
CI fix
TTsangSC May 18, 2025
831e52b
`line_profiler` refactoring
TTsangSC May 18, 2025
f6cf305
`line_profiler.line_profiler_utils` module
TTsangSC May 18, 2025
b59dffc
More refactoring
TTsangSC May 19, 2025
8641872
Streamlined `tests/test_eager_preimports.py`
TTsangSC May 19, 2025
3e82eff
Refactored `tests/test_explicit_profile.py`
TTsangSC May 19, 2025
4af3651
Refactored `tests/test_line_profiler.py`
TTsangSC May 19, 2025
8d2d534
Refactored `tests/test_autoprofile.py`
TTsangSC May 19, 2025
70ce3ac
`kernprof.py` doc updates and refactoring
TTsangSC May 19, 2025
48d3983
Doc updates
TTsangSC May 19, 2025
9d2e0ad
Refactored scoping policies
TTsangSC May 24, 2025
18f8d0a
Fixed test after rebasing on #345
TTsangSC May 24, 2025
96dbed3
Added scoping-policy tests
TTsangSC May 24, 2025
7d0f8a5
More sensible scoping defaults
TTsangSC May 24, 2025
0bf3fab
Doc fixes
TTsangSC May 26, 2025
3b0e94c
WIP: recurively profile packages
TTsangSC May 26, 2025
c9a9616
Doc updates
TTsangSC May 26, 2025
6a57b72
Simplified `kernprof`
TTsangSC May 26, 2025
8339e06
Cleanup in `kernprof`
TTsangSC May 26, 2025
e57b7a6
Separate `ScopingPolicy` into its own module
TTsangSC May 27, 2025
f6d84c5
Better support for handling classes
TTsangSC May 27, 2025
1a975f4
Fixed lint on stub file
TTsangSC May 27, 2025
4568db5
Doc for `.profiler_mixin`
TTsangSC May 27, 2025
b52bf7d
Added tests for class wrapping
TTsangSC May 27, 2025
99ab94b
`kernprof`: introduced verbosity levels
TTsangSC May 28, 2025
a1fb5ef
Better diagnostics output
TTsangSC May 28, 2025
43bf362
More refactoring
TTsangSC May 28, 2025
2153b18
Test and doc fixes
TTsangSC May 28, 2025
7cd55f6
More lenient pre-imports
TTsangSC May 28, 2025
c3221ed
`line_profiler.autoprofile.eager_preimports` tests
TTsangSC May 29, 2025
6bdb9bd
CI fix and CHANGELOG updates
TTsangSC May 29, 2025
c76ab78
Now skipping Cython callables
TTsangSC May 31, 2025
39451d9
Fixed bad stub file
TTsangSC May 31, 2025
9cd4ec9
Debugging
Erotemic Jun 8, 2025
7b8b7ef
Using exit hooks for deleting tempfiles
TTsangSC Jun 8, 2025
08e2ab6
More tempfile management
TTsangSC Jun 9, 2025
abc6818
Don't write profiling data from tempfiles
TTsangSC Jun 9, 2025
2bc4581
Merge pull request #1 from Erotemic/eager-prof-mod
TTsangSC Jun 14, 2025
8782a05
Merge pull request #2 from TTsangSC/eager-prof-mod-tempfile-updates
TTsangSC Jun 14, 2025
12ae3e2
Adaptation of TTsangSC#1
TTsangSC Jun 15, 2025
6488a9a
Integration between TTsangSC#1 and #2
TTsangSC Jun 15, 2025
4f81a8c
Separate static and dynamic pre-import code paths
TTsangSC Jun 15, 2025
caa3b20
Updated tests for eager pre-imports
TTsangSC Jun 15, 2025
7288e1a
Default to import-based pre-imports in `kernprof`
TTsangSC Jun 15, 2025
7f23e23
Logging function adds
TTsangSC Jun 15, 2025
e842d23
Better (non-)handling of Cython functions
TTsangSC Jun 15, 2025
447ab0a
remove code diagnostics
Erotemic Jul 5, 2025
d942680
remove code diagnostics
Erotemic Jul 5, 2025
1b88d97
Simplified logger usage
Erotemic Jul 5, 2025
6763031
refactor functools.partial in write_module
Erotemic Jul 5, 2025
e059764
Refactor dump_filtered_stats
Erotemic Jul 5, 2025
161ddf8
Simplify _write_preimports
Erotemic Jul 5, 2025
cad8998
Move _call_with_diagnostics to global scope
Erotemic Jul 5, 2025
1fdd0da
Refactor main to reduce complexity
Erotemic Jul 5, 2025
4a420db
Breakup _profile_main into smaller parts to reduce complexity
Erotemic Jul 5, 2025
0b8cc7e
Merge pull request #3 from Erotemic/review-suggestions
TTsangSC Jul 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ Changes
* 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
* FIX: Fixed namespace bug when running ``kernprof -m`` on certain modules (e.g. ``calendar`` on Python 3.12+).
* FIX: Fixed ``@contextlib.contextmanager`` bug where the cleanup code (e.g. restoration of ``sys`` attributes) is not run if exceptions occurred inside the context
* 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``
* 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``
* ENH: In Python >=3.11, profiled objects are reported using their qualified name.
* ENH: Highlight final summary using rich if enabled
* ENH: Made it possible to use multiple profiler instances simultaneously
* ENH: various improvements related to auto-profiling:
* ``kernprof -p`` target entities are now imported and profiled regardless of
whether they are directly imported in the run script/module/code (old
behavior restored by passing ``--no-preimports``)
* ``kernprof -v`` and the new ``-q`` now control the verbosity level instead
of being a boolean, allowing diagnostic outputs or output suppression
* On-import profiling is now more aggressive so that it doesn't miss entities
like class methods and properties
* ``LineProfiler`` can now be used as a class decorator

4.2.0
~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
line\_profiler.autoprofile.eager\_preimports module
===================================================

.. automodule:: line_profiler.autoprofile.eager_preimports
:members:
:undoc-members:
:show-inheritance:
:private-members:
2 changes: 2 additions & 0 deletions docs/source/auto/line_profiler.autoprofile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Submodules
line_profiler.autoprofile.ast_profile_transformer
line_profiler.autoprofile.ast_tree_profiler
line_profiler.autoprofile.autoprofile
line_profiler.autoprofile.eager_preimports
line_profiler.autoprofile.line_profiler_utils
line_profiler.autoprofile.profmod_extractor
line_profiler.autoprofile.run_module
line_profiler.autoprofile.util_static

Module contents
Expand Down
8 changes: 8 additions & 0 deletions docs/source/auto/line_profiler.autoprofile.run_module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
line\_profiler.autoprofile.run\_module module
=============================================

.. automodule:: line_profiler.autoprofile.run_module
:members:
:undoc-members:
:show-inheritance:
:private-members:
8 changes: 8 additions & 0 deletions docs/source/auto/line_profiler.profiler_mixin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
line\_profiler.profiler\_mixin module
=====================================

.. automodule:: line_profiler.profiler_mixin
:members:
:undoc-members:
:show-inheritance:
:private-members:
2 changes: 2 additions & 0 deletions docs/source/auto/line_profiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Submodules
line_profiler.explicit_profiler
line_profiler.ipython_extension
line_profiler.line_profiler
line_profiler.profiler_mixin
line_profiler.scoping_policy

Module contents
---------------
Expand Down
8 changes: 8 additions & 0 deletions docs/source/auto/line_profiler.scoping_policy.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
line\_profiler.scoping\_policy module
=====================================

.. automodule:: line_profiler.scoping_policy
:members:
:undoc-members:
:show-inheritance:
:private-members:
Loading
Loading