Open source

GitHub repositories

Code you maintain, experiments, and tools worth sharing.

Overview

Database Connections is a unified Python library for managing connections across multiple database systems. It provides a consistent, production-ready interface for working with both relational and non-relational databases, with built-in support for connection pooling, async/sync execution, health monitoring, and performance metrics.

This library is designed for modern backend systems and AI-driven applications where multiple data sources must be managed reliably and efficiently.


Key Features

  • 🔌 Multi-Database Support
    Works with PostgreSQL, Redis, MongoDB, ClickHouse, RabbitMQ, and Neo4j.
  • Async & Sync Support
    Unified interface for both synchronous and asynchronous workloads.
  • 🔄 Connection Pooling
    Efficient reuse of connections with configurable pool sizes and overflow handling.
  • 🏥 Health Monitoring
    Built-in health checks for both connection pools and database servers.
  • 📊 Performance Metrics
    Track active connections, wait times, and pool utilization in real time.
  • 🔧 Framework Integration
    Seamless integration with FastAPI, Flask, and Django.
  • 🎯 Fully Typed API
    Strong type hints for better IDE support and safer development.
  • 🧪 Production Ready
    Comprehensive test coverage and enterprise-grade design.

Installation

Install the base package:

 
pip install db_connections
 

Install with database-specific support:

 
pip install db_connections[postgres]
pip install db_connections[redis]
pip install db_connections[mongodb]
pip install db_connections[clickhouse]
pip install db_connections[rabbitmq]
pip install db_connections[neo4j]
 

Install multiple databases:

 
pip install db_connections[postgres,redis,mongodb]
 

Install everything:

 
pip install db_connections[all]
 

For development:

 
pip install db_connections[dev]
 

Quick Start

PostgreSQL (Sync)

 
from db_connections.scr.all_db_connectors.connectors.postgres import (
PostgresConnectionPool,
PostgresPoolConfig,
)

config = PostgresPoolConfig(
host="localhost",
port=5432,
database="mydb",
user="postgres",
password="secret",
min_size=2,
max_size=10,
)

with PostgresConnectionPool(config) as pool:
with pool.get_connection() as conn:
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")
print(cursor.fetchall())
 

Redis

 
from db_connections.scr.all_db_connectors.connectors.redis import (
RedisSyncConnectionPool,
RedisPoolConfig,
)

config = RedisPoolConfig(host="localhost", port=6379, db=0)

with RedisSyncConnectionPool(config) as pool:
with pool.get_connection() as conn:
conn.set("key", "value")
print(conn.get("key"))
 

MongoDB

 
from db_connections.scr.all_db_connectors.connectors.mongodb import (
MongoSyncConnectionPool,
MongoPoolConfig,
)

config = MongoPoolConfig(host="localhost", port=27017, database="mydb")

with MongoSyncConnectionPool(config) as pool:
with pool.get_connection() as client:
db = client[config.database]
print(db.users.find_one())
 

Async Example (PostgreSQL)

 
from db_connections.scr.all_db_connectors.connectors.postgres import (
AsyncPostgresConnectionPool,
PostgresPoolConfig,
)

config = PostgresPoolConfig.from_env()

async with AsyncPostgresConnectionPool(config) as pool:
async with pool.get_connection() as conn:
results = await conn.fetch("SELECT * FROM users")
 

Supported Databases

  • PostgreSQL — psycopg2 / asyncpg
  • Redis — redis / redis[hiredis]
  • MongoDB — pymongo / motor
  • ClickHouse — clickhouse-connect
  • RabbitMQ — pika / aio-pika
  • Neo4j — neo4j driver

Each connector includes a dedicated setup guide inside the repository.


Core Capabilities

🔄 Connection Pooling

  • Min/max pool configuration
  • Automatic reuse and cleanup
  • Thread-safe and async-safe implementations

🏥 Health Checks

  • Pool state monitoring
  • Database responsiveness checks
  • Response time tracking

📊 Metrics

  • Active vs idle connections
  • Wait time statistics
  • Connection lifecycle tracking

Framework Integration

FastAPI Example

 
@app.on_event("startup")
async def startup():
config = PostgresPoolConfig.from_env()
app.state.db_pool = AsyncPostgresConnectionPool(config)
await app.state.db_pool.initialize_pool()
 

Configuration Options

Supports multiple configuration styles:

  • Environment variables
  • DSN / connection strings
  • URI-based configuration
  • SSL/TLS and timeout settings

Why This Library?

Modern backend systems often rely on multiple databases simultaneously. This library simplifies that complexity by providing:

  • A unified API across all databases
  • Consistent async/sync behavior
  • Production-grade pooling and monitoring
  • Strong typing for safer development

It is especially useful for microservices architectures and AI agent systems that require reliable multi-database access.


License

MIT License

Python

Python Type Hinting for Modern Python AI Agents

Overview

Python Type Hinting for Modern Python AI Agents is a structured guide to mastering Python’s type system, with a strong focus on real-world applications in modern AI agent development.

As Python continues to evolve into a core language for AI systems, type hints have become essential for writing reliable, maintainable, and scalable code. This repository explores Python’s typing features in depth—from foundational concepts to advanced type-level programming techniques.

Why This Guide?

Type hints are more than just annotations—they are a powerful tool for:

  • Improving code clarity and readability
  • Enabling better IDE support and autocompletion
  • Reducing runtime bugs through static analysis
  • Building robust AI agents and complex systems with confidence

This guide is designed to help developers move from basic usage to advanced type-safe design patterns used in production-grade Python systems.

What You Will Learn

The content is organized into two progressive levels:

Level 1: Foundational & Frequently Used Types

You will learn the core building blocks of Python’s type system, including:

  • Primitive types: int, float, str, bool, bytes, complex, None
  • Collections: list, dict, tuple, set, frozenset
  • Core utilities: Union, Optional, Any, Literal, Callable, Annotated, Final, ClassVar, Type
  • Common interfaces: Iterable, Iterator, Sequence, Mapping, MutableMapping, Collection, Container, Sized

Level 2: Intermediate & Advanced Usage

This section focuses on more expressive and powerful typing tools:

  • Structured data: TypedDict, NamedTuple, TypeAlias, LiteralString
  • Async & concurrency types: Awaitable, Coroutine, AsyncIterator, AsyncIterable, AsyncContextManager
  • Advanced interfaces: ContextManager, Reversible, Hashable, SupportsInt, Generator
  • Callable enhancements: overloaded callables, parameterized signatures, and advanced Callable patterns
  • Type-level utilities: TypeGuard, NewType, cast, overload, assert_type, assert_never, reveal_type

Focus on AI Agent Development

Unlike generic typing references, this guide emphasizes how type hints are used in modern AI systems, including:

  • Designing strongly-typed agent interfaces
  • Structuring tool-calling systems safely
  • Improving LLM-driven pipelines with type guarantees
  • Building scalable, composable agent architectures

Purpose of This Repository

The goal of this project is to bridge the gap between Python’s typing system and real-world AI engineering. It is intended to help developers write code that is not only functional, but also safe, explicit, and production-ready.

Whether you are building simple automation scripts or complex AI agents, mastering type hints will significantly improve your code quality and system reliability.

Python
★ 17

Overview

Easy LLM is a high-level machine learning framework designed to simplify the process of training traditional machine learning models. It provides a unified API that allows users to train, evaluate, and tune a wide range of models without writing complex code.

With Easy LLM, machine learning becomes accessible, fast, and highly flexible—removing the need for boilerplate code and allowing users to focus entirely on experimentation and results.


Key Idea

Instead of manually writing training pipelines, preprocessing steps, and hyperparameter tuning logic, Easy LLM enables you to:

  • Train multiple ML models with a single API call
  • Experiment with a wide range of hyperparameters
  • Switch between models effortlessly
  • Run end-to-end ML workflows without boilerplate code

Features

  • 🚀 No-Code / Low-Code Training Interface
    Train machine learning models using simple API calls.
  • 🤖 Multiple ML Algorithms Support
    Easily experiment with various traditional ML models.
  • ⚙️ Hyperparameter Flexibility
    Extensive configuration options for tuning model performance.
  • 🔄 Unified Workflow
    Consistent interface across different model types.
  • 📊 Fast Experimentation
    Quickly compare models and configurations.
  • 🧠 Designed for Simplicity
    Built to reduce complexity in machine learning development.

What You Can Do

With Easy LLM, you can:

  • Train multiple machine learning models without writing training loops
  • Perform hyperparameter tuning through configuration instead of code
  • Compare model performance easily
  • Rapidly prototype ML solutions
  • Focus on data and insights instead of implementation details

Philosophy

Machine learning should not be complex to use.
Easy LLM is built on the idea that powerful ML systems should be accessible through simple, clean interfaces.

Whether you're a beginner exploring ML or an experienced engineer building prototypes, Easy LLM helps you move faster with less effort.


Use Case Examples

  • Rapid ML prototyping
  • Educational environments and teaching ML
  • Automated model benchmarking
  • Lightweight production experimentation pipelines
  • AI-assisted workflow development

Python