Skip to main content

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

Project description

xaeian

Python utilities. Zero dependencies for core. Optional extras for time, serial, media, database.

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[db]        # + pymysql, psycopg2
pip install xaeian[db-async]  # + aiomysql, asyncpg, aiosqlite
pip install xaeian[all]       # everything

Examples

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

# Files: auto extension, context-based paths
JSON.save("config", {"debug": True, "port": 8080})
CSV.save("users", [{"name": "Jan", "age": 30}, {"name": "Anna", "age": 25}])

# Time: parse anything, arithmetic with strings
t = Time("2025-03-01") + "2w 3d"
t.round("w")  # Monday 00:00
t.to("iso")   # "2025-03-17T00:00:00+01:00"

# CRC: encode/decode with Modbus, ISO, custom
frame = crc16_modbus.encode(b"\x01\x03\x00\x00\x00\x0A")
assert crc16_modbus.decode(frame) is not None

# String tools
split_str('a,"b,c",d', sep=",")  # ['a', '"b,c"', 'd']
generate_password(16)            # 'aB3$xY9!mN2@pQ7&'

# Database: sqlite/mysql/postgres, sync/async
db = Database("sqlite", "app.db")
db.insert("users", {"name": "Jan", "settings": {"theme": "dark"}})
db.find("users", order="name", limit=10)
async with db.transaction():
  db.update("users", {"verified": True}, "id = ?", 42)

# Media: compress, strip metadata
from xaeian.mf.min import compress
compress("report.pdf")            # → report-min.pdf
compress("photos/", max_px=1280)  # → photos-min/ (recursive)

# Logging: colored, rotating
log = logger("app", file="app.log")
log.info("started")  # 2025-03-01 14:32:01 INF started

Modules

Module Description Docs
files FILE, DIR, PATH, JSON, CSV, INI xaeian/readme.md
files_async Async wrappers via asyncio.to_thread() xaeian/readme.md
table Lightweight tabular ops on list[dict] xaeian/readme.md
xstring Split, replace, strip comments, passwords xaeian/readme.md
xtime Datetime parsing, arithmetic, rounding xaeian/readme.md
colors ANSI 256-color terminal codes xaeian/readme.md
log Colored logging with file rotation xaeian/readme.md
crc CRC-8/16/32 with predefined variants xaeian/readme.md
cstruct Binary struct serialization (C-like) xaeian/readme.md
cmd Shell command helpers xaeian/readme.md
serial_port Serial communication with colored output xaeian/readme.md
cbash Embedded device console protocol xaeian/readme.md
mf Compress, convert, strip metadata (PDF & images) xaeian/mf/readme.md
db Database abstraction (SQLite, MySQL, PostgreSQL) xaeian/db/readme.md
eda E-series, KiCad production export xaeian/eda/readme.md
cli tree, dupes, wifi scripts xaeian/cli/readme.md

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.3.0.tar.gz (93.1 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.3.0-py3-none-any.whl (117.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xaeian-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c4c2546f6026fbe2d00cf4ca789cd7302e75a73bab4e7c2221e8cda22b55f648
MD5 a7ae812ba71bcaa844dc3ad4135b37bd
BLAKE2b-256 f51f55b140a17cd8de96206c8c0a92018184c54a83f37e9e4c8c65da21a90b6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xaeian-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: xaeian-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 117.1 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c3e8d5e314b2c922a67e108879909e1f604bacccf123419075fd0fc81b55fad
MD5 70faf942a97edecf452c2d9dc10075e2
BLAKE2b-256 903567ae1369c48d6e4a90c10abb35773b293452b353565ad5422ad83d13b856

See more details on using hashes here.

Provenance

The following attestation bundles were made for xaeian-0.3.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