A collection of Python utilities and tools for common development tasks.
- S3 Object Cleanup: Delete S3 objects older than a specific date with support for dry-run mode and prefix filtering
- JSON Logging Configuration: Pre-configured logging setup with JSON formatting
- Sensitive Data Filtering: Automatically filter sensitive information from logs (passwords, API keys, tokens, etc.)
We strongly recommend using a virtual environment to manage dependencies. Virtual environments:
- Isolate project dependencies from your system Python and other projects
- Prevent version conflicts between different projects requiring different package versions
- Make your project reproducible by keeping dependencies self-contained
- Simplify dependency management without affecting your global Python installation
Create and activate a virtual environment:
# Create virtual environment
python -m venv venv
# Activate on Windows
venv\Scripts\activate
# Activate on macOS/Linux
source venv/bin/activateOnce your virtual environment is activated, install the required dependencies:
pip install -r requirements.txtDelete objects from an S3 bucket that are older than a specified date:
python aws/s3/delete_old_s3_objects.py --bucket my-bucket --date 2024-01-01With prefix and dry-run mode:
python aws/s3/delete_old_s3_objects.py --bucket my-bucket --prefix folder/ --date 2024-06-15 --dry-runUse the pre-configured logging setup in your Python projects:
from logging.config import dictConfig
from logging_config import LOGGING
dictConfig(LOGGING)This project uses Black for code formatting. Black is an opinionated code formatter that:
- Enforces consistent code style across the entire project
- Eliminates debates about formatting preferences in code reviews
- Saves time by automatically formatting code instead of manual styling
- Improves readability with a uniform, predictable format
- Reduces git diffs by maintaining consistent formatting across commits
Format a single file:
black path/to/file.pyFormat the entire project:
black .Check what would be reformatted without making changes:
black --check .See LICENSE file for details.