A lightweight Python toolbox for data modeling, SQLite DAOs, encrypted key-value storage, and small productivity utilities.
- Data objects with JSON serialization and type-aware formatting.
- SQLite client + DAO layer with query generation.
- KV DAO with optional AES-backed encryption.
- Encryption helpers for bytes, chunks, and files.
- Utility helpers for IO, hashing, logging, and timing.
- Python >= 3.11
uvfor dependency and environment management
uv syncThis creates a project-managed virtual environment from pyproject.toml and uv.lock.
For development tools such as pytest, black, pre-commit, and twine:
uv sync --group devIf you prefer a traditional virtualenv workflow:
pip install -e .To install the project with development extras:
pip install -e ".[dev]"from ec_tools.database import CipherKvDao, SqliteClient, SqliteKvDao
from ec_tools.tools.cipher import AesCipherGenerator
from ec_tools.tools.key_manager import KeyManager
sqlite_client = SqliteClient(":memory:")
kv_dao = SqliteKvDao(sqlite_client)
cipher_generator = AesCipherGenerator()
cipher_kv_dao = CipherKvDao(kv_dao, cipher_generator)
manager = KeyManager(cipher_kv_dao, "my-password")
manager.refresh_keys(["token", "cookie"])
print(manager.get_key("token"))from ec_tools.tools.headers_manager import HeadersManager
headers = HeadersManager(manager, ["token"], {"User-Agent": "ec-tools"}).get()
print(headers)Define dataclasses that serialize to/from JSON with helpers for enums, lists, sets, unions, and nested objects.
import dataclasses
from ec_tools.data import DataObject
@dataclasses.dataclass
class User(DataObject):
name: str
age: int
user = User.from_json({"name": "Ada", "age": "42"})
print(user.to_json())AesCipherfor encrypting/decrypting bytes.- Chunked and file-level encryption utilities in
ec_tools.tools.cipher.
Run the test suite:
uv run pytestFormat code:
uv run black .Install pre-commit hooks:
uv run pre-commit installBuild distributions:
uv buildec_tools/data: data-object helpers and JSON formatting.ec_tools/database: SQLite client, DAO, and KV DAO.ec_tools/tools: key/headers managers, cipher tools, thread pool.ec_tools/utils: IO, hashing, logging, and timing helpers.
MIT