A robust collection of high-performance utility functions designed to streamline daily Python development tasks. This library simplifies complex boilerplate code into efficient, clean, and reusable components.
- File System Helpers: Simplified recursive directory searching and file type filtering with built-in error handling.
- Performance Decorators: Ready-to-use
@timerand@retrydecorators to track execution time and handle transient network failures gracefully. - Data Validation: Lightweight schemas for validating configuration dictionaries and environment variables without heavy dependencies.
- String Sanitization: Optimized regex patterns for cleaning input, stripping whitespace, and normalizing file paths across different operating systems.
Install the package via pip:
pip install python-utils-98Alternatively, if you are working within a virtual environment, ensure your dependencies are updated:
pip install --upgrade python-utils-98Import specific modules to handle routine tasks efficiently. The following example demonstrates using the timer decorator to profile a function:
from python_utils_98.decorators import timer
from python_utils_98.files import list_files
# Use the timer to profile execution
@timer
def process_data():
files = list_files("./data", extension=".json")
return len(files)
count = process_data()
print(f"Processed {count} files.")- Python 3.8+
- No external dependencies; written in pure Python.
This project is licensed under the MIT License. See the LICENSE file for details.