Skip to content

tenets.viz Package

Visualization system for Tenets.

This package provides various visualization capabilities for understanding codebases including dependency graphs, complexity heatmaps, coupling analysis, and contributor patterns.

Main components: - DependencyGraph: Visualize import dependencies - ComplexityHeatmap: Show code complexity patterns - CouplingGraph: Identify files that change together - ContributorGraph: Analyze team dynamics

Example usage

from tenets.viz import create_dependency_graph, visualize_complexity

Create dependency graph

graph = create_dependency_graph(files, format="html") graph.render("dependencies.html")

Show complexity heatmap

heatmap = visualize_complexity(files, threshold=10) print(heatmap.render()) # ASCII output

Attributes

MATPLOTLIB_AVAILABLEmodule-attribute

Python
MATPLOTLIB_AVAILABLE = False

NETWORKX_AVAILABLEmodule-attribute

Python
NETWORKX_AVAILABLE = False

PLOTLY_AVAILABLEmodule-attribute

Python
PLOTLY_AVAILABLE = False

Classes

BaseVisualizer

Python
BaseVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Base class for all visualizers.

Provides common functionality for creating visualizations including chart generation, color management, and data formatting.

ATTRIBUTEDESCRIPTION
logger

Logger instance

chart_config

Default chart configuration

display_config

Default display configuration

color_palette

Color palette to use

Initialize base visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

loggerinstance-attribute
Python
logger = get_logger(__name__)
chart_configinstance-attribute
Python
chart_config = chart_config or ChartConfig(type=BAR)
display_configinstance-attribute
Python
display_config = display_config or DisplayConfig()
color_paletteinstance-attribute
Python
color_palette = get_palette('default')

Functions

create_chart
Python
create_chart(chart_type: ChartType, data: Dict[str, Any], config: Optional[ChartConfig] = None) -> Dict[str, Any]

Create a chart configuration.

PARAMETERDESCRIPTION
chart_type

Type of chart

TYPE:ChartType

data

Chart data

TYPE:Dict[str, Any]

config

Optional chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Chart configuration for rendering

format_number
Python
format_number(value: Union[int, float], precision: int = 2, use_thousands: bool = True) -> str

Format a number for display.

PARAMETERDESCRIPTION
value

Number to format

TYPE:Union[int, float]

precision

Decimal precision

TYPE:intDEFAULT:2

use_thousands

Use thousands separator

TYPE:boolDEFAULT:True

RETURNSDESCRIPTION
str

Formatted number

TYPE:str

format_percentage
Python
format_percentage(value: float, precision: int = 1, include_sign: bool = False) -> str

Format a value as percentage.

PARAMETERDESCRIPTION
value

Value (0-1 or 0-100 depending on context)

TYPE:float

precision

Decimal precision

TYPE:intDEFAULT:1

include_sign

Include + sign for positive values

TYPE:boolDEFAULT:False

RETURNSDESCRIPTION
str

Formatted percentage

TYPE:str

export_chart
Python
export_chart(chart_config: Dict[str, Any], output_path: Path, format: str = 'json') -> Path

Export chart configuration to file.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Dict[str, Any]

output_path

Output file path

TYPE:Path

format

Export format (json, html, etc.)

TYPE:strDEFAULT:'json'

RETURNSDESCRIPTION
Path

Path to exported file

TYPE:Path

ChartConfigdataclass

Python
ChartConfig(type: ChartType, title: str = '', width: int = 800, height: int = 400, colors: Optional[List[str]] = None, theme: str = 'light', interactive: bool = True, show_legend: bool = True, show_grid: bool = True, animation: bool = True, responsive: bool = True, export_options: List[str] = (lambda: ['png', 'svg'])())

Configuration for chart generation.

ATTRIBUTEDESCRIPTION
type

Type of chart to generate

TYPE:ChartType

title

Chart title

TYPE:str

width

Chart width in pixels

TYPE:int

height

Chart height in pixels

TYPE:int

colors

Custom color palette

TYPE:Optional[List[str]]

theme

Visual theme (light, dark, etc.)

TYPE:str

interactive

Whether chart should be interactive

TYPE:bool

show_legend

Whether to show legend

TYPE:bool

show_grid

Whether to show grid lines

TYPE:bool

animation

Whether to animate chart

TYPE:bool

responsive

Whether chart should be responsive

TYPE:bool

export_options

Export format options

TYPE:List[str]

Attributes

typeinstance-attribute
Python
type: ChartType
titleclass-attributeinstance-attribute
Python
title: str = ''
widthclass-attributeinstance-attribute
Python
width: int = 800
heightclass-attributeinstance-attribute
Python
height: int = 400
colorsclass-attributeinstance-attribute
Python
colors: Optional[List[str]] = None
themeclass-attributeinstance-attribute
Python
theme: str = 'light'
interactiveclass-attributeinstance-attribute
Python
interactive: bool = True
show_legendclass-attributeinstance-attribute
Python
show_legend: bool = True
show_gridclass-attributeinstance-attribute
Python
show_grid: bool = True
animationclass-attributeinstance-attribute
Python
animation: bool = True
responsiveclass-attributeinstance-attribute
Python
responsive: bool = True
export_optionsclass-attributeinstance-attribute
Python
export_options: List[str] = field(default_factory=lambda: ['png', 'svg'])

ChartType

Bases: Enum

Supported chart types.

Attributes

BARclass-attributeinstance-attribute
Python
BAR = 'bar'
LINEclass-attributeinstance-attribute
Python
LINE = 'line'
PIEclass-attributeinstance-attribute
Python
PIE = 'pie'
SCATTERclass-attributeinstance-attribute
Python
SCATTER = 'scatter'
RADARclass-attributeinstance-attribute
Python
RADAR = 'radar'
GAUGEclass-attributeinstance-attribute
Python
GAUGE = 'gauge'
HEATMAPclass-attributeinstance-attribute
Python
HEATMAP = 'heatmap'
TREEMAPclass-attributeinstance-attribute
Python
TREEMAP = 'treemap'
NETWORKclass-attributeinstance-attribute
Python
NETWORK = 'network'
BUBBLEclass-attributeinstance-attribute
Python
BUBBLE = 'bubble'
STACKED_BARclass-attributeinstance-attribute
Python
STACKED_BAR = 'stacked_bar'
HORIZONTAL_BARclass-attributeinstance-attribute
Python
HORIZONTAL_BAR = 'horizontal_bar'
DONUTclass-attributeinstance-attribute
Python
DONUT = 'donut'
AREAclass-attributeinstance-attribute
Python
AREA = 'area'
TIMELINEclass-attributeinstance-attribute
Python
TIMELINE = 'timeline'

ColorPalette

Color palette management for visualizations.

Provides consistent color schemes across all visualizations with support for different themes and accessibility considerations.

Attributes

DEFAULTclass-attributeinstance-attribute
Python
DEFAULT = ['#2563eb', '#8b5cf6', '#10b981', '#f59e0b', '#ef4444', '#06b6d4', '#ec4899', '#84cc16', '#f97316', '#6366f1']
SEVERITYclass-attributeinstance-attribute
Python
SEVERITY = {'critical': '#dc2626', 'high': '#ea580c', 'medium': '#ca8a04', 'low': '#16a34a', 'info': '#0891b2'}
HEALTHclass-attributeinstance-attribute
Python
HEALTH = {'excellent': '#10b981', 'good': '#84cc16', 'fair': '#f59e0b', 'poor': '#f97316', 'critical': '#ef4444'}
MONOCHROMEclass-attributeinstance-attribute
Python
MONOCHROME = ['#1e293b', '#334155', '#475569', '#64748b', '#94a3b8', '#cbd5e1', '#e2e8f0', '#f1f5f9']

Functions

get_paletteclassmethod
Python
get_palette(name: str = 'default') -> List[str]

Get a color palette by name.

PARAMETERDESCRIPTION
name

Palette name (default, monochrome, etc.)

TYPE:strDEFAULT:'default'

RETURNSDESCRIPTION
List[str]

List[str]: List of color hex codes

get_colorclassmethod
Python
get_color(value: Any, category: str = 'default') -> str

Get a color for a specific value.

PARAMETERDESCRIPTION
value

Value to get color for

TYPE:Any

category

Category (severity, health, etc.)

TYPE:strDEFAULT:'default'

RETURNSDESCRIPTION
str

Color hex code

TYPE:str

interpolate_colorclassmethod
Python
interpolate_color(value: float, min_val: float = 0, max_val: float = 100, start_color: str = '#10b981', end_color: str = '#ef4444') -> str

Interpolate color based on value.

PARAMETERDESCRIPTION
value

Value to interpolate

TYPE:float

min_val

Minimum value

TYPE:floatDEFAULT:0

max_val

Maximum value

TYPE:floatDEFAULT:100

start_color

Color for minimum value

TYPE:strDEFAULT:'#10b981'

end_color

Color for maximum value

TYPE:strDEFAULT:'#ef4444'

RETURNSDESCRIPTION
str

Interpolated color hex code

TYPE:str

DisplayConfigdataclass

Python
DisplayConfig(use_colors: bool = True, use_unicode: bool = True, max_width: int = 120, max_rows: int = 50, truncate: bool = True, show_progress: bool = True, style: str = 'detailed')

Configuration for terminal display.

ATTRIBUTEDESCRIPTION
use_colors

Whether to use colors in terminal

TYPE:bool

use_unicode

Whether to use unicode characters

TYPE:bool

max_width

Maximum display width

TYPE:int

max_rows

Maximum rows to display

TYPE:int

truncate

Whether to truncate long text

TYPE:bool

show_progress

Whether to show progress indicators

TYPE:bool

style

Display style (compact, detailed, etc.)

TYPE:str

Attributes

use_colorsclass-attributeinstance-attribute
Python
use_colors: bool = True
use_unicodeclass-attributeinstance-attribute
Python
use_unicode: bool = True
max_widthclass-attributeinstance-attribute
Python
max_width: int = 120
max_rowsclass-attributeinstance-attribute
Python
max_rows: int = 50
truncateclass-attributeinstance-attribute
Python
truncate: bool = True
show_progressclass-attributeinstance-attribute
Python
show_progress: bool = True
styleclass-attributeinstance-attribute
Python
style: str = 'detailed'

DisplayFormat

Bases: Enum

Supported display formats.

Attributes

TERMINALclass-attributeinstance-attribute
Python
TERMINAL = 'terminal'
HTMLclass-attributeinstance-attribute
Python
HTML = 'html'
JSONclass-attributeinstance-attribute
Python
JSON = 'json'
MARKDOWNclass-attributeinstance-attribute
Python
MARKDOWN = 'markdown'
SVGclass-attributeinstance-attribute
Python
SVG = 'svg'
PNGclass-attributeinstance-attribute
Python
PNG = 'png'

ComplexityVisualizer

Python
ComplexityVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for complexity metrics.

Creates visualizations for complexity analysis results including distribution charts, heatmaps, and trend analysis.

Initialize complexity visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_distribution_chart
Python
create_distribution_chart(complexity_data: Dict[str, Any], chart_type: ChartType = ChartType.BAR) -> Dict[str, Any]

Create complexity distribution chart.

PARAMETERDESCRIPTION
complexity_data

Complexity analysis data

TYPE:Dict[str, Any]

chart_type

Type of chart to create

TYPE:ChartTypeDEFAULT:BAR

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Chart configuration

create_top_complex_chart
Python
create_top_complex_chart(complex_items: List[Dict[str, Any]], limit: int = 10) -> Dict[str, Any]

Create chart of top complex items.

PARAMETERDESCRIPTION
complex_items

List of complex items with name and complexity

TYPE:List[Dict[str, Any]]

limit

Maximum items to show

TYPE:intDEFAULT:10

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Chart configuration

create_complexity_heatmap
Python
create_complexity_heatmap(file_complexities: Dict[str, List[int]], max_functions: int = 50) -> Dict[str, Any]

Create complexity heatmap for files.

PARAMETERDESCRIPTION
file_complexities

Dictionary of file paths to complexity values

TYPE:Dict[str, List[int]]

max_functions

Maximum functions per file to show

TYPE:intDEFAULT:50

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Heatmap configuration

create_trend_chart
Python
create_trend_chart(trend_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create complexity trend chart over time.

PARAMETERDESCRIPTION
trend_data

List of data points with date and metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_comparison_chart
Python
create_comparison_chart(current_data: Dict[str, Any], baseline_data: Dict[str, Any]) -> Dict[str, Any]

Create comparison chart between current and baseline.

PARAMETERDESCRIPTION
current_data

Current complexity metrics

TYPE:Dict[str, Any]

baseline_data

Baseline complexity metrics

TYPE:Dict[str, Any]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Grouped bar chart configuration

display_terminal
Python
display_terminal(complexity_data: Dict[str, Any], show_details: bool = True) -> None

Display complexity analysis in terminal.

PARAMETERDESCRIPTION
complexity_data

Complexity analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

create_radar_chart
Python
create_radar_chart(metrics: Dict[str, float]) -> Dict[str, Any]

Create radar chart for complexity metrics.

PARAMETERDESCRIPTION
metrics

Dictionary of metric names to values

TYPE:Dict[str, float]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Radar chart configuration

ContributorVisualizer

Python
ContributorVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for contributor metrics.

Creates visualizations for contributor analysis including activity charts, collaboration networks, and contribution distributions.

Initialize contributor visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_contribution_chart
Python
create_contribution_chart(contributors: List[Dict[str, Any]], metric: str = 'commits', limit: int = 10) -> Dict[str, Any]

Create contributor contribution chart.

PARAMETERDESCRIPTION
contributors

List of contributor data

TYPE:List[Dict[str, Any]]

metric

Metric to visualize (commits, lines, files)

TYPE:strDEFAULT:'commits'

limit

Maximum contributors to show

TYPE:intDEFAULT:10

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Chart configuration

create_activity_timeline
Python
create_activity_timeline(activity_data: List[Dict[str, Any]], contributor: Optional[str] = None) -> Dict[str, Any]

Create contributor activity timeline.

PARAMETERDESCRIPTION
activity_data

Activity data points with dates

TYPE:List[Dict[str, Any]]

contributor

Specific contributor to highlight

TYPE:Optional[str]DEFAULT:None

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_collaboration_network
Python
create_collaboration_network(collaboration_data: Dict[Tuple[str, str], int], min_weight: int = 2) -> Dict[str, Any]

Create collaboration network graph.

PARAMETERDESCRIPTION
collaboration_data

Dictionary of (contributor1, contributor2) -> weight

TYPE:Dict[Tuple[str, str], int]

min_weight

Minimum collaboration weight to include

TYPE:intDEFAULT:2

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Network graph configuration

create_distribution_pie
Python
create_distribution_pie(contributors: List[Dict[str, Any]], metric: str = 'commits', top_n: int = 5) -> Dict[str, Any]

Create contribution distribution pie chart.

PARAMETERDESCRIPTION
contributors

List of contributor data

TYPE:List[Dict[str, Any]]

metric

Metric to visualize

TYPE:strDEFAULT:'commits'

top_n

Number of top contributors to show individually

TYPE:intDEFAULT:5

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Pie chart configuration

create_bus_factor_gauge
Python
create_bus_factor_gauge(bus_factor: int, total_contributors: int) -> Dict[str, Any]

Create bus factor gauge chart.

PARAMETERDESCRIPTION
bus_factor

Current bus factor

TYPE:int

total_contributors

Total number of contributors

TYPE:int

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Gauge chart configuration

display_terminal
Python
display_terminal(contributor_data: Dict[str, Any], show_details: bool = True) -> None

Display contributor analysis in terminal.

PARAMETERDESCRIPTION
contributor_data

Contributor analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

create_retention_chart
Python
create_retention_chart(retention_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create contributor retention chart.

PARAMETERDESCRIPTION
retention_data

Retention data over time

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

CouplingVisualizer

Python
CouplingVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for coupling metrics.

Creates visualizations for coupling analysis including dependency graphs, coupling matrices, and stability charts.

Initialize coupling visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_coupling_network
Python
create_coupling_network(coupling_data: Dict[str, Dict[str, int]], min_coupling: int = 1, max_nodes: int = 50) -> Dict[str, Any]

Create coupling network graph.

PARAMETERDESCRIPTION
coupling_data

Dictionary of module -> {coupled_module: strength}

TYPE:Dict[str, Dict[str, int]]

min_coupling

Minimum coupling strength to show

TYPE:intDEFAULT:1

max_nodes

Maximum nodes to display

TYPE:intDEFAULT:50

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Network graph configuration

create_coupling_matrix
Python
create_coupling_matrix(modules: List[str], coupling_matrix: List[List[int]]) -> Dict[str, Any]

Create coupling matrix heatmap.

PARAMETERDESCRIPTION
modules

List of module names

TYPE:List[str]

coupling_matrix

2D matrix of coupling values

TYPE:List[List[int]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Heatmap configuration

create_instability_chart
Python
create_instability_chart(instability_data: List[Dict[str, Any]], limit: int = 20) -> Dict[str, Any]

Create instability chart for modules.

PARAMETERDESCRIPTION
instability_data

List of modules with instability metrics

TYPE:List[Dict[str, Any]]

limit

Maximum modules to show

TYPE:intDEFAULT:20

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Scatter plot configuration

create_coupling_trend
Python
create_coupling_trend(trend_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create coupling trend chart over time.

PARAMETERDESCRIPTION
trend_data

List of data points with date and metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_dependency_sunburst
Python
create_dependency_sunburst(hierarchy_data: Dict[str, Any]) -> Dict[str, Any]

Create dependency sunburst chart.

PARAMETERDESCRIPTION
hierarchy_data

Hierarchical dependency data

TYPE:Dict[str, Any]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Sunburst/treemap configuration

display_terminal
Python
display_terminal(coupling_data: Dict[str, Any], show_details: bool = True) -> None

Display coupling analysis in terminal.

PARAMETERDESCRIPTION
coupling_data

Coupling analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

create_afferent_efferent_chart
Python
create_afferent_efferent_chart(modules: List[Dict[str, Any]], limit: int = 15) -> Dict[str, Any]

Create afferent vs efferent coupling chart.

PARAMETERDESCRIPTION
modules

List of modules with coupling metrics

TYPE:List[Dict[str, Any]]

limit

Maximum modules to show

TYPE:intDEFAULT:15

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Grouped bar chart configuration

DependencyVisualizer

Python
DependencyVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for dependency metrics.

Creates visualizations for dependency analysis including dependency trees, circular dependency detection, and package relationships.

Initialize dependency visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_dependency_graph
Python
create_dependency_graph(dependencies: Dict[str, List[str]], highlight_circular: bool = True, max_nodes: int = 100) -> Dict[str, Any]

Create dependency graph visualization.

PARAMETERDESCRIPTION
dependencies

Dictionary of module -> [dependencies]

TYPE:Dict[str, List[str]]

highlight_circular

Whether to highlight circular dependencies

TYPE:boolDEFAULT:True

max_nodes

Maximum nodes to display

TYPE:intDEFAULT:100

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Network graph configuration

create_dependency_tree
Python
create_dependency_tree(tree_data: Dict[str, Any], max_depth: int = 5) -> Dict[str, Any]

Create dependency tree visualization.

PARAMETERDESCRIPTION
tree_data

Hierarchical dependency data

TYPE:Dict[str, Any]

max_depth

Maximum tree depth to display

TYPE:intDEFAULT:5

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Treemap configuration

create_package_sunburst
Python
create_package_sunburst(package_data: Dict[str, Any]) -> Dict[str, Any]

Create package structure sunburst chart.

PARAMETERDESCRIPTION
package_data

Hierarchical package data

TYPE:Dict[str, Any]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Sunburst/treemap configuration

create_circular_dependencies_chart
Python
create_circular_dependencies_chart(circular_deps: List[List[str]]) -> Dict[str, Any]

Create circular dependencies visualization.

PARAMETERDESCRIPTION
circular_deps

List of circular dependency chains

TYPE:List[List[str]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Network graph configuration

create_dependency_matrix
Python
create_dependency_matrix(modules: List[str], dependency_matrix: List[List[bool]]) -> Dict[str, Any]

Create dependency matrix visualization.

PARAMETERDESCRIPTION
modules

List of module names

TYPE:List[str]

dependency_matrix

Boolean matrix of dependencies

TYPE:List[List[bool]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Heatmap configuration

create_layer_violations_chart
Python
create_layer_violations_chart(violations: List[Dict[str, Any]]) -> Dict[str, Any]

Create layer violation visualization.

PARAMETERDESCRIPTION
violations

List of layer violations

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Chart configuration

display_terminal
Python
display_terminal(dependency_data: Dict[str, Any], show_details: bool = True) -> None

Display dependency analysis in terminal.

PARAMETERDESCRIPTION
dependency_data

Dependency analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

create_dependency_trend
Python
create_dependency_trend(trend_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create dependency trend chart over time.

PARAMETERDESCRIPTION
trend_data

List of data points with date and metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

ProgressDisplay

Python
ProgressDisplay()

Progress indicator for long-running operations.

Provides spinner and progress bar functionality for CLI operations.

Initialize progress display.

Attributes

spinner_charsinstance-attribute
Python
spinner_chars = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
current_spinnerinstance-attribute
Python
current_spinner = 0

Functions

spinner
Python
spinner(message: str = 'Processing') -> str

Get next spinner frame.

PARAMETERDESCRIPTION
message

Message to display

TYPE:strDEFAULT:'Processing'

RETURNSDESCRIPTION
str

Spinner frame with message

TYPE:str

update_progress
Python
update_progress(current: int, total: int, message: str = 'Progress') -> str

Update progress display.

PARAMETERDESCRIPTION
current

Current item

TYPE:int

total

Total items

TYPE:int

message

Progress message

TYPE:strDEFAULT:'Progress'

RETURNSDESCRIPTION
str

Progress string

TYPE:str

TerminalDisplay

Python
TerminalDisplay(config: Optional[DisplayConfig] = None)

Terminal display utilities for rich CLI output.

Provides methods for displaying data in the terminal with colors, formatting, and various visualization styles.

Initialize terminal display.

PARAMETERDESCRIPTION
config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

configinstance-attribute
Python
config = config or DisplayConfig()
terminal_widthinstance-attribute
Python
terminal_width = columns
colorsinstance-attribute
Python
colors = {'black': '\x1b[30m', 'red': '\x1b[31m', 'green': '\x1b[32m', 'yellow': '\x1b[33m', 'blue': '\x1b[34m', 'magenta': '\x1b[35m', 'cyan': '\x1b[36m', 'white': '\x1b[37m', 'reset': '\x1b[0m', 'bold': '\x1b[1m', 'dim': '\x1b[2m', 'italic': '\x1b[3m', 'underline': '\x1b[4m'}

Functions

display_header
Python
display_header(title: str, subtitle: Optional[str] = None, style: str = 'single') -> None

Display a formatted header.

PARAMETERDESCRIPTION
title

Header title

TYPE:str

subtitle

Optional subtitle

TYPE:Optional[str]DEFAULT:None

style

Border style (single, double, heavy)

TYPE:strDEFAULT:'single'

display_table
Python
display_table(headers: List[str], rows: List[List[Any]], title: Optional[str] = None, align: Optional[List[str]] = None) -> None

Display a formatted table.

PARAMETERDESCRIPTION
headers

Table headers

TYPE:List[str]

rows

Table rows

TYPE:List[List[Any]]

title

Optional table title

TYPE:Optional[str]DEFAULT:None

align

Column alignment (left, right, center)

TYPE:Optional[List[str]]DEFAULT:None

display_metrics
Python
display_metrics(metrics: Dict[str, Any], title: Optional[str] = None, columns: int = 2) -> None

Display metrics in a grid layout.

PARAMETERDESCRIPTION
metrics

Dictionary of metric name to value

TYPE:Dict[str, Any]

title

Optional title

TYPE:Optional[str]DEFAULT:None

columns

Number of columns

TYPE:intDEFAULT:2

display_distribution
Python
display_distribution(distribution: Union[Dict[str, int], List[int]], title: Optional[str] = None, labels: Optional[List[str]] = None, char: str = '█') -> None

Display distribution as horizontal bar chart.

PARAMETERDESCRIPTION
distribution

Distribution data

TYPE:Union[Dict[str, int], List[int]]

title

Optional title

TYPE:Optional[str]DEFAULT:None

labels

Labels for values if distribution is a list

TYPE:Optional[List[str]]DEFAULT:None

char

Character to use for bars

TYPE:strDEFAULT:'█'

display_list
Python
display_list(items: List[str], title: Optional[str] = None, style: str = 'bullet') -> None

Display a formatted list.

PARAMETERDESCRIPTION
items

List items

TYPE:List[str]

title

Optional title

TYPE:Optional[str]DEFAULT:None

style

List style (bullet, numbered, checkbox)

TYPE:strDEFAULT:'bullet'

create_progress_bar
Python
create_progress_bar(current: float, total: float, width: int = 30, show_percentage: bool = True) -> str

Create a progress bar string.

PARAMETERDESCRIPTION
current

Current value

TYPE:float

total

Total value

TYPE:float

width

Bar width

TYPE:intDEFAULT:30

show_percentage

Whether to show percentage

TYPE:boolDEFAULT:True

RETURNSDESCRIPTION
str

Progress bar string

TYPE:str

display_warning
Python
display_warning(message: str) -> None

Display a warning message.

PARAMETERDESCRIPTION
message

Warning message

TYPE:str

display_error
Python
display_error(message: str) -> None

Display an error message.

PARAMETERDESCRIPTION
message

Error message

TYPE:str

display_success
Python
display_success(message: str) -> None

Display a success message.

PARAMETERDESCRIPTION
message

Success message

TYPE:str

colorize
Python
colorize(text: str, color: str) -> str

Add color to text.

PARAMETERDESCRIPTION
text

Text to colorize

TYPE:str

color

Color name or style

TYPE:str

RETURNSDESCRIPTION
str

Colored text

TYPE:str

HotspotVisualizer

Python
HotspotVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for code hotspots.

Creates visualizations for hotspot analysis including heatmaps, bubble charts, and risk matrices.

Initialize hotspot visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_hotspot_heatmap
Python
create_hotspot_heatmap(hotspot_data: List[Dict[str, Any]], metric_x: str = 'change_frequency', metric_y: str = 'complexity') -> Dict[str, Any]

Create hotspot heatmap.

PARAMETERDESCRIPTION
hotspot_data

List of files with hotspot metrics

TYPE:List[Dict[str, Any]]

metric_x

X-axis metric

TYPE:strDEFAULT:'change_frequency'

metric_y

Y-axis metric

TYPE:strDEFAULT:'complexity'

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Heatmap configuration

create_hotspot_bubble
Python
create_hotspot_bubble(hotspot_data: List[Dict[str, Any]], limit: int = 50) -> Dict[str, Any]

Create hotspot bubble chart.

PARAMETERDESCRIPTION
hotspot_data

List of files with hotspot metrics

TYPE:List[Dict[str, Any]]

limit

Maximum bubbles to show

TYPE:intDEFAULT:50

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Bubble chart configuration

create_risk_matrix
Python
create_risk_matrix(hotspot_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create risk matrix visualization.

PARAMETERDESCRIPTION
hotspot_data

List of files with risk metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Scatter plot as risk matrix

create_hotspot_trend
Python
create_hotspot_trend(trend_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create hotspot trend chart over time.

PARAMETERDESCRIPTION
trend_data

List of data points with date and metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_file_activity_chart
Python
create_file_activity_chart(activity_data: List[Dict[str, Any]], limit: int = 20) -> Dict[str, Any]

Create file activity chart.

PARAMETERDESCRIPTION
activity_data

File activity data

TYPE:List[Dict[str, Any]]

limit

Maximum files to show

TYPE:intDEFAULT:20

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Stacked bar chart configuration

display_terminal
Python
display_terminal(hotspot_data: Dict[str, Any], show_details: bool = True) -> None

Display hotspot analysis in terminal.

PARAMETERDESCRIPTION
hotspot_data

Hotspot analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

MomentumVisualizer

Python
MomentumVisualizer(chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Bases: BaseVisualizer

Visualizer for momentum and velocity metrics.

Creates visualizations for development velocity, sprint progress, and team momentum analytics.

Initialize momentum visualizer.

PARAMETERDESCRIPTION
chart_config

Chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

Attributes

terminal_displayinstance-attribute
Python
terminal_display = TerminalDisplay(display_config)

Functions

create_velocity_chart
Python
create_velocity_chart(velocity_data: List[Dict[str, Any]], show_trend: bool = True) -> Dict[str, Any]

Create velocity trend chart.

PARAMETERDESCRIPTION
velocity_data

List of velocity data points

TYPE:List[Dict[str, Any]]

show_trend

Whether to show trend line

TYPE:boolDEFAULT:True

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_burndown_chart
Python
create_burndown_chart(burndown_data: Dict[str, Any]) -> Dict[str, Any]

Create sprint burndown chart.

PARAMETERDESCRIPTION
burndown_data

Burndown data with ideal and actual lines

TYPE:Dict[str, Any]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Line chart configuration

create_sprint_comparison
Python
create_sprint_comparison(sprint_data: List[Dict[str, Any]]) -> Dict[str, Any]

Create sprint comparison chart.

PARAMETERDESCRIPTION
sprint_data

List of sprint metrics

TYPE:List[Dict[str, Any]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Grouped bar chart configuration

create_team_velocity_radar
Python
create_team_velocity_radar(team_metrics: Dict[str, float]) -> Dict[str, Any]

Create team velocity radar chart.

PARAMETERDESCRIPTION
team_metrics

Dictionary of metric name to value

TYPE:Dict[str, float]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Radar chart configuration

create_cumulative_flow
Python
create_cumulative_flow(flow_data: Dict[str, List[int]]) -> Dict[str, Any]

Create cumulative flow diagram.

PARAMETERDESCRIPTION
flow_data

Dictionary of status to daily counts

TYPE:Dict[str, List[int]]

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Stacked area chart configuration

create_productivity_gauge
Python
create_productivity_gauge(productivity_score: float) -> Dict[str, Any]

Create productivity gauge chart.

PARAMETERDESCRIPTION
productivity_score

Productivity score (0-100)

TYPE:float

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Gauge chart configuration

display_terminal
Python
display_terminal(momentum_data: Dict[str, Any], show_details: bool = True) -> None

Display momentum analysis in terminal.

PARAMETERDESCRIPTION
momentum_data

Momentum analysis data

TYPE:Dict[str, Any]

show_details

Whether to show detailed breakdown

TYPE:boolDEFAULT:True

create_contributor_velocity
Python
create_contributor_velocity(contributor_data: List[Dict[str, Any]], limit: int = 10) -> Dict[str, Any]

Create contributor velocity chart.

PARAMETERDESCRIPTION
contributor_data

List of contributor velocity data

TYPE:List[Dict[str, Any]]

limit

Maximum contributors to show

TYPE:intDEFAULT:10

RETURNSDESCRIPTION
Dict[str, Any]

Dict[str, Any]: Bar chart configuration

Functions

visualize_dependencies

Python
visualize_dependencies(dependencies: Dict[str, List[str]], output: Optional[Union[str, Path]] = None, format: str = 'json', max_nodes: int = 100, highlight_circular: bool = True, title: Optional[str] = None) -> Union[Dict[str, Any], None]

Create and optionally export a dependency graph configuration.

PARAMETERDESCRIPTION
dependencies

Mapping of module -> list of dependencies

TYPE:Dict[str, List[str]]

output

Optional output path; when provided, writes chart to file

TYPE:Optional[Union[str, Path]]DEFAULT:None

format

Export format when output is provided (json or html)

TYPE:strDEFAULT:'json'

max_nodes

Max nodes to include in the graph

TYPE:intDEFAULT:100

highlight_circular

Highlight circular dependencies

TYPE:boolDEFAULT:True

title

Optional chart title

TYPE:Optional[str]DEFAULT:None

RETURNSDESCRIPTION
Union[Dict[str, Any], None]

Chart configuration dict if output is None, otherwise None

visualize_complexity

Python
visualize_complexity(file_complexities: Dict[str, List[int]], output: Optional[Union[str, Path]] = None, format: str = 'json', max_functions: int = 50, title: Optional[str] = None) -> Union[Dict[str, Any], None]

Create and optionally export a complexity heatmap configuration.

PARAMETERDESCRIPTION
file_complexities

Mapping of file path -> list of function complexities

TYPE:Dict[str, List[int]]

output

Optional output path; when provided, writes chart to file

TYPE:Optional[Union[str, Path]]DEFAULT:None

format

Export format when output is provided (json or html)

TYPE:strDEFAULT:'json'

max_functions

Maximum functions per file to display

TYPE:intDEFAULT:50

title

Optional chart title

TYPE:Optional[str]DEFAULT:None

RETURNSDESCRIPTION
Union[Dict[str, Any], None]

Chart configuration dict if output is None, otherwise None

visualize_coupling

Python
visualize_coupling(coupling_data: Dict[str, Dict[str, int]], output: Optional[Union[str, Path]] = None, format: str = 'json', min_coupling: int = 2, max_nodes: int = 50, title: Optional[str] = None) -> Union[Dict[str, Any], None]

Create and optionally export a module coupling network configuration.

PARAMETERDESCRIPTION
coupling_data

Mapping of module -> {coupled_module: strength}

TYPE:Dict[str, Dict[str, int]]

output

Optional output path; when provided, writes chart to file

TYPE:Optional[Union[str, Path]]DEFAULT:None

format

Export format when output is provided (json or html)

TYPE:strDEFAULT:'json'

min_coupling

Minimum coupling strength to include

TYPE:intDEFAULT:2

max_nodes

Maximum nodes to include

TYPE:intDEFAULT:50

title

Optional chart title

TYPE:Optional[str]DEFAULT:None

RETURNSDESCRIPTION
Union[Dict[str, Any], None]

Chart configuration dict if output is None, otherwise None

visualize_contributors

Python
visualize_contributors(contributors: List[Dict[str, Any]], output: Optional[Union[str, Path]] = None, format: str = 'json', metric: str = 'commits', limit: int = 10, title: Optional[str] = None) -> Union[Dict[str, Any], None]

Create and optionally export a contributor chart configuration.

PARAMETERDESCRIPTION
contributors

List of contributor dicts with metrics (e.g., commits)

TYPE:List[Dict[str, Any]]

output

Optional output path; when provided, writes chart to file

TYPE:Optional[Union[str, Path]]DEFAULT:None

format

Export format when output is provided (json or html)

TYPE:strDEFAULT:'json'

metric

Metric to visualize (commits, lines, files)

TYPE:strDEFAULT:'commits'

limit

Max contributors to show

TYPE:intDEFAULT:10

title

Optional chart title

TYPE:Optional[str]DEFAULT:None

RETURNSDESCRIPTION
Union[Dict[str, Any], None]

Chart configuration dict if output is None, otherwise None

create_visualization

Python
create_visualization(data: Any, viz_type: str, output: Optional[Union[str, Path]] = None, format: str = 'json', **kwargs) -> Union[Dict[str, Any], None]

Create any type of visualization.

Universal function for creating visualizations based on type.

PARAMETERDESCRIPTION
data

Input data (files, commits, etc.)

TYPE:Any

viz_type

Type of visualization (deps, complexity, coupling, contributors)

TYPE:str

output

Output path

TYPE:Optional[Union[str, Path]]DEFAULT:None

format

Output format

TYPE:strDEFAULT:'json'

**kwargs

Additional arguments for specific visualization

DEFAULT:{}

RETURNSDESCRIPTION
Union[Dict[str, Any], None]

Rendered content if output is None, otherwise None

Example

from tenets.viz import create_visualization

Create dependency graph

viz = create_visualization( ... files, ... "deps", ... format="svg", ... max_nodes=50 ... )

create_visualizer

Python
create_visualizer(viz_type: str, chart_config: Optional[ChartConfig] = None, display_config: Optional[DisplayConfig] = None)

Factory to create a visualizer by type.

PARAMETERDESCRIPTION
viz_type

Type name (complexity, contributors, coupling, dependencies, hotspots)

TYPE:str

chart_config

Optional chart configuration

TYPE:Optional[ChartConfig]DEFAULT:None

display_config

Optional display configuration

TYPE:Optional[DisplayConfig]DEFAULT:None

RETURNSDESCRIPTION

A visualizer instance

RAISESDESCRIPTION
ValueError

If type is unknown

create_chart

Python
create_chart(chart_type: Union[str, ChartType], data: Dict[str, Any], *, title: Optional[str] = None, config: Optional[ChartConfig] = None) -> Dict[str, Any]

Create a chart configuration using BaseVisualizer defaults.

Accepts either a ChartType enum or a string chart type.

create_terminal_display

Python
create_terminal_display(config: Optional[DisplayConfig] = None) -> TerminalDisplay

Create a TerminalDisplay, optionally with custom DisplayConfig.

detect_visualization_type

Python
detect_visualization_type(data: Any) -> str

Best-effort detection of visualization type from data structure.

export_visualization

Python
export_visualization(visualization: Dict[str, Any], output: Union[str, Path], *, format: str = 'json', config: Optional[ChartConfig] = None) -> Path

Export a visualization or dashboard to JSON or HTML.

SVG export is not implemented to keep dependencies optional.

combine_visualizations

Python
combine_visualizations(visualizations: List[Dict[str, Any]], *, layout: str = 'grid', title: str = 'Dashboard') -> Dict[str, Any]

Combine multiple visualization configs into a simple dashboard schema.

check_dependencies

Python
check_dependencies() -> Dict[str, bool]

Check which visualization libraries are available.

RETURNSDESCRIPTION
Dict[str, bool]

Dictionary mapping library names to availability

Example

from tenets.viz import check_dependencies deps = check_dependencies() if deps['plotly']: print("Interactive visualizations available!")

get_available_formats

Python
get_available_formats() -> List[str]

Get list of available output formats based on installed libraries.

RETURNSDESCRIPTION
List[str]

List of format names

Example

from tenets.viz import get_available_formats formats = get_available_formats() print(f"Available formats: {', '.join(formats)}")

install_viz_dependencies

Python
install_viz_dependencies()

Helper to install visualization dependencies.

Provides instructions for installing optional visualization libraries.

Example

from tenets.viz import install_viz_dependencies install_viz_dependencies()

viz_from_cli

Python
viz_from_cli(args: Dict[str, Any]) -> int

Handle visualization from CLI arguments.

Used by the CLI to create visualizations from command arguments.

PARAMETERDESCRIPTION
args

Parsed CLI arguments

TYPE:Dict[str, Any]

RETURNSDESCRIPTION
int

Exit code (0 for success)

Modules