Skip to main content
corekat-light

corekat is a powerful, asynchronous Python toolkit providing shared utilities for Kat-based microservices. It offers robust configuration management, pluggable file download capabilities, foundational async client infrastructure, and standardized exception handling.

Key Features

  • Type-Safe Configuration: Manage your application's settings with Pydantic V2, loading from YAML files and environment variables with a clear hierarchy.
  • Exception Hierarchy: Standardized exceptions with HTTP status mapping, structured error details, and automatic serialization.
  • String & Dict Utilities: Case conversion (to_snake_case, to_pascal_case, to_kebab_case) and dictionary flattening/unflattening for config transformations.
  • Pluggable Download Client: A fully asynchronous DownloadClient for handling files from HTTP, local storage, and S3 (via StashKat) through a pluggable "fetcher" protocol.
  • Dependency Injection Pattern: Encourages clean architecture by promoting dependency injection for configuration and clients, making your code more modular and easier to test.
  • Async Context Managers: All clients support async with for automatic resource cleanup.

What's New in v3

Exception Hierarchy

Standardized exception handling with automatic HTTP status mapping:

from corekat.exceptions import NotFoundError, ValidationError

# Raise with structured details
raise NotFoundError(
    "User not found",
    details={"user_id": "123"}
)

# Automatic HTTP mapping in ServeKat
# → 404 response with {"code": "not_found", "message": "...", "details": {...}}

String Utilities

Common string transformations for code generation and API design:

from corekat import to_snake_case, to_pascal_case, to_kebab_case

to_snake_case("HelloWorld")    # "hello_world"
to_pascal_case("hello_world")  # "HelloWorld"
to_kebab_case("HelloWorld")    # "hello-world"

Dict Utilities

Flatten and unflatten nested dictionaries for config processing:

from corekat import flatten_dict, unflatten_dict

nested = {"app": {"db": {"host": "localhost"}}}
flat = flatten_dict(nested)
# {"app.db.host": "localhost"}

restored = unflatten_dict(flat)
# {"app": {"db": {"host": "localhost"}}}

Installation

Install the library and its dependencies.

# Core library
uv pip install corekat

# For S3 support, install the stashkat plugin
uv pip install stashkat

# For development with all extras
uv pip install -e ".[dev,all]"

(Requires Python >= 3.12)

Full Documentation

For detailed guides, tutorials, and the API reference, please visit the full documentation site.

Development

  • Setup: uv sync --dev
  • Testing: make test
  • Linting & Formatting: make check and make fix

License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

Release files for corekat 0.3.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 corekat 0.3.4
File Size Uploaded
corekat-0.3.4.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for corekat 0.3.4
File Interpreter ABI Platform
corekat-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 40.9 kB

Release files / corekat-0.3.4.tar.gz

Download URL corekat-0.3.4.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dbbbd2c72efc1984542995c86c3ea9ac392f32649b0626bd198fad87ee4314f6
BLAKE2b-256 checksum
How to use checksums
ae38f0181d3b76f54930953c1b5f2521ba04c2f0414bf8c684fccafe79eafd36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / corekat-0.3.4-py3-none-any.whl

Download URL corekat-0.3.4-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1712d6da65cd5554279f4e68a5f4ee51d12f9cb0bced56de0fd807c9d52a9ca
BLAKE2b-256 checksum
How to use checksums
df446eb7bf753a662ace10064abd969baf47b5dd96979be4e3280b632005f0be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

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