Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ismael-sarmiento/kimera_python/llms.txt

Use this file to discover all available pages before exploring further.

Kimera Core is a lightweight Python utility library designed to eliminate repetitive boilerplate when building production-grade applications. It ships a cohesive set of components — in-memory and thread-local caching, smart JSON serialization, MD5 hashing, a Logstash-compatible logging handler, and module introspection — so you can focus on your domain logic instead of reinventing infrastructure primitives. It targets Python 3.6 and above, carries no mandatory third-party dependencies, and is straightforward to extend thanks to its abstract-base-class architecture.

Architecture

Every Kimera Core component is rooted in an abstract base class (ABC), which guarantees a consistent interface and lets you swap or extend any engine without changing the calling code. The cache subsystem exposes a three-level hierarchy:
ClassTypeResponsibility
BaseCacheEngineABCDeclares the core contract: get, set, delete, exists, clear
LocalCacheEngineABC (extends BaseCacheEngine)Adds normalize_timeout, normalize_size, and the abstract size_regulator
InMemoryCacheEngineConcreteProcess-wide dict-backed store with TTL and size eviction
ThreadCacheEngineConcretePer-thread store — isolates cache state across threads automatically
The serializer subsystem follows the same pattern. BaseSerializerHandler (ABC) defines can_i_handle_object_to_serialize, can_i_handle_object_to_deserialize, build_serializer, and build_deserializer. Concrete handlers (DictSerializerHandler, DateTimeSerializerHandler, TupleSerializerHandler, and others) are composed inside KimeraSerializer, which selects the right handler at runtime for any Python object.
Because all engines inherit from ABCs, you can introduce a custom cache backend — say a file-based store or a cloud key-value service — by subclassing LocalCacheEngine and implementing its abstract methods. The rest of your application needs no changes.

Components

Local Cache

In-memory and thread-local cache engines with TTL and configurable max-size eviction.

Remote Cache

Redis and Memcached backends sharing the same BaseCacheEngine interface.

Serializers

Round-trip JSON serialization for dicts, lists, tuples, datetime, date, and arbitrary Python objects.

Extractor

Raw data extraction utilities for pulling structured content from unstructured sources.

Utilities

Hash

build_hash produces a deterministic MD5 hex string from any Python object, including custom class instances.

Import Utils

Runtime module introspection: check existence, resolve fully qualified names, and retrieve attributes dynamically.

Exceptions

ExceptionsUtils provides guard helpers, such as raising on missing dictionary keys, that keep validation logic concise.

Logger

KimeraLogstashHandler extends Python’s DatagramHandler to serialise log records as UTF-8 strings and forward them to a Logstash UDP endpoint.

Python Version Compatibility

Kimera Core requires Python 3.6 or later. The minimum version is enforced in setup.py via python_requires='>=3.6'. All standard-library features used — abc, threading, hashlib, json, importlib — are available in every supported release.
If you are running Python 3.7+ you can take advantage of ordered dictionaries by default, which makes InMemoryCacheEngine’s size-regulation eviction order predictable: the oldest inserted key is removed first via dict.popitem().

License

Kimera Core is released under the MIT License. You are free to use, modify, and distribute it in both open-source and commercial projects. See the LICENSE file at the root of the repository for the full license text.

Build docs developers (and LLMs) love