Commit 25c9d89
Align stubs with documented/declared public API surface
Judgement calls, per the principle: will people want to import these
symbols in their code that uses the profiling API?
profiling.tracing
-----------------
- Remove Profile.snapshot_stats(): not in __all__, not in docs. It is
an internal implementation step called by create_stats(); users call
create_stats() directly.
- Remove module-level main(): not in __all__, not in docs. It is the
CLI entry point wired up by the (already-deleted) __main__.py stub.
- Keep dump_stats, runcall, create_stats, print_stats: all explicitly
documented in the profiling.tracing module reference.
- Keep private _T, _P, _Label aliases: needed internally by the stub
to express the runcall() overload and stats dict type.
profiling.sampling — collector submodule stubs
-----------------------------------------------
- Remove normalize_location, extract_lineno, filter_internal_frames
from collector.pyi: implementation helpers used inside collector
subclasses; not in sampling.__all__, not documented. Users subclass
Collector with collect() and export() only.
- Remove DEFAULT_LOCATION and THREAD_STATUS_* re-exports from
collector.pyi: leaked from constants.py; import from
profiling.sampling.constants if needed.
- Remove get_opcode_mapping from opcode_utils.pyi: internal mapping
used to build opcode-name look-up tables; not documented, never
imported by user code.
- Remove re-exports of filter_internal_frames, format_opcode,
get_opcode_info from gecko_collector.pyi: imported for internal
use, not part of GeckoCollector's public contract.
- Strip GeckoCollector internal tracking attributes (has_gil_start,
no_gil_start, on_cpu_start, etc.): 20+ state dicts tracking
GIL/CPU marker transitions; purely implementation detail. Users
call __init__ → collect → export.
- Remove FileStats, TreeNode, get_python_path_info,
extract_module_name from heatmap_collector.pyi: internal data
structures and path helpers for the HTML generation pipeline; not
in sampling.__all__, not documented.
- Strip HeatmapCollector internal state counters (line_samples,
file_samples, call_graph, etc.): implementation detail of the
line-level sample accumulation.
- Remove re-exports of extract_lineno, normalize_location,
format_opcode, get_opcode_info from heatmap_collector.pyi: same
pattern — imported for internal use only.
- Remove re-exports of extract_lineno, get_opcode_mapping,
StringTable from stack_collector.pyi.
- Strip CollapsedStackCollector.stack_counter and
FlamegraphCollector internal state (thread_status_counts,
per_thread_stats, etc.): sample accumulation internals.
- Strip DiffFlamegraphCollector.baseline_binary_path attribute:
constructor parameter, not a user-facing attribute.
- Remove extract_lineno, MICROSECONDS_PER_SECOND, PROFILING_MODE_CPU
re-exports from pstats_collector.pyi.
- Strip PstatsCollector internal state (result, stats, callers,
skip_idle attributes): implementation detail of sample aggregation.
- Remove GeckoCollector, PstatsCollector, CollapsedStackCollector,
FlamegraphCollector re-exports from binary_reader.pyi: imported
internally by binary_reader.py, not part of BinaryReader's API.
profiling.sampling — sample and cli modules
-------------------------------------------
- Strip sample.pyi of all re-exports (BinaryCollector, Collector,
all five PROFILING_MODE_* constants, GeckoCollector,
HeatmapCollector, LiveStatsCollector, PstatsCollector,
CollapsedStackCollector, FlamegraphCollector): sample.py imports
these for internal use; they are not part of sample's public
interface and are already accessible from their own modules.
- Remove unwinder: Incomplete from SampleProfiler: internal C
extension handle, not user-accessible.
- Strip cli.pyi to main() only: cli.py is the CLI implementation;
all the symbols it re-exported (ChildProcessMonitor, BinaryCollector,
BinaryReader, 6 SORT_MODE constants) belong to their own modules.
- Delete _child_monitor.pyi: private module (_-prefixed); previously
kept because cli.pyi re-exported ChildProcessMonitor, but now that
cli.pyi is stripped there is no public re-export, and users have
no reason to import from profiling.sampling._child_monitor directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 36e4dde commit 25c9d89
File tree
11 files changed
+3
-150
lines changed- stdlib/profiling
- sampling
- tracing
11 files changed
+3
-150
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 8 | | |
12 | 9 | | |
13 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 1 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 6 | | |
20 | 7 | | |
21 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 6 | | |
31 | 7 | | |
32 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | 2 | | |
5 | 3 | | |
6 | | - | |
7 | | - | |
8 | 4 | | |
9 | 5 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 6 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 7 | | |
48 | 8 | | |
49 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 7 | | |
14 | 8 | | |
15 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | | - | |
5 | 3 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 4 | | |
19 | 5 | | |
20 | 6 | | |
| |||
23 | 9 | | |
24 | 10 | | |
25 | 11 | | |
26 | | - | |
27 | 12 | | |
28 | 13 | | |
29 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
9 | 6 | | |
10 | 7 | | |
11 | 8 | | |
| |||
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 20 | | |
29 | 21 | | |
30 | 22 | | |
| |||
40 | 32 | | |
41 | 33 | | |
42 | 34 | | |
43 | | - | |
44 | 35 | | |
0 commit comments