Skip to main content

Python utilities for files, strings, time, serial, structs, and database

Project description

xaeian

Python utilities for files, strings, time, serial, structs, and database. Zero dependencies for core modules. Optional extras for time, serial, and database backends.

Install

pip install xaeian            # core
pip install xaeian[time]      # + pytz, tzlocal
pip install xaeian[serial]    # + pyserial
pip install xaeian[db]        # + pymysql, psycopg2
pip install xaeian[db-async]  # + aiomysql, asyncpg, aiosqlite
pip install xaeian[all]       # everything

Modules

Module Description Docs
files FILE, DIR, PATH, JSON, CSV, INI xaeian/files.py
files_async Async wrappers via asyncio.to_thread() xaeian/files_async.py
xstring split, replace, strip comments, passwords xaeian/xstring.py
xtime Datetime parsing, arithmetic, rounding xaeian/xtime.py
colors ANSI 256-color terminal codes xaeian/colors.py
log Colored logging with file rotation xaeian/log.py
crc CRC-8/16/32 with predefined variants xaeian/crc.py
cstruct Binary struct serialization (C-like) xaeian/cstruct.py
serial_port Serial communication with colored output xaeian/serial_port.py
cbash Embedded device console protocol xaeian/cbash.py
db Database abstraction (SQLite, MySQL, PostgreSQL) xaeian/db/

Quick Start

from xaeian import FILE, JSON, CSV, logger, generate_password
from xaeian.xtime import Time
from xaeian.crc import crc16_modbus

# File operations
config = JSON.load("config")
CSV.save("export", [{"name": "Jan", "score": 95}, {"name": "Anna", "score": 88}])
# Time arithmetic
deadline = Time("2025-03-01") + "2w" # + 2 weeks
if Time() > deadline:
  print("Overdue!")
# CRC protection
frame = crc16_modbus.encode(b"\x01\x03\x00\x00\x00\x0A")
if crc16_modbus.decode(frame):
  print("Valid Modbus frame")
# Colored logging
log = logger("app", file="app.log", color=True)
log.info(f"New password: {generate_password(16)}")

Database example:

from xaeian.db import Database

db = Database("sqlite", "app.db")
db.insert("users", {"name": "Jan", "email": "jan@example.com"})
user = db.find_one("users", name="Jan")
users = db.find("users", order="name", limit=10)
with db.transaction():
  db.update("users", {"verified": True}, "id = ?", user["id"])
  db.insert("logs", {"action": "verify", "user_id": user["id"]})

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

xaeian-0.1.0.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

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

xaeian-0.1.0-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file xaeian-0.1.0.tar.gz.

File metadata

  • Download URL: xaeian-0.1.0.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xaeian-0.1.0.tar.gz
Algorithm Hash digest
SHA256 046f513c96a3c404bf16d7e8b432cdb8845dc38547e784a09778357341a19c20
MD5 e280de9c917b5fc059993f1593238206
BLAKE2b-256 2f5e59a1e8d60ccf61214509c2a6345f4e99a4f110a235d171f6cd4a2358e811

See more details on using hashes here.

Provenance

The following attestation bundles were made for xaeian-0.1.0.tar.gz:

Publisher: publish.yml on Xaeian/Python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xaeian-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xaeian-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xaeian-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a96bd7776ee05327165a887b70d7aaf89be0f10db1ec567a87a69ff6db059bfb
MD5 1702646ed772e0b5371278b8b0b26203
BLAKE2b-256 3b611a7689509c3b7062859e5ad444eec8341bc905e3e48cfa47850eec5bd42b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xaeian-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Xaeian/Python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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