A comprehensive collection of production-ready Python utility functions designed to streamline daily development workflows. This library minimizes boilerplate code by providing robust, tested helpers for string manipulation, file system operations, and data validation.
- Robust Path Management: Simplifies recursive directory traversal and file sanitization with cross-platform compatibility.
- Data Transformation: High-performance helpers for nested dictionary flattening and JSON-to-YAML schema conversion.
- Time Utilities: Simplified formatting for human-readable durations and ISO 8601 timestamp synchronization.
- Safety Wrappers: Decorators for automated retry logic and exception handling in network-heavy operations.
Install the package directly via pip:
pip install python-utils-61For development mode, clone the repository and install requirements:
git clone https://github.com/developer/python-utils-61.git
cd python-utils-61
pip install -r requirements.txtThe library is designed with a flat import structure for quick integration into existing scripts.
from pyutils import file_ops, text_format
# Recursively fetch all .log files
logs = file_ops.find_files(path="./logs", extension=".log")
# Sanitize input strings for safe database entry
clean_string = text_format.sanitize(" Hello, World! @2023 ")
print(f"Found {len(logs)} log files. Cleaned string: {clean_string}")Distributed under the MIT License. See LICENSE for more information.