Python utilities for files, strings, time, serial, structs, and database
Project description
xaeian
Python utilities for files, strings, time, serial, structs, media, PDF, and database. Zero dependencies for core modules. Optional extras for time, serial, media, PDF, and database backends.
Install
pip install xaeian # core
pip install xaeian[time] # + pytz, tzlocal
pip install xaeian[serial] # + pyserial
pip install xaeian[mf] # + pypdf, PyMuPDF, Pillow
pip install xaeian[pdf] # + reportlab, svglib, Pillow
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 |
cmd |
Shell command helpers | xaeian/cmd.py |
mf |
Compress, convert, strip metadata (PDF & images) | xaeian/mf/ |
pdf |
PDF generation with fluent API | xaeian/pdf/ |
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)}")
Media files:
from xaeian.mf.min import compress
from xaeian.mf.meta import scrub_metadata
compress("report.pdf") # → report-min.pdf
compress("photo.jpg", max_px=1280) # → photo-min.jpg
scrub_metadata("photo.jpg") # → photo-nometa.jpg
PDF generation:
from xaeian.pdf import PDF
with PDF("output.pdf") as pdf:
pdf.font("Helvetica", 16, "Bold")
pdf.text("Hello World")
pdf.enter()
pdf.font(size=12, mode="Regular")
pdf.text("Second line of text.")
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"]})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xaeian-0.2.0.tar.gz.
File metadata
- Download URL: xaeian-0.2.0.tar.gz
- Upload date:
- Size: 84.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42d4d55d42e8712a74235398c33a6e46ecd5ab56d596d92977f7dfa22986089f
|
|
| MD5 |
572ad52f72df48f3f2b2288e2ba7fb7a
|
|
| BLAKE2b-256 |
951999b454d70ea17579f36734a21b84b0b895b393d22836c3fb032675ca37cf
|
Provenance
The following attestation bundles were made for xaeian-0.2.0.tar.gz:
Publisher:
publish.yml on Xaeian/Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xaeian-0.2.0.tar.gz -
Subject digest:
42d4d55d42e8712a74235398c33a6e46ecd5ab56d596d92977f7dfa22986089f - Sigstore transparency entry: 955251195
- Sigstore integration time:
-
Permalink:
Xaeian/Python@98cf5665d4c52d06e68b753b0732bfdbf9aa76cf -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/Xaeian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98cf5665d4c52d06e68b753b0732bfdbf9aa76cf -
Trigger Event:
release
-
Statement type:
File details
Details for the file xaeian-0.2.0-py3-none-any.whl.
File metadata
- Download URL: xaeian-0.2.0-py3-none-any.whl
- Upload date:
- Size: 107.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecccde3486ee41be536eac48166870fd2c609dcc3a8e98231c2dc6e2868922b6
|
|
| MD5 |
3af0b8c1c299446aea2fda668aeeba84
|
|
| BLAKE2b-256 |
38e8c4823dc5990eb2c6cad2c3ae7b97fe4e60e1b90b9b2a41e5b02261a442f6
|
Provenance
The following attestation bundles were made for xaeian-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Xaeian/Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xaeian-0.2.0-py3-none-any.whl -
Subject digest:
ecccde3486ee41be536eac48166870fd2c609dcc3a8e98231c2dc6e2868922b6 - Sigstore transparency entry: 955251223
- Sigstore integration time:
-
Permalink:
Xaeian/Python@98cf5665d4c52d06e68b753b0732bfdbf9aa76cf -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/Xaeian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98cf5665d4c52d06e68b753b0732bfdbf9aa76cf -
Trigger Event:
release
-
Statement type: