An application framework promoting consistency
Project description
alx-common
A comprehensive Python framework for infrastructure automation, monitoring, and reporting. Designed to standardize common development tasks and eliminate code duplication in production environments.
Prerequisites
Before use, create 2 files in $HOME/.config/alx:
$HOME/.config/alx/envwith contentsvenv=<path/to/venv>(do not include the /bin path)- Other environment settings can also go in here if required
$HOME/.config/alx/key- Add the output from
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"- This is your key to encrypt and decrypt strings - do not share
Summary
alx-common provides a consistent foundation for building reliable internal applications that deal with:
- ✅ Configuration management
- ✅ Argument parsing
- ✅ Different environment handling: dev, test, prod
- ✅ Secure password, etc handling with encryption
- ✅ Logging (including file rotation, maximum size and console output)
- ✅ Database utilities (MySQL, MariaDB, SQLite, PostgreSQL)
- ✅ HTML report generation
- ✅ Email notifications (plain, HTML, attachments, inline images)
- ✅ Monitoring integrations (ITRS Geneos support)
- ✅ Lightweight internal automation tools
Originally designed to simplify and standardize automation scripts,
reporting jobs, monitoring pipelines, and operational tooling across
real-world production environments. The aim of alx-common is to
reduce hard coding and duplication of snippets.
Too many times, I have seen developers share code to 'send an email'.
Then the mailhost changes and there are 200 scripts to fix. Or
a shell script is copied and something edited to create a wrapper
to start a python script. Or the same code is used over and over to
set up logging or read a configuration file coupled with a lot of hard
coding an inconsistencies.
Bad practice is endemic in the developer community as there are too many coders adopting a cut-and-paste mentality.
The name comes from my company, ALX Solutions which is no longer in operation.
Features
-
Application Framework (
alx.app.ALXapp)- Simplified argparse-based CLI definition
- Config-driven parameter management (
alx.ini) - Environment separation (dev/test/prod)
- Secure password storage (Fernet encryption)
- Dynamic path management (logs, data, config)
- Application configuration automatically parsed
and stored in
alx.app.ALXappobject - Centralized logger management handled providing automatic house-keeping based on configuration
-
Database Utilities (
alx.db_util.ALXdatabase)- Simplifies open source database access
- Auto-formatted SQL logging
- Centralized connection lifecycle
- Transaction management
- Simplified execution mechanism
-
Reporting (
alx.html.ALXhtml)- Easy HTML generation
- Promotes tidy and consistent code
-
Email creation (
alx.mail.ALXmail)- Supports plaintext and html formats
- Easy email formatting and sending
- Flexible
- Integrated with SMTP servers, attachments, and inline images
-
String manipulation (
strings.py)- Commonly used string manipulation routines
-
ITRS Geneos Alerts (
alx.itrs.alert.HtmlAlert)- Provides a consistent way to parse the environment on an event
- A standard alert in html / table format
- A class to create a toolkit sampler without the
need to know internal details (
alx.itrs.toolkit.Toolkit) - Standardised environment parsing (
alx.itrs.environment.Environment)
Examples
Please refer to the files in the examples directory
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 alx_common-2.7.5.tar.gz.
File metadata
- Download URL: alx_common-2.7.5.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fd8669e6e99e7b802783b42bc5c3ff666b8ca676e5f5f0556c4ad58c192ede9
|
|
| MD5 |
7acca0f472b58ab58c6f4a95fa977beb
|
|
| BLAKE2b-256 |
cfdfeaad024605b1f6b11389861794298580dd43e3091599485251022e53d413
|
File details
Details for the file alx_common-2.7.5-py3-none-any.whl.
File metadata
- Download URL: alx_common-2.7.5-py3-none-any.whl
- Upload date:
- Size: 37.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
992232b3b8a4d425db6645e0880c843a48ffe88821cdecd125156dbd3da9205b
|
|
| MD5 |
f2e3e0882409945de1dae3f0c42fa8f2
|
|
| BLAKE2b-256 |
e8a04580b1d1621b2315d7fdf42b2f3a7be07cbbfbde3582b65683579e9fbdfe
|