sevaht-utility

General-purpose Python utilities.

The library is small and focused. The most-used pieces are:

Installation

$ pip install sevaht-utility

Requires Python 3.12 or newer and has no runtime dependencies.

Quick start

from dataclasses import dataclass
from sevaht_utility.naming import convert_name, NameStyle
from sevaht_utility.parsing import csv_load, DataMapping

# Convert between casing styles.
convert_name("getHTTPResponseCode", style=NameStyle.SNAKE_CASE)
# -> 'get_http_response_code'

# Load CSV whose camelCase headers should feed snake_case fields.
@dataclass
class Person:
    full_name: str
    score_value: int

rows = ["fullName,scoreValue", "Ada,95"]
list(csv_load(rows, dataclass=Person, mapping=DataMapping(name_style=NameStyle.CAMEL_CASE)))
# -> [Person(full_name='Ada', score_value=95)]