A comprehensive collection of production-ready Python utility functions designed to streamline daily development tasks. This library focuses on performance, type safety, and reducing boilerplate code across your data processing and system automation scripts.
- Robust File Handling: Simplify common IO operations with context-aware helpers for safe file reading, directory synchronization, and automated cleanup.
- Data Validation Engine: High-performance decorators for schema validation and type-checking, ensuring data integrity before processing.
- Enhanced Logging Wrapper: An easy-to-configure logging interface that supports rotating file handlers and structured JSON output for seamless integration with observability stacks.
- Concurrency Helpers: Simplified abstractions for multi-threading and asynchronous task queues, minimizing race conditions in resource-heavy environments.
Install the package directly via pip:
pip install python-utils-61For development installations including test dependencies:
git clone https://github.com/Developer/python-utils-61.git
cd python-utils-61
pip install -e .Quickly incorporate robust logging and data validation into your project:
from python_utils_61.logger import setup_logger
from python_utils_61.validation import validate_schema
# Initialize structured logging
logger = setup_logger("my_app", level="INFO")
# Define a simple validation schema
schema = {"id": int, "name": str}
data = {"id": 1, "name": "Task-01"}
if validate_schema(data, schema):
logger.info("Data validated successfully.")
else:
logger.error("Validation failed for input.")Contributions are welcome! Please ensure all new utility modules include comprehensive type hinting and corresponding test cases in the tests/ directory.
This project is licensed under the MIT License - see the LICENSE file for details.