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

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

Built distribution (wheel)

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

Total release size: 48.3 kB

Release files / modeltoolbox_core-0.2.3.tar.gz

Download URL modeltoolbox_core-0.2.3.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1eafc16a4fcf7fe1e6b3565044b12c44c2b7f83e8bad676795193705cca371f0
BLAKE2b-256 checksum
How to use checksums
788ebeb7a07ac84a1bf2dba1e302501ffa222a39b68c2304c774213e708d01e7
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.3-py3-none-any.whl

Download URL modeltoolbox_core-0.2.3-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e148ff33ab9061885b800c60b675b6a0ba038ef76edb871edc75659a22671a8
BLAKE2b-256 checksum
How to use checksums
e27a3498658b6f34c76a09950c6d00e3c6a57da3581a61edf0affb77b02e5d35
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

0.2.4

2 release files

This release

0.2.3 This release

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