Skip to main content

A lightweight toolbox for data models, SQLite DAOs, encrypted storage, and utility helpers.

Project description

ec_tools

A lightweight Python toolbox for data modeling, SQLite DAOs, encrypted key-value storage, and small productivity utilities.

Highlights

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

Requirements

  • Python >= 3.12

Install (from source)

pip install -e .

Quick start

Encrypted KV storage with a KeyManager

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"))

Build headers from stored secrets

from ec_tools.tools.headers_manager import HeadersManager

headers = HeadersManager(manager, ["token"], {"User-Agent": "ec-tools"}).get()
print(headers)

Data objects

Define dataclasses that serialize to/from JSON with helpers for enums, lists, sets, 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())

Encryption helpers

  • AesCipher for encrypting/decrypting bytes.
  • Chunked and file-level encryption utilities in ec_tools.tools.cipher.

Project layout

  • ec_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.

Development

pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ec_tools-3.2.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ec_tools-3.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file ec_tools-3.2.tar.gz.

File metadata

  • Download URL: ec_tools-3.2.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ec_tools-3.2.tar.gz
Algorithm Hash digest
SHA256 1bfd2439b9cf5390350b093ea64b2556616d389e0642c9046a06baa347aa6649
MD5 dacc33980cc0ff69e32fec2863d1c91f
BLAKE2b-256 3a8b32db8bf1525f8158084277ad0c2531a9fd24e611bc7dfa9ba163120e79df

See more details on using hashes here.

File details

Details for the file ec_tools-3.2-py3-none-any.whl.

File metadata

  • Download URL: ec_tools-3.2-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ec_tools-3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fefbe9050648838026f984e05c99598910d37d66a98a57ab078fbdd5a3533b75
MD5 e073fbbed43b66ee97311b3743e3f368
BLAKE2b-256 7dbc2eb44340aa5bf8a7db05fcaa2afac6a2c5a052e61d23a53cf526fbd18d0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page