Skip to main content

ModelCore

Core utilities for ModelToolbox: logging, telemetry, configuration, and plugin system.

Features

  • Unified Logging: Zero-configuration structured logging with console and file outputs
  • Performance Monitoring: Decorators for tracking command execution time and errors
  • Health Checks: Dependency checking and version information reporting
  • MCP Server Support: Specialized logging and monitoring for MCP servers
  • Plugin System: Dynamic plugin loading via entry points

Installation

pip install modeltoolbox-core

For development:

pip install -e "ModelCore[dev]"

Usage

Logging

from modeltoolbox_core.logging import get_logger

logger = get_logger(__name__)
logger.info("Processing started")
logger.error("An error occurred", exc_info=True)

Logs are written to:

  • Console: INFO level and above
  • File: ~/.modeltoolbox/logs/modeltoolbox-YYYY-MM-DD.log (all levels, JSON format)
  • Errors: ~/.modeltoolbox/logs/errors-YYYY-MM-DD.log (ERROR level only)

Performance Tracking

from modeltoolbox_core.telemetry import track_performance

@track_performance
def expensive_operation():
    # Your code here
    pass

Health Checks

from modeltoolbox_core.health import health_check

status = health_check()
print(status)
# {
#   "status": "healthy",
#   "version_info": {"python": "3.11.0", ...},
#   "dependencies": {"git": {"available": True, "version": "..."}, ...}
# }

MCP Server Integration

from mcp.server.fastmcp import FastMCP
from modeltoolbox_core.mcp_logging import setup_mcp_logger, log_tool_call

logger = setup_mcp_logger("my_server")
mcp = FastMCP("my_server")

@mcp.tool()
@log_tool_call
def my_tool(param: str) -> dict:
    """My tool with automatic logging."""
    return {"result": param}

Testing

pytest ModelCore/tests/

License

MIT

Release files for modeltoolbox-core 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modeltoolbox-core 0.2.5
File Size Uploaded
modeltoolbox_core-0.2.5.tar.gz 22.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modeltoolbox-core 0.2.5
File Interpreter ABI Platform
modeltoolbox_core-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 49.5 kB

Release files / modeltoolbox_core-0.2.5.tar.gz

Download URL modeltoolbox_core-0.2.5.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dae05736d9a2b6d60d3110d8138e6aecdedecf4d76fc19ad168f95ff6830ce43
BLAKE2b-256 checksum
How to use checksums
90569b19b946bf3681617f93e617c37b060f554d612a69fe9b162c077f277806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / modeltoolbox_core-0.2.5-py3-none-any.whl

Download URL modeltoolbox_core-0.2.5-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3982cb130fb020d39e8d041136191bb6c76afb9c579889e603f05f92b53de44c
BLAKE2b-256 checksum
How to use checksums
065a23f8110356a4fe3d694236fa797d80de07a22a186a107ab670ed8e156fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page