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.3.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.3-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ec_tools-3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 4db80ca715bdb2a84a52f5fdf2e08123eb16cf7c5651c812089b149fb973d095
MD5 84158d103184dddadaf6f0175fb46efc
BLAKE2b-256 09aca7898e4f87caeb6b8d9ad170164c67f1c1079f749c6f598d67c92dbefb5d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ec_tools-3.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a402f8e2a626a82e588b83426df75f63d42df5a80e971e5644fd07ed6bb969
MD5 f7c1f0b162ba7cb27f4d8974eb3329e3
BLAKE2b-256 d3b528943be9df04c0db573849b6299c530d5ae27fcffa6c42dea170e28c775b

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