Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions perun/cli_groups/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"""Collection of CLI groups that are not part of the standalone commands"""

import lazy_loader as lazy

__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
59 changes: 59 additions & 0 deletions perun/cli_groups/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from . import check_cli as check_cli
from . import collect_cli as collect_cli
from . import config_cli as config_cli
from . import import_cli as import_cli
from . import run_cli as run_cli
from . import shared_options as shared_options
from . import showdiff_cli as showdiff_cli
from . import utils_cli as utils_cli

from .check_cli import (
check_group as check_group,
check_head as check_head,
check_all as check_all,
check_profiles as check_profiles,
)

from .collect_cli import collect as collect

from .config_cli import (
config as config,
config_get as config_get,
config_set as config_set,
config_edit as config_edit,
config_reset as config_reset,
)

from .import_cli import (
import_group as import_group,
perf_group as perf_group,
from_binary as from_binary,
from_text as from_text,
from_stacks as from_stacks,
elk_group as elk_group,
from_json as from_json,
)

from .run_cli import (
run as run,
matrix as matrix,
job as job,
)

from .shared_options import (
flamegraph_cli_options as flamegraph_cli_options,
profile_postprocess_cli_options as profile_postprocess_cli_options,
profile_aggregation_cli_option as profile_aggregation_cli_options,
)

from .showdiff_cli import (
perun_profile_list_options as perun_profile_list_options,
common_html_options as common_html_options,
flamegraph_diff_cli_options as flamegraph_diff_cli_options,
showdiff_group as showdiff_group,
short_diff as short_diff,
flamegraph_diff as flamegraph_diff,
report_group as report_group,
report_native as report_native,
report_folded as report_folded,
)
11 changes: 5 additions & 6 deletions perun/cli_groups/import_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

# Perun Imports
from perun.logic import commands, config
from perun.profiles import native as profile
from perun.profiles.conversions import perf_native, elk_native
from perun.profiles import native as profile, conversions
from perun.utils.common import cli_kit


Expand Down Expand Up @@ -187,7 +186,7 @@ def from_binary(ctx: click.Context, import_entries: list[str], **kwargs: Any) ->
that combines the --stats-headers option and profile entries.
"""
kwargs.update(ctx.obj)
perf_native.import_perf_from_record(import_entries, **kwargs)
conversions.perf_native.import_perf_from_record(import_entries, **kwargs)


@perf_group.command("script")
Expand All @@ -214,7 +213,7 @@ def from_text(ctx: click.Context, import_entries: list[str], **kwargs: Any) -> N
that combines the --stats-headers option and profile entries.
"""
kwargs.update(ctx.obj)
perf_native.import_perf_from_script(import_entries, **kwargs)
conversions.perf_native.import_perf_from_script(import_entries, **kwargs)


@perf_group.command("stack")
Expand Down Expand Up @@ -242,7 +241,7 @@ def from_stacks(ctx: click.Context, import_entries: list[str], **kwargs: Any) ->
that combines the --stats-headers option and profile entries.
"""
kwargs.update(ctx.obj)
perf_native.import_perf_from_stack(import_entries, **kwargs)
conversions.perf_native.import_perf_from_stack(import_entries, **kwargs)


@import_group.group("elk")
Expand Down Expand Up @@ -272,4 +271,4 @@ def from_json(ctx: click.Context, import_entries: list[str], **kwargs: Any) -> N
Each import entry may specify a JSON path 'file_path.json'.
"""
kwargs.update(ctx.obj)
elk_native.import_elk_from_json(import_entries, **kwargs)
conversions.elk_native.import_elk_from_json(import_entries, **kwargs)
1 change: 1 addition & 0 deletions perun/cli_groups/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ perun_cli_groups_dir = perun_dir / 'cli_groups'

perun_cli_groups_files = files(
'__init__.py',
'__init__.pyi',
'check_cli.py',
'collect_cli.py',
'config_cli.py',
Expand Down
12 changes: 6 additions & 6 deletions perun/cli_groups/showdiff_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
DEFAULT_TRACE_THRESHOLD,
HeaderDisplayStyle,
)
from perun.view_diff import flamegraph, short
from perun.view_diff.report import native, folded
from perun import view_diff
from perun.view_diff import report

if TYPE_CHECKING:
from perun.profiles.native import Profile
Expand Down Expand Up @@ -178,7 +178,7 @@ def short_diff(profile_list: tuple[Profile, Profile], *_: Any, **kwargs: Any) ->

Supports only perun-native profiles.
"""
short.compare_profiles(*profile_list, **kwargs)
view_diff.short.compare_profiles(*profile_list, **kwargs)


@showdiff_group.command("flamegraph")
Expand Down Expand Up @@ -221,7 +221,7 @@ def flamegraph_diff(profile_list: tuple[Profile, Profile], *_: Any, **kwargs: An

Supports only perun-native profiles.
"""
flamegraph.generate_flamegraph_difference(*profile_list, **kwargs)
view_diff.flamegraph.generate_flamegraph_difference(*profile_list, **kwargs)


@showdiff_group.group("report")
Expand Down Expand Up @@ -327,7 +327,7 @@ def report_native(
perun showdiff report native -m HEAD~1 0@i 1@i
"""
kwargs.update(ctx.obj)
native.generate_report_from_native_profiles(*profile_list, **kwargs)
report.native.generate_report_from_native_profiles(*profile_list, **kwargs)


@report_group.command("folded")
Expand Down Expand Up @@ -507,4 +507,4 @@ def report_folded(ctx: click.Context, baseline: str, target: str, **kwargs: Any)

"""
kwargs.update(ctx.obj)
folded.generate_report_from_folded_profiles(baseline, target, **kwargs)
report.folded.generate_report_from_folded_profiles(baseline, target, **kwargs)
6 changes: 6 additions & 0 deletions perun/fuzz/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from . import filesystem as filesystem
from . import filetype as filetype
from . import helpers as helpers
from . import interpret as interpret
from . import randomizer as randomizer

from .factory import run_fuzzing_for_command as run_fuzzing_for_command
10 changes: 10 additions & 0 deletions perun/profiles/conversions/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from . import (
elk_native as elk_native,
folded_polars as folded_polars,
native_folded as native_folded,
native_pandas as native_pandas,
native_polars as native_polars,
perf_native as perf_native,
polars_folded as polars_folded,
)

from .elk_native import import_elk_from_json as import_elk_from_json

from .folded_polars import (
Expand Down
3 changes: 3 additions & 0 deletions perun/profiles/folded/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from . import parser as parser
from . import postprocess as postprocess

from .parser import (
parse_resources_from_stream as parse_resources_from_stream,
parse_events_from_stream as parse_events_from_stream,
Expand Down
4 changes: 4 additions & 0 deletions perun/profiles/native/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from . import factory as factory
from . import helpers as helpers
from . import query as query

from .factory import (
Profile as Profile,
pass_profile as pass_profile,
Expand Down
4 changes: 4 additions & 0 deletions perun/profiles/polars/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from . import convert as convert
from . import parser as parser
from . import structs as structs

from .convert import (
create_polars_pair_profile as create_polars_pair_profile,
merge_and_filter_polars_profiles as merge_and_filter_polars_profiles,
Expand Down
6 changes: 4 additions & 2 deletions perun/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import traceback

# Third-Party Imports
import numpy as np
import progressbar
import termcolor

# Perun Imports
Expand Down Expand Up @@ -713,6 +711,8 @@ def aggregate_intervals(
:return: list of the aggregated partial intervals to print
"""
# Fixme: This is baaaad. But the partial intervals are somewhat broken (sometimes list, sometimes narray)
import numpy as np

intervals = np.array(input_intervals) if isinstance(input_intervals, list) else input_intervals

def get_indices_of_intervals() -> Iterable[tuple[int, int]]:
Expand Down Expand Up @@ -867,6 +867,8 @@ def progress(collection: Iterable[T], description: str = "") -> Iterable[T]:
:param collection: any iterable
:param description: tag on the left side of the output of the bar
"""
import progressbar

widgets: list[progressbar.widgets.WidgetBase | str] = [
(description + ": ") if description else "",
progressbar.Percentage(),
Expand Down
4 changes: 4 additions & 0 deletions perun/view/flamegraph/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from . import core as core
from . import grid as grid
from . import run as run

from .core import (
generate_flamegraph as generate_flamegraph,
generate_title as generate_title,
Expand Down
Loading
Loading