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

Metadata

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 Provenance Actions
modeltoolbox_core-0.2.5.tar.gz 22.2 kB Without provenance Details for modeltoolbox_core-0.2.5.tar.gz

Built distribution (wheel)

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

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

Security for modeltoolbox-core 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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