Skip to main content

Turinium is a Python framework designed to streamline software development by reducing boilerplate code and providing utility functions for database connections, logging, error handling, and configuration management.

Project description

Turinium: Empowering Intelligent Systems

Turinium is a modern Python framework designed to reduce boilerplate code and supercharge productivity across teams by offering structured utilities for configuration management, database interaction, logging, and integration with external storage and messaging services.

Turinium is ideal for development teams that want to minimize complexity, avoid repetitive code, and ensure consistent best practices across applications — all while remaining beginner-friendly and accessible to non-specialists looking to prototype or deploy intelligent solutions.


Table of Contents


Features

  • Unified configuration handling from .json, .json5, .toml, .yaml, .yml, and .env files.
  • Auto-instantiation of config dataclasses (including nested lists of dataclasses).
  • Partitioned configuration access with SharedAppConfig.
  • Database service registry and execution for PostgreSQL and SQL Server.
  • Smart logging to console, file, and JSON formats.
  • Email sending with rich support for HTML and attachments.
  • Abstraction for FTP, Google Drive, OneDrive, and local file system access.

Installation

pip install turinium

Optional Database Dependencies

pip install turinium[database_all]         # PostgreSQL + SQL Server
pip install turinium[database_pg]          # PostgreSQL only
pip install turinium[database_odbc]        # SQL Server (ODBC) only

Quick Start

from turinium import AppConfig

config = AppConfig("config/")  # folder or list of files
db_conf = config.get_config_block("databases")

Or use the shared global config:

from turinium import SharedAppConfig

config = SharedAppConfig("./config/")
api_conf = config.get_config_block("api")

Modules and Usage

Configuration Management (AppConfig)

Turinium's AppConfig reads and merges configuration from one or more files or folders.

from turinium import AppConfig

config = AppConfig(["base.json", "overrides.yaml"])
db_host = config.get_config_value("databases", "host")

Supports:

  • File types: .json, .json5, .toml, .yaml, .yml, .env
  • Value overrides using environment variables
  • CLI argument merging
  • Mapping blocks to dataclasses:
{
  "ftp": {
    "to_dataclass": "mypackage.config.FTPConfig",
    "host": "ftp.myhost.com"
  }
}

SharedAppConfig

When you want configuration available globally:

from turinium import SharedAppConfig

SharedAppConfig.load("config/")
conf = SharedAppConfig.get("databases")

Supports:

  • Named partitions (e.g., SharedAppConfig.load(..., name="etl"))
  • Reusable config in any module or class

Database Services (DBServices)

Easily connect to one or more databases and register callable services like:

  • sp: Stored procedure
  • fn: Function
  • upsert: Batch insert/update (PostgreSQL/SQL Server)
  • query: Raw SQL from file

Example Configuration

{
  "GetClients": {
    "db": "main",
    "type": "sp",
    "routine": "usp_GetClients"
  },
  "SalesReport": {
    "db": "analytics",
    "type": "query",
    "command": "sales_report.sql"
  }
}

Usage:

from turinium import DBServices as dbs

dbs.register_databases(config.get_config_block("databases"))
dbs.register_services(config.get_config_block("dbservices"))

ok, result = dbs.execute("FetchData", params=("2023-01-01",))

Logging (TLogging)

TLogging offers structured, flexible logging with a single line of setup:

from turinium import TLogging

logger = TLogging(log_to=("console", "file", "json"))
logger.info("App initialized")
  • Multi-destination logging (console, text, JSON)
  • Structured or simple formats
  • Rotating file support
  • Structured JSON logs (great for tracing and automation)

Email Sending (EmailSender)

from turinium import EmailSender

with EmailSender("smtp.mail.com", "user@domain.com", "password", 0) as sender:
    sender.send_email(
        to_list=["target@x.com"],
        subject="Hello",
        html_message="<p>Test</p>",
        text_message="Test"
    )

Supports attachments, CC/BCC, and logs any errors on send.


StorageServices

Configure access to FTP, GDrive, OneDrive, or local storage using a unified API.

from turinium.storageservices import DataSourceServices

storage = DataSourceServices.from_config(config.get_config_block("sources"))
ftp = storage.get("my_ftp")
ftp.upload("local.txt", "remote/path.txt")

Supported operations:

  • Upload/download
  • Ensure/make directories
  • List and filter files
  • Automatically applies base path from config

Contributing

Contributions are welcome!

To contribute:

  1. Fork the project.
  2. Add tests for any new functionality.
  3. Keep docstrings and logging clean.
  4. Submit a PR and describe the intent clearly.

Turinium follows best practices in Python packaging and code quality. Use docstrings and include test coverage.


License

MIT License – see LICENSE file.

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

turinium-0.2.2a0.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

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

turinium-0.2.2a0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file turinium-0.2.2a0.tar.gz.

File metadata

  • Download URL: turinium-0.2.2a0.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for turinium-0.2.2a0.tar.gz
Algorithm Hash digest
SHA256 415e85d67bc40dfce933168e5fda192278462150355824d61e9323436fa42ce8
MD5 95ed6cd50759926706ffb4273edebd45
BLAKE2b-256 b52bc55d7772386e11f62bfe08ec9eaee197344aa1d87f88211d68978c5a4f9b

See more details on using hashes here.

File details

Details for the file turinium-0.2.2a0-py3-none-any.whl.

File metadata

  • Download URL: turinium-0.2.2a0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for turinium-0.2.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 d50675be399a93c4750913af10cab60b17de2eb95d58d4bb5bbb1dcf068b9104
MD5 75b304025ddba3bf9ebba6253f468ca7
BLAKE2b-256 48fd72e16b552834e296c0393cb7e2bac3c972d3136f1f8f7c9028c7e836ffc5

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