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.4

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.4
File Size Uploaded
modeltoolbox_core-0.2.4.tar.gz 21.7 kB Details

Built distribution (wheel)

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

Total release size: 48.3 kB

Release files / modeltoolbox_core-0.2.4.tar.gz

Download URL modeltoolbox_core-0.2.4.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef3b9c657b2f345fd9a6c35f882207160dd5fe6a3b8239afed79d9e9141be142
BLAKE2b-256 checksum
How to use checksums
e3beefcf27173c0ee13f5f4dee3692714f77fe0169c08e4aa1a1aab009a0162e
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.4-py3-none-any.whl

Download URL modeltoolbox_core-0.2.4-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23a07fe2e7d62d36f27c9e0f5d8dfe2156e138927316fce2ce50806ec3cd32fd
BLAKE2b-256 checksum
How to use checksums
8f6988ef529fbcd01a542c12f910777da3ec1eb862b55f575410eb9f021dafc4
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

0.2.5

2 release files

This release

0.2.4 This release

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