apps.bazel_parser.repo_graph_data

Contain the core data-classes for analyzing repo’s and their composition.

Attributes

Classes

Node

The fields of a given node.

GraphMetrics

Graph-wide metrics.

RepoGraphData

Functions

dependency_analysis(→ dict[str, Node])

Update repo based on a dependency analysis.

Module Contents

apps.bazel_parser.repo_graph_data.logger[source]
class apps.bazel_parser.repo_graph_data.Node[source]

Bases: TypedDict

The fields of a given node.

These can be used as columns of panda dataframes

node_name: str[source]
node_class: str[source]
num_parents: int[source]
num_ancestors: int[source]
num_duration_ancestors: int[source]
has_duration: bool[source]
num_children: int[source]
num_descendants: int[source]
num_source_descendants: int[source]
is_source: bool[source]
pagerank: float[source]
hubs_metric: float[source]
authorities_metric: float[source]
node_duration_s: float[source]
node_probability_cache_hit: float[source]
group_duration_s: float[source]
group_probability_cache_hit: float[source]
expected_duration_s: float[source]
ancestor_depth: int[source]
descendant_depth: int[source]
ancestors_by_node_p: float[source]
ancestors_by_group_p: float[source]
ancestors_by_descendants: int[source]
betweenness_centrality: float[source]
closeness_centrality: float[source]
class apps.bazel_parser.repo_graph_data.GraphMetrics[source]

Bases: TypedDict

Graph-wide metrics.

longest_path: int[source]
max_depth: int[source]
num_nodes: int[source]
num_edges: int[source]
density: float[source]
num_connected_components: int[source]
total_duration_s: float[source]
expected_duration_s: float[source]
avg_files_changed_per_commit: float[source]
avg_nodes_affected_per_commit: float[source]
class apps.bazel_parser.repo_graph_data.RepoGraphData(graph: networkx.DiGraph, node_to_class: dict[str, str], node_probability: dict[str, float], node_duration_s: dict[str, float])[source]
Parameters:
  • graph (networkx.DiGraph)

  • node_to_class (dict[str, str])

  • node_probability (dict[str, float])

  • node_duration_s (dict[str, float])

graph: networkx.DiGraph[source]
df: pandas.DataFrame[source]
refresh() None[source]

Update .df based on updates to graph, etc.

Return type:

None

get_node(node: str) Node[source]
Parameters:

node (str)

Return type:

Node

get_graph_metrics() GraphMetrics[source]
Return type:

GraphMetrics

to_gml(out_gml: pathlib.Path) None[source]
Parameters:

out_gml (pathlib.Path)

Return type:

None

to_csv(out_csv: pathlib.Path) None[source]
Parameters:

out_csv (pathlib.Path)

Return type:

None

apps.bazel_parser.repo_graph_data.dependency_analysis(repo: RepoGraphData) dict[str, Node][source]

Update repo based on a dependency analysis.

Parameters:

repo (RepoGraphData)

Return type:

dict[str, Node]