cjm-fasthtml-sysmon


Namecjm-fasthtml-sysmon JSON
Version 0.0.13 PyPI version JSON
download
home_pagehttps://github.com/cj-mills/cjm-fasthtml-sysmon
SummaryFastHTML components and utilities for real-time system resource monitoring with SSE-based live updates.
upload_time2025-10-24 22:40:32
maintainerNone
docs_urlNone
authorChristian J. Mills
requires_python>=3.11
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cjm-fasthtml-sysmon


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Install

``` bash
pip install cjm_fasthtml_sysmon
```

## Project Structure

    nbs/
    ├── components/ (5)
    │   ├── base.ipynb    # Base components for rendering process count and status badges.
    │   ├── cards.ipynb   # Card components for rendering system monitoring dashboards with CPU, memory, disk, network, GPU, process, and temperature information.
    │   ├── common.ipynb  # Common UI components for rendering progress bars and stat cards.
    │   ├── modals.ipynb  # Modal components for configuring system monitoring refresh intervals.
    │   └── tables.ipynb  # Table components for displaying top CPU, memory, and GPU process information.
    ├── core/ (2)
    │   ├── html_ids.ipynb  # Centralized HTML ID constants for the application
    │   └── utils.ipynb     # Utility functions for formatting data and managing UI colors.
    └── monitors/ (8)
        ├── cpu.ipynb        # Monitor and collect CPU usage metrics, per-core statistics, and frequency information.
        ├── disk.ipynb       # Monitor and collect disk usage information for all mounted partitions.
        ├── gpu.ipynb        # Monitor and collect GPU metrics including utilization, memory usage, temperature, and process information.
        ├── memory.ipynb     # Monitor and collect memory and swap usage statistics.
        ├── network.ipynb    # Monitor and collect network interface statistics, bandwidth usage, and connection information.
        ├── processes.ipynb  # Monitor and collect information about running processes including CPU and memory usage rankings.
        ├── sensors.ipynb    # Monitor and collect temperature readings from system sensors including CPU, GPU, and storage devices.
        └── system.ipynb     # Monitor and collect static system information including OS details, hardware configuration, and boot time.

Total: 15 notebooks across 3 directories

## Module Dependencies

``` mermaid
graph LR
    components_base[components.base<br/>base]
    components_cards[components.cards<br/>cards]
    components_common[components.common<br/>common]
    components_modals[components.modals<br/>modals]
    components_tables[components.tables<br/>tables]
    core_html_ids[core.html_ids<br/>HTML IDs]
    core_utils[core.utils<br/>utils]
    monitors_cpu[monitors.cpu<br/>CPU monitoring]
    monitors_disk[monitors.disk<br/>disk monitoring]
    monitors_gpu[monitors.gpu<br/>GPU monitoring]
    monitors_memory[monitors.memory<br/>memory monitoring]
    monitors_network[monitors.network<br/>network monitoring]
    monitors_processes[monitors.processes<br/>Process monitoring]
    monitors_sensors[monitors.sensors<br/>sensors]
    monitors_system[monitors.system<br/>system]

    components_base --> core_html_ids
    components_base --> monitors_processes
    components_cards --> core_utils
    components_cards --> monitors_network
    components_cards --> components_tables
    components_cards --> monitors_cpu
    components_cards --> components_base
    components_cards --> components_common
    components_cards --> monitors_disk
    components_cards --> monitors_processes
    components_cards --> monitors_sensors
    components_cards --> monitors_system
    components_cards --> monitors_memory
    components_cards --> core_html_ids
    components_cards --> monitors_gpu
    components_common --> core_utils
    components_common --> monitors_system
    components_modals --> core_html_ids
    components_tables --> monitors_processes
    components_tables --> core_html_ids
    components_tables --> monitors_gpu
```

*21 cross-module dependencies detected*

## CLI Reference

No CLI commands found in this project.

## Module Overview

Detailed documentation for each module in the project:

### base (`base.ipynb`)

> Base components for rendering process count and status badges.

#### Import

``` python
from cjm_fasthtml_sysmon.components.base import (
    render_process_count,
    render_process_status
)
```

#### Functions

``` python
def render_process_count(
    total:int  # The total number of processes
)-> FT:  # A Span element containing the process count badge
    "Render the process count badge."
```

``` python
def render_process_status(
    status_counts:dict  # Dictionary mapping process status names to their counts
)-> FT:  # A Div element containing status badges
    "Render the process status badges."
```

### cards (`cards.ipynb`)

> Card components for rendering system monitoring dashboards with CPU,
> memory, disk, network, GPU, process, and temperature information.

#### Import

``` python
from cjm_fasthtml_sysmon.components.cards import (
    scroll_preserve_script,
    get_cpu_text_color,
    render_cpu_cores_grid,
    render_os_info_card,
    render_cpu_card,
    render_memory_card,
    render_disk_entries,
    render_disk_card,
    render_network_interfaces,
    render_network_connections,
    render_network_card,
    render_process_card,
    render_gpu_metrics,
    render_gpu_processes_section,
    render_gpu_card,
    render_temperature_sensors,
    render_temperature_card
)
```

#### Functions

``` python
def get_cpu_text_color(
    percent:float  # CPU usage percentage
)-> ColoredUtilityDaisyUI:  # CSS class string for semantic color based on CPU usage
    "Get semantic color based on CPU usage percentage."
```

``` python
def render_cpu_cores_grid(
    cpu_percents:list  # List of CPU usage percentages for each core
)-> FT:  # A Div element containing a responsive grid of CPU core usage
    "Render CPU cores as a responsive grid with color-coded percentages."
```

``` python
def render_os_info_card()-> FT:  # A Div element containing the OS information card
    "Render the OS information card."
```

``` python
def render_cpu_card(
    cpu_info:dict  # Dictionary containing CPU usage information
)-> FT:  # A Div element containing the CPU usage card
    "Render the CPU usage card."
```

``` python
def render_memory_card(
    mem_info:dict  # Dictionary containing memory usage information
)-> FT:  # A Div element containing the memory usage card
    "Render the memory usage card."
```

``` python
def render_disk_entries(
    disk_info:list  # List of dictionaries containing disk information
)-> FT:  # A Div element containing disk entries
    "Render just the disk entries section."
```

``` python
def render_disk_card(
    disk_info:list  # List of dictionaries containing disk usage information
)-> FT:  # A Div element containing the disk usage card
    "Render the disk usage card using helper functions."
```

``` python
def render_network_interfaces(
    net_info:dict  # Dictionary containing network information
)-> FT:  # A Div element containing network interfaces
    "Render just the network interfaces section."
```

``` python
def render_network_connections(
    net_info:dict  # Dictionary containing network information
)-> FT:  # A Div element containing connection statistics
    "Render just the network connections section."
```

``` python
def render_network_card(
    net_info:dict  # Dictionary containing network interface and connection information
)-> FT:  # A Div element containing the network monitoring card
    "Render the network monitoring card using helper functions."
```

``` python
def render_process_card(
    proc_info:dict  # Dictionary containing process information and statistics
)-> FT:  # A Div element containing the process monitoring card
    "Render the process monitoring card."
```

``` python
def render_gpu_metrics(
    gpu_info:dict  # Dictionary containing GPU information
)-> FT:  # A Div element containing GPU metrics section
    "Render just the GPU metrics section (utilization, memory, temp, power)."
```

``` python
def render_gpu_processes_section(
    gpu_info:dict  # Dictionary containing GPU information
)-> FT:  # A Div element containing GPU processes section
    "Render just the GPU processes section."
```

``` python
def render_gpu_card(
    gpu_info:dict  # Dictionary containing GPU information and statistics
)-> FT:  # A Div element containing the GPU information card
    "Render the GPU information card using helper functions."
```

``` python
def render_temperature_sensors(
    temp_info:list  # List of dictionaries containing temperature information
)-> FT:  # A Div element containing temperature sensors
    "Render just the temperature sensors section."
```

``` python
def render_temperature_card(
    temp_info:list  # List of dictionaries containing temperature sensor information
)-> FT:  # A Div element containing the temperature sensors card
    "Render the temperature sensors card using helper functions."
```

### common (`common.ipynb`)

> Common UI components for rendering progress bars and stat cards.

#### Import

``` python
from cjm_fasthtml_sysmon.components.common import (
    render_stat_card,
    render_progress_bar
)
```

#### Functions

``` python
def render_stat_card(
    title_text:str,  # The title text for the stat card
    value_text:str,  # The main value to display in the stat card
    desc_text:str=None,  # Optional description text below the value
    value_color:str=None  # Optional color class for the value text
)-> FT:  # A Div element containing the stat card with consistent styling
    "Render a stat card with consistent styling."
```

``` python
def render_progress_bar(
    value:float,  # The current progress value
    max_value:float=100,  # The maximum value for the progress bar (default: 100)
    label:str=None  # Optional label text to display above the progress bar
)-> FT:  # A Div element containing the progress bar with optional label
    "Render a progress bar with label."
```

### CPU monitoring (`cpu.ipynb`)

> Monitor and collect CPU usage metrics, per-core statistics, and
> frequency information.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.cpu import (
    get_cpu_info
)
```

#### Functions

``` python
def get_cpu_info() -> dict:  # A dictionary containing CPU usage information
    """Get current CPU usage information."""
    cpu_percent = psutil.cpu_percent(interval=0.1, percpu=False)
    cpu_percent_per_core = psutil.cpu_percent(interval=0.1, percpu=True)
    cpu_freq = psutil.cpu_freq()

    return {
        'percent': cpu_percent,
    "Get current CPU usage information."
```

### disk monitoring (`disk.ipynb`)

> Monitor and collect disk usage information for all mounted partitions.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.disk import (
    get_disk_info
)
```

#### Functions

``` python
def get_disk_info() -> list:  # A list of dictionaries containing disk usage information for each partition
    """Get disk usage information."""
    partitions = psutil.disk_partitions()
    disk_info = []

    for partition in partitions
    "Get disk usage information."
```

### GPU monitoring (`gpu.ipynb`)

> Monitor and collect GPU metrics including utilization, memory usage,
> temperature, and process information.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.gpu import (
    get_gpu_info
)
```

#### Functions

``` python
def get_gpu_info() -> dict:  # A dictionary containing GPU availability, type, details, and process information
    """Check for GPU availability and get info using nvitop."""
    gpu_info = {'available': False, 'type': 'None', 'details': {}, 'processes': []}
    "Check for GPU availability and get info using nvitop."
```

### HTML IDs (`html_ids.ipynb`)

> Centralized HTML ID constants for the application

#### Import

``` python
from cjm_fasthtml_sysmon.core.html_ids import (
    HtmlIds
)
```

#### Classes

``` python
class HtmlIds:
    "HTML ID constants used throughout the application."
    
    def as_selector(id_str: str) -> str
        "Convert an ID to a CSS selector format (with #)."
```

### memory monitoring (`memory.ipynb`)

> Monitor and collect memory and swap usage statistics.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.memory import (
    get_memory_info
)
```

#### Functions

``` python
def get_memory_info() -> dict:  # A dictionary containing memory usage information
    """Get current memory usage information."""
    mem = psutil.virtual_memory()
    swap = psutil.swap_memory()

    return {
        'total': mem.total,
    "Get current memory usage information."
```

### modals (`modals.ipynb`)

> Modal components for configuring system monitoring refresh intervals.

#### Import

``` python
from cjm_fasthtml_sysmon.components.modals import (
    render_settings_modal
)
```

#### Functions

``` python
def render_settings_modal(
    refresh_intervals:dict,  # Dictionary containing refresh interval values for each component
    post_rt:str="/update_intervals" # Target route path
)-> FT:  # A Dialog element containing the settings modal
    "Render the settings modal for configuring refresh intervals."
```

### network monitoring (`network.ipynb`)

> Monitor and collect network interface statistics, bandwidth usage, and
> connection information.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.network import (
    NETWORK_STATS_CACHE,
    get_network_info
)
```

#### Functions

``` python
def get_network_info() -> dict:  # A dictionary containing network interface information and connection statistics
    """Get network interface information and statistics."""
    interfaces = []
    stats = psutil.net_io_counters(pernic=True)
    addrs = psutil.net_if_addrs()

    current_time = time.time()

    for interface, io_stats in stats.items()
    "Get network interface information and statistics."
```

#### Variables

``` python
NETWORK_STATS_CACHE = {0 items}
```

### Process monitoring (`processes.ipynb`)

> Monitor and collect information about running processes including CPU
> and memory usage rankings.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.processes import (
    get_process_info
)
```

#### Functions

``` python
def get_process_info(top_n:int=5) -> dict:  # Number of top processes to return for CPU and memory categories  # A dictionary containing top processes and process statistics
    """Get top processes by CPU and memory usage."""
    processes = []

    # Get all processes with their info
    for proc in psutil.process_iter(['pid', 'name', 'cpu_percent', 'memory_percent', 'memory_info', 'username', 'status'])
    "Get top processes by CPU and memory usage."
```

### sensors (`sensors.ipynb`)

> Monitor and collect temperature readings from system sensors including
> CPU, GPU, and storage devices.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.sensors import (
    get_temperature_info
)
```

#### Functions

``` python
def get_temperature_info() -> list:  # A list of dictionaries containing temperature sensor information
    """Get temperature sensor information."""
    temps = []

    try
    "Get temperature sensor information."
```

### system (`system.ipynb`)

> Monitor and collect static system information including OS details,
> hardware configuration, and boot time.

#### Import

``` python
from cjm_fasthtml_sysmon.monitors.system import (
    get_static_system_info
)
```

#### Functions

``` python
def get_static_system_info() -> dict:  # A dictionary containing static system information
    """Get system information that doesn't change during runtime."""
    
    try
    "Get system information that doesn't change during runtime."
```

### tables (`tables.ipynb`)

> Table components for displaying top CPU, memory, and GPU process
> information.

#### Import

``` python
from cjm_fasthtml_sysmon.components.tables import (
    render_cpu_processes_table,
    render_memory_processes_table,
    render_gpu_processes_table_body,
    render_gpu_processes_table
)
```

#### Functions

``` python
def render_cpu_processes_table(
    top_cpu:list  # List of dictionaries containing top CPU-consuming process information
)-> FT:  # A Div element containing the CPU processes table
    "Render the CPU processes table."
```

``` python
def render_memory_processes_table(
    top_memory:list  # List of dictionaries containing top memory-consuming process information
)-> FT:  # A Div element containing the memory processes table
    "Render the memory processes table."
```

``` python
def render_gpu_processes_table_body(
    gpu_processes:list  # List of dictionaries containing GPU process information
)-> FT:  # A Div element containing the GPU processes table body
    "Render just the GPU processes table body."
```

``` python
def render_gpu_processes_table(
    gpu_processes:list  # List of dictionaries containing GPU process information
)-> FT:  # A Div element containing the GPU processes table
    "Render the GPU processes table."
```

### utils (`utils.ipynb`)

> Utility functions for formatting data and managing UI colors.

#### Import

``` python
from cjm_fasthtml_sysmon.core.utils import (
    find_free_port,
    format_bytes,
    format_bandwidth,
    format_uptime,
    get_progress_color,
    get_temperature_color,
    get_temperature_badge_color,
    open_browser
)
```

#### Functions

``` python
def find_free_port() -> int:  # An available port number
    """Find an available port."""
    with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s
    "Find an available port."
```

``` python
def format_bytes(
    bytes_value:int  # The number of bytes to format
) -> str:  # A formatted string representation of the byte value
    "Format bytes to human readable string."
```

``` python
def format_bandwidth(
    bytes_per_sec:float  # The number of bytes per second to format
) -> str:  # A formatted string representation of the bandwidth value
    "Format bandwidth to human readable string."
```

``` python
def format_uptime(
    boot_time_str:str  # Boot time in '%Y-%m-%d %H:%M:%S' format
) -> str:  # A formatted string representation of the uptime
    "Format uptime from boot time string."
```

``` python
def get_progress_color(
    percent:float  # The percentage value to determine color for
) -> SingleValueUtility:  # A progress color from the DaisyUI color scheme
    "Get progress bar color based on percentage."
```

``` python
def get_temperature_color(
    temp_celsius:float,  # The temperature value in Celsius
    high:int=85,  # The threshold for high temperature
    critical:int=95  # The threshold for critical temperature
) -> ColoredUtilityDaisyUI:  # A text color from the DaisyUI semantic colors
    "Get color for temperature display."
```

``` python
def get_temperature_badge_color(
    temp_celsius:float,  # The temperature value in Celsius
    high:int=85,  # The threshold for high temperature
    critical:int=95  # The threshold for critical temperature
) -> SingleValueUtility:  # A badge color from the DaisyUI color scheme
    "Get badge color for temperature."
```

``` python
def open_browser(
    url:str  # The URL to open in the browser
) -> None:  # None
    "Open browser based on environment settings."
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cj-mills/cjm-fasthtml-sysmon",
    "name": "cjm-fasthtml-sysmon",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "nbdev jupyter notebook python",
    "author": "Christian J. Mills",
    "author_email": "9126128+cj-mills@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/b6/0bbdc997aa3e0e2b666afc5b83157952a012564403202dc70a76e357e0b9/cjm_fasthtml_sysmon-0.0.13.tar.gz",
    "platform": null,
    "description": "# cjm-fasthtml-sysmon\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n``` bash\npip install cjm_fasthtml_sysmon\n```\n\n## Project Structure\n\n    nbs/\n    \u251c\u2500\u2500 components/ (5)\n    \u2502   \u251c\u2500\u2500 base.ipynb    # Base components for rendering process count and status badges.\n    \u2502   \u251c\u2500\u2500 cards.ipynb   # Card components for rendering system monitoring dashboards with CPU, memory, disk, network, GPU, process, and temperature information.\n    \u2502   \u251c\u2500\u2500 common.ipynb  # Common UI components for rendering progress bars and stat cards.\n    \u2502   \u251c\u2500\u2500 modals.ipynb  # Modal components for configuring system monitoring refresh intervals.\n    \u2502   \u2514\u2500\u2500 tables.ipynb  # Table components for displaying top CPU, memory, and GPU process information.\n    \u251c\u2500\u2500 core/ (2)\n    \u2502   \u251c\u2500\u2500 html_ids.ipynb  # Centralized HTML ID constants for the application\n    \u2502   \u2514\u2500\u2500 utils.ipynb     # Utility functions for formatting data and managing UI colors.\n    \u2514\u2500\u2500 monitors/ (8)\n        \u251c\u2500\u2500 cpu.ipynb        # Monitor and collect CPU usage metrics, per-core statistics, and frequency information.\n        \u251c\u2500\u2500 disk.ipynb       # Monitor and collect disk usage information for all mounted partitions.\n        \u251c\u2500\u2500 gpu.ipynb        # Monitor and collect GPU metrics including utilization, memory usage, temperature, and process information.\n        \u251c\u2500\u2500 memory.ipynb     # Monitor and collect memory and swap usage statistics.\n        \u251c\u2500\u2500 network.ipynb    # Monitor and collect network interface statistics, bandwidth usage, and connection information.\n        \u251c\u2500\u2500 processes.ipynb  # Monitor and collect information about running processes including CPU and memory usage rankings.\n        \u251c\u2500\u2500 sensors.ipynb    # Monitor and collect temperature readings from system sensors including CPU, GPU, and storage devices.\n        \u2514\u2500\u2500 system.ipynb     # Monitor and collect static system information including OS details, hardware configuration, and boot time.\n\nTotal: 15 notebooks across 3 directories\n\n## Module Dependencies\n\n``` mermaid\ngraph LR\n    components_base[components.base<br/>base]\n    components_cards[components.cards<br/>cards]\n    components_common[components.common<br/>common]\n    components_modals[components.modals<br/>modals]\n    components_tables[components.tables<br/>tables]\n    core_html_ids[core.html_ids<br/>HTML IDs]\n    core_utils[core.utils<br/>utils]\n    monitors_cpu[monitors.cpu<br/>CPU monitoring]\n    monitors_disk[monitors.disk<br/>disk monitoring]\n    monitors_gpu[monitors.gpu<br/>GPU monitoring]\n    monitors_memory[monitors.memory<br/>memory monitoring]\n    monitors_network[monitors.network<br/>network monitoring]\n    monitors_processes[monitors.processes<br/>Process monitoring]\n    monitors_sensors[monitors.sensors<br/>sensors]\n    monitors_system[monitors.system<br/>system]\n\n    components_base --> core_html_ids\n    components_base --> monitors_processes\n    components_cards --> core_utils\n    components_cards --> monitors_network\n    components_cards --> components_tables\n    components_cards --> monitors_cpu\n    components_cards --> components_base\n    components_cards --> components_common\n    components_cards --> monitors_disk\n    components_cards --> monitors_processes\n    components_cards --> monitors_sensors\n    components_cards --> monitors_system\n    components_cards --> monitors_memory\n    components_cards --> core_html_ids\n    components_cards --> monitors_gpu\n    components_common --> core_utils\n    components_common --> monitors_system\n    components_modals --> core_html_ids\n    components_tables --> monitors_processes\n    components_tables --> core_html_ids\n    components_tables --> monitors_gpu\n```\n\n*21 cross-module dependencies detected*\n\n## CLI Reference\n\nNo CLI commands found in this project.\n\n## Module Overview\n\nDetailed documentation for each module in the project:\n\n### base (`base.ipynb`)\n\n> Base components for rendering process count and status badges.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.components.base import (\n    render_process_count,\n    render_process_status\n)\n```\n\n#### Functions\n\n``` python\ndef render_process_count(\n    total:int  # The total number of processes\n)-> FT:  # A Span element containing the process count badge\n    \"Render the process count badge.\"\n```\n\n``` python\ndef render_process_status(\n    status_counts:dict  # Dictionary mapping process status names to their counts\n)-> FT:  # A Div element containing status badges\n    \"Render the process status badges.\"\n```\n\n### cards (`cards.ipynb`)\n\n> Card components for rendering system monitoring dashboards with CPU,\n> memory, disk, network, GPU, process, and temperature information.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.components.cards import (\n    scroll_preserve_script,\n    get_cpu_text_color,\n    render_cpu_cores_grid,\n    render_os_info_card,\n    render_cpu_card,\n    render_memory_card,\n    render_disk_entries,\n    render_disk_card,\n    render_network_interfaces,\n    render_network_connections,\n    render_network_card,\n    render_process_card,\n    render_gpu_metrics,\n    render_gpu_processes_section,\n    render_gpu_card,\n    render_temperature_sensors,\n    render_temperature_card\n)\n```\n\n#### Functions\n\n``` python\ndef get_cpu_text_color(\n    percent:float  # CPU usage percentage\n)-> ColoredUtilityDaisyUI:  # CSS class string for semantic color based on CPU usage\n    \"Get semantic color based on CPU usage percentage.\"\n```\n\n``` python\ndef render_cpu_cores_grid(\n    cpu_percents:list  # List of CPU usage percentages for each core\n)-> FT:  # A Div element containing a responsive grid of CPU core usage\n    \"Render CPU cores as a responsive grid with color-coded percentages.\"\n```\n\n``` python\ndef render_os_info_card()-> FT:  # A Div element containing the OS information card\n    \"Render the OS information card.\"\n```\n\n``` python\ndef render_cpu_card(\n    cpu_info:dict  # Dictionary containing CPU usage information\n)-> FT:  # A Div element containing the CPU usage card\n    \"Render the CPU usage card.\"\n```\n\n``` python\ndef render_memory_card(\n    mem_info:dict  # Dictionary containing memory usage information\n)-> FT:  # A Div element containing the memory usage card\n    \"Render the memory usage card.\"\n```\n\n``` python\ndef render_disk_entries(\n    disk_info:list  # List of dictionaries containing disk information\n)-> FT:  # A Div element containing disk entries\n    \"Render just the disk entries section.\"\n```\n\n``` python\ndef render_disk_card(\n    disk_info:list  # List of dictionaries containing disk usage information\n)-> FT:  # A Div element containing the disk usage card\n    \"Render the disk usage card using helper functions.\"\n```\n\n``` python\ndef render_network_interfaces(\n    net_info:dict  # Dictionary containing network information\n)-> FT:  # A Div element containing network interfaces\n    \"Render just the network interfaces section.\"\n```\n\n``` python\ndef render_network_connections(\n    net_info:dict  # Dictionary containing network information\n)-> FT:  # A Div element containing connection statistics\n    \"Render just the network connections section.\"\n```\n\n``` python\ndef render_network_card(\n    net_info:dict  # Dictionary containing network interface and connection information\n)-> FT:  # A Div element containing the network monitoring card\n    \"Render the network monitoring card using helper functions.\"\n```\n\n``` python\ndef render_process_card(\n    proc_info:dict  # Dictionary containing process information and statistics\n)-> FT:  # A Div element containing the process monitoring card\n    \"Render the process monitoring card.\"\n```\n\n``` python\ndef render_gpu_metrics(\n    gpu_info:dict  # Dictionary containing GPU information\n)-> FT:  # A Div element containing GPU metrics section\n    \"Render just the GPU metrics section (utilization, memory, temp, power).\"\n```\n\n``` python\ndef render_gpu_processes_section(\n    gpu_info:dict  # Dictionary containing GPU information\n)-> FT:  # A Div element containing GPU processes section\n    \"Render just the GPU processes section.\"\n```\n\n``` python\ndef render_gpu_card(\n    gpu_info:dict  # Dictionary containing GPU information and statistics\n)-> FT:  # A Div element containing the GPU information card\n    \"Render the GPU information card using helper functions.\"\n```\n\n``` python\ndef render_temperature_sensors(\n    temp_info:list  # List of dictionaries containing temperature information\n)-> FT:  # A Div element containing temperature sensors\n    \"Render just the temperature sensors section.\"\n```\n\n``` python\ndef render_temperature_card(\n    temp_info:list  # List of dictionaries containing temperature sensor information\n)-> FT:  # A Div element containing the temperature sensors card\n    \"Render the temperature sensors card using helper functions.\"\n```\n\n### common (`common.ipynb`)\n\n> Common UI components for rendering progress bars and stat cards.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.components.common import (\n    render_stat_card,\n    render_progress_bar\n)\n```\n\n#### Functions\n\n``` python\ndef render_stat_card(\n    title_text:str,  # The title text for the stat card\n    value_text:str,  # The main value to display in the stat card\n    desc_text:str=None,  # Optional description text below the value\n    value_color:str=None  # Optional color class for the value text\n)-> FT:  # A Div element containing the stat card with consistent styling\n    \"Render a stat card with consistent styling.\"\n```\n\n``` python\ndef render_progress_bar(\n    value:float,  # The current progress value\n    max_value:float=100,  # The maximum value for the progress bar (default: 100)\n    label:str=None  # Optional label text to display above the progress bar\n)-> FT:  # A Div element containing the progress bar with optional label\n    \"Render a progress bar with label.\"\n```\n\n### CPU monitoring (`cpu.ipynb`)\n\n> Monitor and collect CPU usage metrics, per-core statistics, and\n> frequency information.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.cpu import (\n    get_cpu_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_cpu_info() -> dict:  # A dictionary containing CPU usage information\n    \"\"\"Get current CPU usage information.\"\"\"\n    cpu_percent = psutil.cpu_percent(interval=0.1, percpu=False)\n    cpu_percent_per_core = psutil.cpu_percent(interval=0.1, percpu=True)\n    cpu_freq = psutil.cpu_freq()\n\n    return {\n        'percent': cpu_percent,\n    \"Get current CPU usage information.\"\n```\n\n### disk monitoring (`disk.ipynb`)\n\n> Monitor and collect disk usage information for all mounted partitions.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.disk import (\n    get_disk_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_disk_info() -> list:  # A list of dictionaries containing disk usage information for each partition\n    \"\"\"Get disk usage information.\"\"\"\n    partitions = psutil.disk_partitions()\n    disk_info = []\n\n    for partition in partitions\n    \"Get disk usage information.\"\n```\n\n### GPU monitoring (`gpu.ipynb`)\n\n> Monitor and collect GPU metrics including utilization, memory usage,\n> temperature, and process information.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.gpu import (\n    get_gpu_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_gpu_info() -> dict:  # A dictionary containing GPU availability, type, details, and process information\n    \"\"\"Check for GPU availability and get info using nvitop.\"\"\"\n    gpu_info = {'available': False, 'type': 'None', 'details': {}, 'processes': []}\n    \"Check for GPU availability and get info using nvitop.\"\n```\n\n### HTML IDs (`html_ids.ipynb`)\n\n> Centralized HTML ID constants for the application\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.core.html_ids import (\n    HtmlIds\n)\n```\n\n#### Classes\n\n``` python\nclass HtmlIds:\n    \"HTML ID constants used throughout the application.\"\n    \n    def as_selector(id_str: str) -> str\n        \"Convert an ID to a CSS selector format (with #).\"\n```\n\n### memory monitoring (`memory.ipynb`)\n\n> Monitor and collect memory and swap usage statistics.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.memory import (\n    get_memory_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_memory_info() -> dict:  # A dictionary containing memory usage information\n    \"\"\"Get current memory usage information.\"\"\"\n    mem = psutil.virtual_memory()\n    swap = psutil.swap_memory()\n\n    return {\n        'total': mem.total,\n    \"Get current memory usage information.\"\n```\n\n### modals (`modals.ipynb`)\n\n> Modal components for configuring system monitoring refresh intervals.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.components.modals import (\n    render_settings_modal\n)\n```\n\n#### Functions\n\n``` python\ndef render_settings_modal(\n    refresh_intervals:dict,  # Dictionary containing refresh interval values for each component\n    post_rt:str=\"/update_intervals\" # Target route path\n)-> FT:  # A Dialog element containing the settings modal\n    \"Render the settings modal for configuring refresh intervals.\"\n```\n\n### network monitoring (`network.ipynb`)\n\n> Monitor and collect network interface statistics, bandwidth usage, and\n> connection information.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.network import (\n    NETWORK_STATS_CACHE,\n    get_network_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_network_info() -> dict:  # A dictionary containing network interface information and connection statistics\n    \"\"\"Get network interface information and statistics.\"\"\"\n    interfaces = []\n    stats = psutil.net_io_counters(pernic=True)\n    addrs = psutil.net_if_addrs()\n\n    current_time = time.time()\n\n    for interface, io_stats in stats.items()\n    \"Get network interface information and statistics.\"\n```\n\n#### Variables\n\n``` python\nNETWORK_STATS_CACHE = {0 items}\n```\n\n### Process monitoring (`processes.ipynb`)\n\n> Monitor and collect information about running processes including CPU\n> and memory usage rankings.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.processes import (\n    get_process_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_process_info(top_n:int=5) -> dict:  # Number of top processes to return for CPU and memory categories  # A dictionary containing top processes and process statistics\n    \"\"\"Get top processes by CPU and memory usage.\"\"\"\n    processes = []\n\n    # Get all processes with their info\n    for proc in psutil.process_iter(['pid', 'name', 'cpu_percent', 'memory_percent', 'memory_info', 'username', 'status'])\n    \"Get top processes by CPU and memory usage.\"\n```\n\n### sensors (`sensors.ipynb`)\n\n> Monitor and collect temperature readings from system sensors including\n> CPU, GPU, and storage devices.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.sensors import (\n    get_temperature_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_temperature_info() -> list:  # A list of dictionaries containing temperature sensor information\n    \"\"\"Get temperature sensor information.\"\"\"\n    temps = []\n\n    try\n    \"Get temperature sensor information.\"\n```\n\n### system (`system.ipynb`)\n\n> Monitor and collect static system information including OS details,\n> hardware configuration, and boot time.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.monitors.system import (\n    get_static_system_info\n)\n```\n\n#### Functions\n\n``` python\ndef get_static_system_info() -> dict:  # A dictionary containing static system information\n    \"\"\"Get system information that doesn't change during runtime.\"\"\"\n    \n    try\n    \"Get system information that doesn't change during runtime.\"\n```\n\n### tables (`tables.ipynb`)\n\n> Table components for displaying top CPU, memory, and GPU process\n> information.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.components.tables import (\n    render_cpu_processes_table,\n    render_memory_processes_table,\n    render_gpu_processes_table_body,\n    render_gpu_processes_table\n)\n```\n\n#### Functions\n\n``` python\ndef render_cpu_processes_table(\n    top_cpu:list  # List of dictionaries containing top CPU-consuming process information\n)-> FT:  # A Div element containing the CPU processes table\n    \"Render the CPU processes table.\"\n```\n\n``` python\ndef render_memory_processes_table(\n    top_memory:list  # List of dictionaries containing top memory-consuming process information\n)-> FT:  # A Div element containing the memory processes table\n    \"Render the memory processes table.\"\n```\n\n``` python\ndef render_gpu_processes_table_body(\n    gpu_processes:list  # List of dictionaries containing GPU process information\n)-> FT:  # A Div element containing the GPU processes table body\n    \"Render just the GPU processes table body.\"\n```\n\n``` python\ndef render_gpu_processes_table(\n    gpu_processes:list  # List of dictionaries containing GPU process information\n)-> FT:  # A Div element containing the GPU processes table\n    \"Render the GPU processes table.\"\n```\n\n### utils (`utils.ipynb`)\n\n> Utility functions for formatting data and managing UI colors.\n\n#### Import\n\n``` python\nfrom cjm_fasthtml_sysmon.core.utils import (\n    find_free_port,\n    format_bytes,\n    format_bandwidth,\n    format_uptime,\n    get_progress_color,\n    get_temperature_color,\n    get_temperature_badge_color,\n    open_browser\n)\n```\n\n#### Functions\n\n``` python\ndef find_free_port() -> int:  # An available port number\n    \"\"\"Find an available port.\"\"\"\n    with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s\n    \"Find an available port.\"\n```\n\n``` python\ndef format_bytes(\n    bytes_value:int  # The number of bytes to format\n) -> str:  # A formatted string representation of the byte value\n    \"Format bytes to human readable string.\"\n```\n\n``` python\ndef format_bandwidth(\n    bytes_per_sec:float  # The number of bytes per second to format\n) -> str:  # A formatted string representation of the bandwidth value\n    \"Format bandwidth to human readable string.\"\n```\n\n``` python\ndef format_uptime(\n    boot_time_str:str  # Boot time in '%Y-%m-%d %H:%M:%S' format\n) -> str:  # A formatted string representation of the uptime\n    \"Format uptime from boot time string.\"\n```\n\n``` python\ndef get_progress_color(\n    percent:float  # The percentage value to determine color for\n) -> SingleValueUtility:  # A progress color from the DaisyUI color scheme\n    \"Get progress bar color based on percentage.\"\n```\n\n``` python\ndef get_temperature_color(\n    temp_celsius:float,  # The temperature value in Celsius\n    high:int=85,  # The threshold for high temperature\n    critical:int=95  # The threshold for critical temperature\n) -> ColoredUtilityDaisyUI:  # A text color from the DaisyUI semantic colors\n    \"Get color for temperature display.\"\n```\n\n``` python\ndef get_temperature_badge_color(\n    temp_celsius:float,  # The temperature value in Celsius\n    high:int=85,  # The threshold for high temperature\n    critical:int=95  # The threshold for critical temperature\n) -> SingleValueUtility:  # A badge color from the DaisyUI color scheme\n    \"Get badge color for temperature.\"\n```\n\n``` python\ndef open_browser(\n    url:str  # The URL to open in the browser\n) -> None:  # None\n    \"Open browser based on environment settings.\"\n```\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "FastHTML components and utilities for real-time system resource monitoring with SSE-based live updates.",
    "version": "0.0.13",
    "project_urls": {
        "Homepage": "https://github.com/cj-mills/cjm-fasthtml-sysmon"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "21120e038fdc05fec90d2dffbab4ddb4b27701ef03e6c9a60da39fefe6653ed5",
                "md5": "bdb94013bf73dbb0e9f7f6d87bc90890",
                "sha256": "77a070a3f589f61c047fdd123c11897cb82dd86c2610d22b9fb70e68f1067ab7"
            },
            "downloads": -1,
            "filename": "cjm_fasthtml_sysmon-0.0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdb94013bf73dbb0e9f7f6d87bc90890",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 35091,
            "upload_time": "2025-10-24T22:40:31",
            "upload_time_iso_8601": "2025-10-24T22:40:31.638710Z",
            "url": "https://files.pythonhosted.org/packages/21/12/0e038fdc05fec90d2dffbab4ddb4b27701ef03e6c9a60da39fefe6653ed5/cjm_fasthtml_sysmon-0.0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b7b60bbdc997aa3e0e2b666afc5b83157952a012564403202dc70a76e357e0b9",
                "md5": "040091dac6417d718a00f4360d0452b2",
                "sha256": "a99984284022d7aa0a0a30c40d1343f2b7fd892d3bfaf9f0578e8ae90cc62e69"
            },
            "downloads": -1,
            "filename": "cjm_fasthtml_sysmon-0.0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "040091dac6417d718a00f4360d0452b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 33347,
            "upload_time": "2025-10-24T22:40:32",
            "upload_time_iso_8601": "2025-10-24T22:40:32.615214Z",
            "url": "https://files.pythonhosted.org/packages/b7/b6/0bbdc997aa3e0e2b666afc5b83157952a012564403202dc70a76e357e0b9/cjm_fasthtml_sysmon-0.0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-24 22:40:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cj-mills",
    "github_project": "cjm-fasthtml-sysmon",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cjm-fasthtml-sysmon"
}
        
Elapsed time: 3.20743s