linescope 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linescope-0.1.0/LICENSE +21 -0
- linescope-0.1.0/PKG-INFO +255 -0
- linescope-0.1.0/README.md +223 -0
- linescope-0.1.0/docs_sources/__init__.py +6 -0
- linescope-0.1.0/docs_sources/about.md +76 -0
- linescope-0.1.0/docs_sources/api/backends/profilerbackend.md +25 -0
- linescope-0.1.0/docs_sources/api/backends/rawbackendresult.md +12 -0
- linescope-0.1.0/docs_sources/api/backends/rawline.md +12 -0
- linescope-0.1.0/docs_sources/api/backends/register_backend.md +14 -0
- linescope-0.1.0/docs_sources/api/configuration/config.md +16 -0
- linescope-0.1.0/docs_sources/api/model/measurements/backendcapabilities.md +11 -0
- linescope-0.1.0/docs_sources/api/model/measurements/functionstats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/measurements/linestats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/memory/gpustats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/memory/memorysample.md +11 -0
- linescope-0.1.0/docs_sources/api/model/memory/memorystats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/memory/processmemorystats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/backend.md +21 -0
- linescope-0.1.0/docs_sources/api/model/options/displaymode.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/notebookcollection.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/runstatus.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/sessionstate.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/sourcekind.md +11 -0
- linescope-0.1.0/docs_sources/api/model/options/symbolkind.md +11 -0
- linescope-0.1.0/docs_sources/api/model/results/profileresult.md +26 -0
- linescope-0.1.0/docs_sources/api/model/results/profilerun.md +11 -0
- linescope-0.1.0/docs_sources/api/model/source/sourcelocation.md +11 -0
- linescope-0.1.0/docs_sources/api/model/source/sourceunit.md +11 -0
- linescope-0.1.0/docs_sources/api/model/source/symboldefinition.md +11 -0
- linescope-0.1.0/docs_sources/api/model/source/symbolref.md +12 -0
- linescope-0.1.0/docs_sources/api/model/spark/sparkexecution.md +11 -0
- linescope-0.1.0/docs_sources/api/model/spark/sparkexecutionstats.md +11 -0
- linescope-0.1.0/docs_sources/api/model/spark/sparkoperator.md +11 -0
- linescope-0.1.0/docs_sources/api/profiling/profile.md +35 -0
- linescope-0.1.0/docs_sources/api/profiling/profilecontroller.md +34 -0
- linescope-0.1.0/docs_sources/api/profiling/profiler.md +35 -0
- linescope-0.1.0/docs_sources/api/profiling/session.md +31 -0
- linescope-0.1.0/docs_sources/cli/linescope.md +15 -0
- linescope-0.1.0/docs_sources/dependencies.md +113 -0
- linescope-0.1.0/docs_sources/development.md +353 -0
- linescope-0.1.0/docs_sources/examples/notebooks/gpu_example.ipynb +617 -0
- linescope-0.1.0/docs_sources/examples/notebooks/notebook_example.ipynb +119 -0
- linescope-0.1.0/docs_sources/examples/notebooks/spark_example.ipynb +59 -0
- linescope-0.1.0/docs_sources/faq.md +113 -0
- linescope-0.1.0/docs_sources/getting_started.md +176 -0
- linescope-0.1.0/docs_sources/img/backends/scalene.png +0 -0
- linescope-0.1.0/docs_sources/img/backends/tachyon.svg +1 -0
- linescope-0.1.0/docs_sources/img/backends/trace.svg +1 -0
- linescope-0.1.0/docs_sources/img/icon.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/backends.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/gpu.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/memory.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/navigation.svg +17 -0
- linescope-0.1.0/docs_sources/img/icons/notebooks.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/performance.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/reports.svg +1 -0
- linescope-0.1.0/docs_sources/img/icons/spark.svg +1 -0
- linescope-0.1.0/docs_sources/img/logo.png +0 -0
- linescope-0.1.0/docs_sources/img/report.jpg +0 -0
- linescope-0.1.0/docs_sources/img/source.jpg +0 -0
- linescope-0.1.0/docs_sources/img/support/jetbrains.png +0 -0
- linescope-0.1.0/docs_sources/img/support/pycharm.png +0 -0
- linescope-0.1.0/docs_sources/index.md +6 -0
- linescope-0.1.0/docs_sources/license.md +20 -0
- linescope-0.1.0/docs_sources/overrides/home.html +26 -0
- linescope-0.1.0/docs_sources/overrides/main.html +23 -0
- linescope-0.1.0/docs_sources/scripts/__init__.py +20 -0
- linescope-0.1.0/docs_sources/scripts/autodocs.py +1063 -0
- linescope-0.1.0/docs_sources/scripts/autorun.py +162 -0
- linescope-0.1.0/docs_sources/scripts/notebooks.py +172 -0
- linescope-0.1.0/docs_sources/stylesheets/extra.css +412 -0
- linescope-0.1.0/docs_sources/user_guide/backends.md +261 -0
- linescope-0.1.0/docs_sources/user_guide/configuration.md +71 -0
- linescope-0.1.0/docs_sources/user_guide/gpu.md +82 -0
- linescope-0.1.0/docs_sources/user_guide/introduction.md +73 -0
- linescope-0.1.0/docs_sources/user_guide/notebooks.md +207 -0
- linescope-0.1.0/docs_sources/user_guide/reports.md +274 -0
- linescope-0.1.0/docs_sources/user_guide/spark.md +182 -0
- linescope-0.1.0/examples/__init__.py +6 -0
- linescope-0.1.0/examples/databricks_example.py +33 -0
- linescope-0.1.0/examples/gpu_example.py +116 -0
- linescope-0.1.0/examples/memory_example.py +62 -0
- linescope-0.1.0/examples/notebooks/gpu_example.ipynb +617 -0
- linescope-0.1.0/examples/notebooks/notebook_example.ipynb +119 -0
- linescope-0.1.0/examples/notebooks/spark_example.ipynb +59 -0
- linescope-0.1.0/examples/package_example.py +37 -0
- linescope-0.1.0/examples/sample_package/__init__.py +7 -0
- linescope-0.1.0/examples/sample_package/__main__.py +29 -0
- linescope-0.1.0/examples/sample_package/helpers.py +90 -0
- linescope-0.1.0/examples/script_example.py +175 -0
- linescope-0.1.0/examples/spark_example.py +129 -0
- linescope-0.1.0/images/files.jpg +0 -0
- linescope-0.1.0/images/functions.jpg +0 -0
- linescope-0.1.0/images/logo.png +0 -0
- linescope-0.1.0/images/notebooks.jpg +0 -0
- linescope-0.1.0/images/report.jpg +0 -0
- linescope-0.1.0/images/source.jpg +0 -0
- linescope-0.1.0/images/spark.jpg +0 -0
- linescope-0.1.0/mkdocs.yml +178 -0
- linescope-0.1.0/pyproject.toml +241 -0
- linescope-0.1.0/pyproject.toml.orig +201 -0
- linescope-0.1.0/src/linescope/__init__.py +62 -0
- linescope-0.1.0/src/linescope/api.py +937 -0
- linescope-0.1.0/src/linescope/backends/__init__.py +12 -0
- linescope-0.1.0/src/linescope/backends/base.py +231 -0
- linescope-0.1.0/src/linescope/backends/scalene.py +1164 -0
- linescope-0.1.0/src/linescope/backends/tachyon.py +543 -0
- linescope-0.1.0/src/linescope/backends/trace.py +572 -0
- linescope-0.1.0/src/linescope/cli.py +248 -0
- linescope-0.1.0/src/linescope/config.py +288 -0
- linescope-0.1.0/src/linescope/enums.py +176 -0
- linescope-0.1.0/src/linescope/memory.py +381 -0
- linescope-0.1.0/src/linescope/model.py +761 -0
- linescope-0.1.0/src/linescope/notebooks/__init__.py +21 -0
- linescope-0.1.0/src/linescope/notebooks/correlation.py +202 -0
- linescope-0.1.0/src/linescope/notebooks/databricks.py +416 -0
- linescope-0.1.0/src/linescope/notebooks/identity.py +183 -0
- linescope-0.1.0/src/linescope/notebooks/ipython.py +842 -0
- linescope-0.1.0/src/linescope/notebooks/remote.py +580 -0
- linescope-0.1.0/src/linescope/notebooks/serialization.py +195 -0
- linescope-0.1.0/src/linescope/notebooks/summary.py +219 -0
- linescope-0.1.0/src/linescope/render/__init__.py +10 -0
- linescope-0.1.0/src/linescope/render/assets/app.js +258 -0
- linescope-0.1.0/src/linescope/render/assets/cell-sort.js +35 -0
- linescope-0.1.0/src/linescope/render/assets/icon.svg +1 -0
- linescope-0.1.0/src/linescope/render/assets/styles.css +65 -0
- linescope-0.1.0/src/linescope/render/cell.py +383 -0
- linescope-0.1.0/src/linescope/render/html.py +3142 -0
- linescope-0.1.0/src/linescope/render/spark.py +428 -0
- linescope-0.1.0/src/linescope/source/__init__.py +11 -0
- linescope-0.1.0/src/linescope/source/discovery.py +449 -0
- linescope-0.1.0/src/linescope/source/symbols.py +1382 -0
- linescope-0.1.0/src/linescope/spark/__init__.py +11 -0
- linescope-0.1.0/src/linescope/spark/listener.py +1116 -0
- linescope-0.1.0/src/linescope/spark/metrics.py +328 -0
- linescope-0.1.0/src/linescope/spark/plans.py +209 -0
- linescope-0.1.0/tests/__init__.py +6 -0
- linescope-0.1.0/tests/test_api_failures.py +170 -0
- linescope-0.1.0/tests/test_cell_metrics.py +187 -0
- linescope-0.1.0/tests/test_cell_summary.py +790 -0
- linescope-0.1.0/tests/test_child_notebooks.py +808 -0
- linescope-0.1.0/tests/test_cli.py +713 -0
- linescope-0.1.0/tests/test_core.py +930 -0
- linescope-0.1.0/tests/test_docs_api.py +355 -0
- linescope-0.1.0/tests/test_docs_hooks.py +537 -0
- linescope-0.1.0/tests/test_docs_notebooks.py +610 -0
- linescope-0.1.0/tests/test_docstring_style.py +87 -0
- linescope-0.1.0/tests/test_enums.py +238 -0
- linescope-0.1.0/tests/test_examples.py +622 -0
- linescope-0.1.0/tests/test_gpu.py +269 -0
- linescope-0.1.0/tests/test_gpu_example.py +251 -0
- linescope-0.1.0/tests/test_gpu_view.py +212 -0
- linescope-0.1.0/tests/test_installation.py +141 -0
- linescope-0.1.0/tests/test_memory.py +793 -0
- linescope-0.1.0/tests/test_notebook_diagnostics.py +166 -0
- linescope-0.1.0/tests/test_notebook_identity.py +303 -0
- linescope-0.1.0/tests/test_notebook_integration.py +820 -0
- linescope-0.1.0/tests/test_notebooks.py +691 -0
- linescope-0.1.0/tests/test_render.py +2734 -0
- linescope-0.1.0/tests/test_render_controls.py +454 -0
- linescope-0.1.0/tests/test_render_merge.py +253 -0
- linescope-0.1.0/tests/test_render_notebooks.py +562 -0
- linescope-0.1.0/tests/test_report_columns.py +271 -0
- linescope-0.1.0/tests/test_report_scope.py +47 -0
- linescope-0.1.0/tests/test_sampling.py +690 -0
- linescope-0.1.0/tests/test_scalene.py +575 -0
- linescope-0.1.0/tests/test_scalene_lifecycle.py +499 -0
- linescope-0.1.0/tests/test_source.py +239 -0
- linescope-0.1.0/tests/test_source_navigation.py +571 -0
- linescope-0.1.0/tests/test_spark.py +740 -0
- linescope-0.1.0/tests/test_spark_failures.py +245 -0
- linescope-0.1.0/tests/test_spark_lazy.py +428 -0
- linescope-0.1.0/tests/test_spark_local.py +137 -0
- linescope-0.1.0/tests/test_spark_overview.py +214 -0
- linescope-0.1.0/tests/test_spark_summary_edges.py +162 -0
- linescope-0.1.0/tests/test_tachyon.py +506 -0
- linescope-0.1.0/tests/test_trace_events.py +179 -0
- linescope-0.1.0/tests/test_trace_memory.py +537 -0
- linescope-0.1.0/tox.ini +72 -0
- linescope-0.1.0/uv.lock +3770 -0
linescope-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mavs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
linescope-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: linescope
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A refreshingly simple source profiler for Python and Spark
|
|
5
|
+
Keywords: profiling,source,notebooks,spark,scalene
|
|
6
|
+
Author: Mavs
|
|
7
|
+
Author-email: Mavs <m.524687@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Requires-Dist: click>=8.4.2
|
|
19
|
+
Requires-Dist: psutil>=5.9
|
|
20
|
+
Requires-Dist: linescope[scalene,notebook] ; extra == 'full'
|
|
21
|
+
Requires-Dist: ipython>=8.20 ; extra == 'notebook'
|
|
22
|
+
Requires-Dist: ipykernel>=6.29 ; extra == 'notebook'
|
|
23
|
+
Requires-Dist: scalene>=2.3,<2.4 ; python_full_version < '3.15' and extra == 'scalene'
|
|
24
|
+
Requires-Python: >=3.11, <3.16
|
|
25
|
+
Project-URL: Documentation, https://tvdboom.github.io/linescope/
|
|
26
|
+
Project-URL: Issues, https://github.com/tvdboom/linescope/issues
|
|
27
|
+
Project-URL: Repository, https://github.com/tvdboom/linescope
|
|
28
|
+
Provides-Extra: full
|
|
29
|
+
Provides-Extra: notebook
|
|
30
|
+
Provides-Extra: scalene
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<div align="center">
|
|
34
|
+
<a href="#" draggable="false" style="pointer-events: none; user-select: none;"><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/logo.png" alt="LineScope logo" width="280" draggable="false" style="pointer-events: none; user-select: none;" /></a>
|
|
35
|
+
|
|
36
|
+
## Your code. In the spotlight.
|
|
37
|
+
|
|
38
|
+
### A refreshingly simple source profiler for Python and Spark.
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<br>
|
|
42
|
+
|
|
43
|
+
📜 Overview
|
|
44
|
+
-----------
|
|
45
|
+
|
|
46
|
+
| **General Information** | |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| **Repository** | [](https://www.repostatus.org/#active) [](https://opensource.org/licenses/MIT) [](https://pepy.tech/project/linescope) [](https://pypi.org/project/linescope/) |
|
|
49
|
+
| **Build** | [](https://github.com/tvdboom/linescope/actions/workflows/publish.yml) [](https://github.com/tvdboom/linescope/actions/workflows/test.yml) [](https://codecov.io/gh/tvdboom/linescope) |
|
|
50
|
+
| **Code** | [](https://www.python.org) [](https://docs.astral.sh/uv/) [](https://www.python.org/dev/peps/pep-0008/) [](https://docs.astral.sh/ruff/) [](https://docs.astral.sh/ty/) |
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
|
|
54
|
+
<table>
|
|
55
|
+
<tr>
|
|
56
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/report.jpg" alt="LineScope overview with the most expensive source lines" width="100%" /></td>
|
|
57
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/source.jpg" alt="LineScope full-source heatmap with clickable function calls" width="100%" /></td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/functions.jpg" alt="LineScope function timings and source links" width="100%" /></td>
|
|
61
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/notebooks.jpg" alt="LineScope notebook session with captured cells" width="100%" /></td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/spark.jpg" alt="LineScope Spark actions and operator costs" width="100%" /></td>
|
|
65
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/files.jpg" alt="LineScope project source files and measured timings" width="100%" /></td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
<br>
|
|
70
|
+
|
|
71
|
+
💡 Introduction
|
|
72
|
+
---------------
|
|
73
|
+
|
|
74
|
+
LineScope shows where time is spent in **your Python source, line by line**.
|
|
75
|
+
Browse full files and notebook cells, follow function and class links, and
|
|
76
|
+
inspect Spark executions beside the driver code that triggered them. Work inside
|
|
77
|
+
pandas, native libraries, I/O, and other dependencies stays attributed to the
|
|
78
|
+
relevant source line instead of filling the report with their internals.
|
|
79
|
+
|
|
80
|
+
The result is a single HTML file with its own source snapshots, styles, and
|
|
81
|
+
scripts. Open it offline, revisit it after code changes, or share it after
|
|
82
|
+
reviewing the embedded source.
|
|
83
|
+
|
|
84
|
+
<br>
|
|
85
|
+
|
|
86
|
+
❗ Why use LineScope?
|
|
87
|
+
-------------------
|
|
88
|
+
|
|
89
|
+
- **Source first.** Full files and cells, timing heatmaps, and unexecuted lines
|
|
90
|
+
in context.
|
|
91
|
+
- **Follow your code.** Click individual function, class, and resolved method calls.
|
|
92
|
+
- **Several ways to work.** Context managers, explicit start/stop, CLI scripts/modules,
|
|
93
|
+
and cell magic.
|
|
94
|
+
- **Spark aware.** Observe real actions and available executed plans without
|
|
95
|
+
forcing lazy work.
|
|
96
|
+
- **Honest measurements.** Keep missing metrics unknown and driver time separate
|
|
97
|
+
from executor work.
|
|
98
|
+
- **Portable reports.** No server or CDN needed to view the generated HTML.
|
|
99
|
+
- **Pluggable collection.** Choose from 3 different profiling backends: trace, scalene
|
|
100
|
+
or trachyon.
|
|
101
|
+
|
|
102
|
+
<br>
|
|
103
|
+
|
|
104
|
+
🚀 Getting started
|
|
105
|
+
------------------
|
|
106
|
+
|
|
107
|
+
## Installation
|
|
108
|
+
|
|
109
|
+
Install or upgrade LineScope in the same environment as your script or
|
|
110
|
+
notebook. Python 3.11–3.15 is supported:
|
|
111
|
+
|
|
112
|
+
```console
|
|
113
|
+
uv pip install --upgrade linescope
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use an existing virtual environment, or create one with `uv venv` first.
|
|
117
|
+
Activate it with `.venv\Scripts\Activate.ps1` in PowerShell or
|
|
118
|
+
`source .venv/bin/activate` on Linux and macOS. With pip, use
|
|
119
|
+
`python -m pip install --upgrade linescope`; you can replace `uv pip` with
|
|
120
|
+
`python -m pip` in the commands below.
|
|
121
|
+
|
|
122
|
+
The base package includes the default Trace profiler, CLI, HTML reports, and
|
|
123
|
+
driver memory collection.
|
|
124
|
+
|
|
125
|
+
### Latest source
|
|
126
|
+
|
|
127
|
+
Install unreleased changes directly from the `main` branch. Git is required:
|
|
128
|
+
|
|
129
|
+
```console
|
|
130
|
+
uv pip install --upgrade "git+https://github.com/tvdboom/linescope.git@main"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Optional dependencies
|
|
134
|
+
|
|
135
|
+
- **`scalene`** installs Scalene for CPU sampling and supported GPU measurements
|
|
136
|
+
on Python 3.11–3.14. Select it with `--backend scalene` or
|
|
137
|
+
`backend="scalene"`; it is omitted on Python 3.15.
|
|
138
|
+
|
|
139
|
+
```console
|
|
140
|
+
uv pip install --upgrade "linescope[scalene]"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- **`notebook`** installs IPython and ipykernel for cell magics, notebook
|
|
144
|
+
capture, and inline reports.
|
|
145
|
+
|
|
146
|
+
```console
|
|
147
|
+
uv pip install --upgrade "linescope[notebook]"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- **`full`** installs both extras. Scalene is omitted on Python 3.15;
|
|
151
|
+
development tools and GPU demo dependencies are separate.
|
|
152
|
+
|
|
153
|
+
```console
|
|
154
|
+
uv pip install --upgrade "linescope[full]"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Combine individual extras with `linescope[scalene,notebook]`. Spark and
|
|
158
|
+
Databricks integration use the runtime's existing PySpark and Databricks SDK;
|
|
159
|
+
LineScope does not install either library. Install the base package or
|
|
160
|
+
`linescope[notebook]` in those environments. Spark profiling is opt-in with
|
|
161
|
+
`spark=True` or `--spark`, and requires PySpark to be available.
|
|
162
|
+
|
|
163
|
+
Install the latest source with all integrations directly from Git:
|
|
164
|
+
|
|
165
|
+
```console
|
|
166
|
+
uv pip install "linescope[full] @ git+https://github.com/tvdboom/linescope"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Contributing
|
|
170
|
+
|
|
171
|
+
Install the locked development environment from a checkout:
|
|
172
|
+
|
|
173
|
+
```console
|
|
174
|
+
git clone https://github.com/tvdboom/linescope.git
|
|
175
|
+
cd linescope
|
|
176
|
+
uv sync --locked
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
See the [installation guide] for more setup details and the
|
|
180
|
+
[development guide] for contribution checks.
|
|
181
|
+
|
|
182
|
+
[installation guide]:
|
|
183
|
+
https://tvdboom.github.io/linescope/latest/getting_started/#installation
|
|
184
|
+
[development guide]: https://tvdboom.github.io/linescope/latest/development/
|
|
185
|
+
|
|
186
|
+
## Usage
|
|
187
|
+
|
|
188
|
+
### From the terminal
|
|
189
|
+
|
|
190
|
+
Run your own script under LineScope without changing its source:
|
|
191
|
+
|
|
192
|
+
```console
|
|
193
|
+
linescope --backend trace --output linescope.html your_script.py
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The script runs normally, then LineScope saves `linescope.html` in the current
|
|
197
|
+
directory and opens it in a browser. The report contains your source with
|
|
198
|
+
line-by-line timings and works offline.
|
|
199
|
+
|
|
200
|
+
Place LineScope options before the script path. Arguments after the path go to
|
|
201
|
+
your script. You can also profile an importable module from your project root:
|
|
202
|
+
|
|
203
|
+
```console
|
|
204
|
+
linescope --backend trace --output linescope.html your_script.py --input data.csv
|
|
205
|
+
linescope --backend trace --output linescope.html -m your_package.your_module
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
To save the report without opening a browser:
|
|
209
|
+
|
|
210
|
+
```console
|
|
211
|
+
linescope --backend trace --display none --output linescope.html your_script.py
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### From Python code
|
|
215
|
+
|
|
216
|
+
Wrap the work you want to measure with `profile` in your own script. Here,
|
|
217
|
+
`main()` is your existing entry point; replace it with the calls you want to
|
|
218
|
+
profile:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
from linescope import profile
|
|
222
|
+
|
|
223
|
+
with profile(backend="trace", output="linescope.html") as session:
|
|
224
|
+
main()
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Run the script as usual:
|
|
228
|
+
|
|
229
|
+
```console
|
|
230
|
+
python your_script.py
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
When the block exits, profiling stops and the report is saved and opened. For
|
|
234
|
+
headless use, add `display="none"` to `profile(...)` and call
|
|
235
|
+
`session.save("linescope.html")` after the block to write the report.
|
|
236
|
+
|
|
237
|
+
<br>
|
|
238
|
+
|
|
239
|
+
📘 Documentation
|
|
240
|
+
----------------
|
|
241
|
+
|
|
242
|
+
| **Relevant links** | |
|
|
243
|
+
| --- | --- |
|
|
244
|
+
| ⭐ **[About](https://tvdboom.github.io/linescope/latest/about/)** | Learn more about the package. |
|
|
245
|
+
| 🚀 **[Getting started](https://tvdboom.github.io/linescope/latest/getting_started/)** | New to LineScope? Here's how to get you started! |
|
|
246
|
+
| 👨💻 **[User guide](https://tvdboom.github.io/linescope/latest/user_guide/introduction/)** | How to use LineScope and its features. |
|
|
247
|
+
| 📓 **[Notebooks](https://tvdboom.github.io/linescope/latest/user_guide/notebooks/)** | Profile a cell or a whole notebook session. |
|
|
248
|
+
| ⚡ **[Spark](https://tvdboom.github.io/linescope/latest/user_guide/spark/)** | Follow Spark actions, executed plans, and distributed metrics. |
|
|
249
|
+
| 🧱 **[Databricks](https://tvdboom.github.io/linescope/latest/user_guide/notebooks/#databricks)** | Capture workspace source and correlate child notebook runs. |
|
|
250
|
+
| 🎛️ **[API Reference](https://tvdboom.github.io/linescope/latest/api/configuration/config/)** | The detailed reference for LineScope's API. |
|
|
251
|
+
| ⌨️ **[CLI](https://tvdboom.github.io/linescope/latest/cli/linescope/)** | Profile Python scripts and modules from the command line. |
|
|
252
|
+
| ❔ **[FAQ](https://tvdboom.github.io/linescope/latest/faq/)** | Get answers to frequently asked questions. |
|
|
253
|
+
| 🔧 **[Contributing](https://tvdboom.github.io/linescope/latest/development/)** | Read this before creating a PR. |
|
|
254
|
+
| 🌳 **[Dependencies](https://tvdboom.github.io/linescope/latest/dependencies/)** | Which other packages does LineScope depend on? |
|
|
255
|
+
| 📃 **[License](https://tvdboom.github.io/linescope/latest/license/)** | Copyright and permissions under the MIT license. |
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="#" draggable="false" style="pointer-events: none; user-select: none;"><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/logo.png" alt="LineScope logo" width="280" draggable="false" style="pointer-events: none; user-select: none;" /></a>
|
|
3
|
+
|
|
4
|
+
## Your code. In the spotlight.
|
|
5
|
+
|
|
6
|
+
### A refreshingly simple source profiler for Python and Spark.
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
|
|
11
|
+
📜 Overview
|
|
12
|
+
-----------
|
|
13
|
+
|
|
14
|
+
| **General Information** | |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| **Repository** | [](https://www.repostatus.org/#active) [](https://opensource.org/licenses/MIT) [](https://pepy.tech/project/linescope) [](https://pypi.org/project/linescope/) |
|
|
17
|
+
| **Build** | [](https://github.com/tvdboom/linescope/actions/workflows/publish.yml) [](https://github.com/tvdboom/linescope/actions/workflows/test.yml) [](https://codecov.io/gh/tvdboom/linescope) |
|
|
18
|
+
| **Code** | [](https://www.python.org) [](https://docs.astral.sh/uv/) [](https://www.python.org/dev/peps/pep-0008/) [](https://docs.astral.sh/ruff/) [](https://docs.astral.sh/ty/) |
|
|
19
|
+
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
<table>
|
|
23
|
+
<tr>
|
|
24
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/report.jpg" alt="LineScope overview with the most expensive source lines" width="100%" /></td>
|
|
25
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/source.jpg" alt="LineScope full-source heatmap with clickable function calls" width="100%" /></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/functions.jpg" alt="LineScope function timings and source links" width="100%" /></td>
|
|
29
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/notebooks.jpg" alt="LineScope notebook session with captured cells" width="100%" /></td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/spark.jpg" alt="LineScope Spark actions and operator costs" width="100%" /></td>
|
|
33
|
+
<td><img src="https://raw.githubusercontent.com/tvdboom/linescope/main/images/files.jpg" alt="LineScope project source files and measured timings" width="100%" /></td>
|
|
34
|
+
</tr>
|
|
35
|
+
</table>
|
|
36
|
+
|
|
37
|
+
<br>
|
|
38
|
+
|
|
39
|
+
💡 Introduction
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
LineScope shows where time is spent in **your Python source, line by line**.
|
|
43
|
+
Browse full files and notebook cells, follow function and class links, and
|
|
44
|
+
inspect Spark executions beside the driver code that triggered them. Work inside
|
|
45
|
+
pandas, native libraries, I/O, and other dependencies stays attributed to the
|
|
46
|
+
relevant source line instead of filling the report with their internals.
|
|
47
|
+
|
|
48
|
+
The result is a single HTML file with its own source snapshots, styles, and
|
|
49
|
+
scripts. Open it offline, revisit it after code changes, or share it after
|
|
50
|
+
reviewing the embedded source.
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
|
|
54
|
+
❗ Why use LineScope?
|
|
55
|
+
-------------------
|
|
56
|
+
|
|
57
|
+
- **Source first.** Full files and cells, timing heatmaps, and unexecuted lines
|
|
58
|
+
in context.
|
|
59
|
+
- **Follow your code.** Click individual function, class, and resolved method calls.
|
|
60
|
+
- **Several ways to work.** Context managers, explicit start/stop, CLI scripts/modules,
|
|
61
|
+
and cell magic.
|
|
62
|
+
- **Spark aware.** Observe real actions and available executed plans without
|
|
63
|
+
forcing lazy work.
|
|
64
|
+
- **Honest measurements.** Keep missing metrics unknown and driver time separate
|
|
65
|
+
from executor work.
|
|
66
|
+
- **Portable reports.** No server or CDN needed to view the generated HTML.
|
|
67
|
+
- **Pluggable collection.** Choose from 3 different profiling backends: trace, scalene
|
|
68
|
+
or trachyon.
|
|
69
|
+
|
|
70
|
+
<br>
|
|
71
|
+
|
|
72
|
+
🚀 Getting started
|
|
73
|
+
------------------
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
Install or upgrade LineScope in the same environment as your script or
|
|
78
|
+
notebook. Python 3.11–3.15 is supported:
|
|
79
|
+
|
|
80
|
+
```console
|
|
81
|
+
uv pip install --upgrade linescope
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use an existing virtual environment, or create one with `uv venv` first.
|
|
85
|
+
Activate it with `.venv\Scripts\Activate.ps1` in PowerShell or
|
|
86
|
+
`source .venv/bin/activate` on Linux and macOS. With pip, use
|
|
87
|
+
`python -m pip install --upgrade linescope`; you can replace `uv pip` with
|
|
88
|
+
`python -m pip` in the commands below.
|
|
89
|
+
|
|
90
|
+
The base package includes the default Trace profiler, CLI, HTML reports, and
|
|
91
|
+
driver memory collection.
|
|
92
|
+
|
|
93
|
+
### Latest source
|
|
94
|
+
|
|
95
|
+
Install unreleased changes directly from the `main` branch. Git is required:
|
|
96
|
+
|
|
97
|
+
```console
|
|
98
|
+
uv pip install --upgrade "git+https://github.com/tvdboom/linescope.git@main"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Optional dependencies
|
|
102
|
+
|
|
103
|
+
- **`scalene`** installs Scalene for CPU sampling and supported GPU measurements
|
|
104
|
+
on Python 3.11–3.14. Select it with `--backend scalene` or
|
|
105
|
+
`backend="scalene"`; it is omitted on Python 3.15.
|
|
106
|
+
|
|
107
|
+
```console
|
|
108
|
+
uv pip install --upgrade "linescope[scalene]"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- **`notebook`** installs IPython and ipykernel for cell magics, notebook
|
|
112
|
+
capture, and inline reports.
|
|
113
|
+
|
|
114
|
+
```console
|
|
115
|
+
uv pip install --upgrade "linescope[notebook]"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- **`full`** installs both extras. Scalene is omitted on Python 3.15;
|
|
119
|
+
development tools and GPU demo dependencies are separate.
|
|
120
|
+
|
|
121
|
+
```console
|
|
122
|
+
uv pip install --upgrade "linescope[full]"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Combine individual extras with `linescope[scalene,notebook]`. Spark and
|
|
126
|
+
Databricks integration use the runtime's existing PySpark and Databricks SDK;
|
|
127
|
+
LineScope does not install either library. Install the base package or
|
|
128
|
+
`linescope[notebook]` in those environments. Spark profiling is opt-in with
|
|
129
|
+
`spark=True` or `--spark`, and requires PySpark to be available.
|
|
130
|
+
|
|
131
|
+
Install the latest source with all integrations directly from Git:
|
|
132
|
+
|
|
133
|
+
```console
|
|
134
|
+
uv pip install "linescope[full] @ git+https://github.com/tvdboom/linescope"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Contributing
|
|
138
|
+
|
|
139
|
+
Install the locked development environment from a checkout:
|
|
140
|
+
|
|
141
|
+
```console
|
|
142
|
+
git clone https://github.com/tvdboom/linescope.git
|
|
143
|
+
cd linescope
|
|
144
|
+
uv sync --locked
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
See the [installation guide] for more setup details and the
|
|
148
|
+
[development guide] for contribution checks.
|
|
149
|
+
|
|
150
|
+
[installation guide]:
|
|
151
|
+
https://tvdboom.github.io/linescope/latest/getting_started/#installation
|
|
152
|
+
[development guide]: https://tvdboom.github.io/linescope/latest/development/
|
|
153
|
+
|
|
154
|
+
## Usage
|
|
155
|
+
|
|
156
|
+
### From the terminal
|
|
157
|
+
|
|
158
|
+
Run your own script under LineScope without changing its source:
|
|
159
|
+
|
|
160
|
+
```console
|
|
161
|
+
linescope --backend trace --output linescope.html your_script.py
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The script runs normally, then LineScope saves `linescope.html` in the current
|
|
165
|
+
directory and opens it in a browser. The report contains your source with
|
|
166
|
+
line-by-line timings and works offline.
|
|
167
|
+
|
|
168
|
+
Place LineScope options before the script path. Arguments after the path go to
|
|
169
|
+
your script. You can also profile an importable module from your project root:
|
|
170
|
+
|
|
171
|
+
```console
|
|
172
|
+
linescope --backend trace --output linescope.html your_script.py --input data.csv
|
|
173
|
+
linescope --backend trace --output linescope.html -m your_package.your_module
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
To save the report without opening a browser:
|
|
177
|
+
|
|
178
|
+
```console
|
|
179
|
+
linescope --backend trace --display none --output linescope.html your_script.py
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### From Python code
|
|
183
|
+
|
|
184
|
+
Wrap the work you want to measure with `profile` in your own script. Here,
|
|
185
|
+
`main()` is your existing entry point; replace it with the calls you want to
|
|
186
|
+
profile:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from linescope import profile
|
|
190
|
+
|
|
191
|
+
with profile(backend="trace", output="linescope.html") as session:
|
|
192
|
+
main()
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Run the script as usual:
|
|
196
|
+
|
|
197
|
+
```console
|
|
198
|
+
python your_script.py
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
When the block exits, profiling stops and the report is saved and opened. For
|
|
202
|
+
headless use, add `display="none"` to `profile(...)` and call
|
|
203
|
+
`session.save("linescope.html")` after the block to write the report.
|
|
204
|
+
|
|
205
|
+
<br>
|
|
206
|
+
|
|
207
|
+
📘 Documentation
|
|
208
|
+
----------------
|
|
209
|
+
|
|
210
|
+
| **Relevant links** | |
|
|
211
|
+
| --- | --- |
|
|
212
|
+
| ⭐ **[About](https://tvdboom.github.io/linescope/latest/about/)** | Learn more about the package. |
|
|
213
|
+
| 🚀 **[Getting started](https://tvdboom.github.io/linescope/latest/getting_started/)** | New to LineScope? Here's how to get you started! |
|
|
214
|
+
| 👨💻 **[User guide](https://tvdboom.github.io/linescope/latest/user_guide/introduction/)** | How to use LineScope and its features. |
|
|
215
|
+
| 📓 **[Notebooks](https://tvdboom.github.io/linescope/latest/user_guide/notebooks/)** | Profile a cell or a whole notebook session. |
|
|
216
|
+
| ⚡ **[Spark](https://tvdboom.github.io/linescope/latest/user_guide/spark/)** | Follow Spark actions, executed plans, and distributed metrics. |
|
|
217
|
+
| 🧱 **[Databricks](https://tvdboom.github.io/linescope/latest/user_guide/notebooks/#databricks)** | Capture workspace source and correlate child notebook runs. |
|
|
218
|
+
| 🎛️ **[API Reference](https://tvdboom.github.io/linescope/latest/api/configuration/config/)** | The detailed reference for LineScope's API. |
|
|
219
|
+
| ⌨️ **[CLI](https://tvdboom.github.io/linescope/latest/cli/linescope/)** | Profile Python scripts and modules from the command line. |
|
|
220
|
+
| ❔ **[FAQ](https://tvdboom.github.io/linescope/latest/faq/)** | Get answers to frequently asked questions. |
|
|
221
|
+
| 🔧 **[Contributing](https://tvdboom.github.io/linescope/latest/development/)** | Read this before creating a PR. |
|
|
222
|
+
| 🌳 **[Dependencies](https://tvdboom.github.io/linescope/latest/dependencies/)** | Which other packages does LineScope depend on? |
|
|
223
|
+
| 📃 **[License](https://tvdboom.github.io/linescope/latest/license/)** | Copyright and permissions under the MIT license. |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# About
|
|
2
|
+
-------
|
|
3
|
+
## What is it?
|
|
4
|
+
LineScope is an open-source source profiler for Python. It puts your code at the
|
|
5
|
+
center of a readable HTML report, with timing heatmaps, function links, notebook
|
|
6
|
+
cells, memory measurements and Spark execution plans. Work inside third-party
|
|
7
|
+
libraries stays attributed to the project line that called them. The goal is
|
|
8
|
+
simple: find the expensive lines, understand what they do, and make your code
|
|
9
|
+
faster. Click [here][getting-started] to get started.
|
|
10
|
+
<br>
|
|
11
|
+
## What can I do with it?
|
|
12
|
+
Profile a script, a package or a notebook, inspect complete source files and
|
|
13
|
+
follow functions into their definitions. Choose a collector for your workload,
|
|
14
|
+
inspect available memory and GPU metrics, and correlate Spark actions with their
|
|
15
|
+
executed plans. Click on the icons to read more about its main functionalities.
|
|
16
|
+
<div class="row">
|
|
17
|
+
<div class="column">
|
|
18
|
+
<div class="icon">
|
|
19
|
+
<a
|
|
20
|
+
href="../user_guide/backends/#performance" draggable="false"><img
|
|
21
|
+
src="../img/icons/performance.svg" alt="Performance"
|
|
22
|
+
draggable="false"><figcaption style="margin-top:
|
|
23
|
+
-8px"><strong>Performance</strong></figcaption></a></div></div> <div
|
|
24
|
+
class="column"><div class="icon"><a href="../user_guide/reports/"
|
|
25
|
+
draggable="false"><img src="../img/icons/reports.svg" alt="HTML reports"
|
|
26
|
+
draggable="false"><figcaption style="margin-top: -8px"><strong>HTML
|
|
27
|
+
reports</strong></figcaption></a></div></div> <div class="column"><div
|
|
28
|
+
class="icon"><a href="../user_guide/notebooks/" draggable="false"><img
|
|
29
|
+
src="../img/icons/notebooks.svg" alt="Notebooks" draggable="false"><figcaption
|
|
30
|
+
style="margin-top: -8px"><strong>Notebooks</strong></figcaption></a></div></div>
|
|
31
|
+
<div class="column"><div class="icon"><a href="../user_guide/spark/"
|
|
32
|
+
draggable="false"><img src="../img/icons/spark.svg" alt="Spark"
|
|
33
|
+
draggable="false"><figcaption style="margin-top:
|
|
34
|
+
-8px"><strong>Spark</strong></figcaption></a></div></div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="row">
|
|
37
|
+
<div class="column"><div class="icon"><a href="../user_guide/gpu/"
|
|
38
|
+
draggable="false"><img src="../img/icons/gpu.svg" alt="GPU"
|
|
39
|
+
draggable="false"><figcaption style="margin-top:
|
|
40
|
+
-8px"><strong>GPU</strong></figcaption></a></div></div> <div class="column"><div
|
|
41
|
+
class="icon"><a href="../user_guide/backends/#memory" draggable="false"><img
|
|
42
|
+
src="../img/icons/memory.svg" alt="Memory" draggable="false"><figcaption
|
|
43
|
+
style="margin-top: -8px"><strong>Memory</strong></figcaption></a></div></div>
|
|
44
|
+
<div class="column">
|
|
45
|
+
<div class="icon">
|
|
46
|
+
<a
|
|
47
|
+
href="../user_guide/reports/#source-navigation" draggable="false"><img
|
|
48
|
+
src="../img/icons/navigation.svg" alt="Source navigation"
|
|
49
|
+
draggable="false"><figcaption style="margin-top: -8px"><strong>Source
|
|
50
|
+
navigation</strong></figcaption></a></div></div> <div class="column"><div
|
|
51
|
+
class="icon"><a href="../user_guide/backends/" draggable="false"><img
|
|
52
|
+
src="../img/icons/backends.svg" alt="Backends" draggable="false"><figcaption
|
|
53
|
+
style="margin-top: -8px"><strong>Backends</strong></figcaption></a></div></div>
|
|
54
|
+
</div>
|
|
55
|
+
## Who is it intended for?
|
|
56
|
+
* **Everyday Python users** who want to quickly find bottlenecks and make their
|
|
57
|
+
scripts faster without learning a complex profiling toolchain.
|
|
58
|
+
* **Notebook users and data scientists** who want to understand where a cell or
|
|
59
|
+
an entire analysis spends its time.
|
|
60
|
+
* **Data engineers** who want to connect Python driver code to Spark actions,
|
|
61
|
+
query plans and the executor metrics their environment makes available.
|
|
62
|
+
* **Learners and educators** who want clear, visual feedback about algorithms,
|
|
63
|
+
library calls and memory use. LineScope focuses on practical insights and
|
|
64
|
+
meaningful improvements. Its timings are not a substitute for dedicated
|
|
65
|
+
microbenchmarks when tuning differences of milliseconds down to nanoseconds.
|
|
66
|
+
<br>
|
|
67
|
+
## Support
|
|
68
|
+
LineScope recognizes the support from [JetBrains](https://www.jetbrains.com) by
|
|
69
|
+
providing core project contributors with a set of developer tools free of
|
|
70
|
+
charge.
|
|
71
|
+
<div class="support-logos">
|
|
72
|
+
<a href="https://www.jetbrains.com/community/opensource/#support"><img
|
|
73
|
+
src="../img/support/jetbrains.png" alt="JetBrains"></a> <a
|
|
74
|
+
href="https://www.jetbrains.com/pycharm/"><img src="../img/support/pycharm.png"
|
|
75
|
+
alt="PyCharm"></a>
|
|
76
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ProfilerBackend
|
|
2
|
+
-----------------
|
|
3
|
+
|
|
4
|
+
Implement this protocol when registering a custom collector through
|
|
5
|
+
[register_backend]. Select built-in collectors with `profile(backend=...)`.
|
|
6
|
+
|
|
7
|
+
:: linescope.backends:ProfilerBackend
|
|
8
|
+
:: signature
|
|
9
|
+
:: head
|
|
10
|
+
:: table:
|
|
11
|
+
- attributes
|
|
12
|
+
:: see also
|
|
13
|
+
|
|
14
|
+
<br>
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
:: examples
|
|
19
|
+
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
## Methods
|
|
23
|
+
|
|
24
|
+
:: methods:
|
|
25
|
+
include: [start, stop, result]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# RawBackendResult
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
Return this record from [ProfilerBackend.result][profilerbackend-result] with
|
|
5
|
+
raw line measurements, elapsed driver time, and collection diagnostics.
|
|
6
|
+
|
|
7
|
+
:: linescope.backends:RawBackendResult
|
|
8
|
+
:: signature
|
|
9
|
+
:: head
|
|
10
|
+
:: table:
|
|
11
|
+
- attributes
|
|
12
|
+
:: see also
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# RawLine
|
|
2
|
+
---------
|
|
3
|
+
|
|
4
|
+
Include these records in [RawBackendResult] to report a collector's measurements
|
|
5
|
+
for individual source lines. Unsupported metrics remain `None`.
|
|
6
|
+
|
|
7
|
+
:: linescope.backends:RawLine
|
|
8
|
+
:: signature
|
|
9
|
+
:: head
|
|
10
|
+
:: table:
|
|
11
|
+
- attributes
|
|
12
|
+
:: see also
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# register_backend
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
:: linescope:register_backend
|
|
5
|
+
:: signature
|
|
6
|
+
:: head
|
|
7
|
+
:: table:
|
|
8
|
+
- parameters
|
|
9
|
+
- returns
|
|
10
|
+
:: see also
|
|
11
|
+
|
|
12
|
+
Implement [ProfilerBackend] to register a custom collector. Its result uses
|
|
13
|
+
[RawBackendResult] and [RawLine] records before LineScope normalizes
|
|
14
|
+
measurements for reporting.
|