Thank you for your interest in contributing to the CloudFront Image Upload Utility! This document provides guidelines and information for contributors.
This project is a comprehensive tool for downloading, optimizing, and uploading images to AWS S3 with CloudFront distribution, featuring AI-powered alt text generation. Created by Cagri Sarigoz, it's designed to help developers and content creators optimize their image workflows.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Issue Reporting
- Feature Requests
- Community
This project adheres to a code of conduct that we expect all contributors to follow:
- Be respectful: Treat everyone with respect and kindness
- Be inclusive: Welcome newcomers and help them get started
- Be collaborative: Work together to improve the project
- Be constructive: Provide helpful feedback and suggestions
- Be patient: Remember that everyone has different skill levels
- Python 3.9+ (Recommended: Python 3.13)
- Git
- AWS account (for testing S3/CloudFront features)
- AltText.ai API key (optional, for alt text features)
-
Fork the repository
# Click the "Fork" button on GitHub -
Clone your fork
git clone https://github.com/YOUR_USERNAME/image-optimization.git cd image-optimization -
Set up the development environment
# Create virtual environment (recommended) python3.13 -m venv venv source venv/bin/activate # Linux/macOS # or venv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt # Run setup script python setup.py # Copy environment template cp env.example .env # Edit .env with your credentials
-
Add upstream remote
git remote add upstream https://github.com/csarigoz/image-optimization.git
For the best development experience, we recommend using Python 3.13 with a virtual environment:
macOS (using Homebrew):
brew install python@3.13Ubuntu/Debian:
sudo apt update
sudo apt install python3.13 python3.13-venv python3.13-pipWindows: Download from python.org or use Windows Store.
# Create virtual environment
python3.13 -m venv venv
# Activate virtual environment
source venv/bin/activate # Linux/macOS
# or
venv\Scripts\activate # Windows
# Verify Python version
python --version # Should show Python 3.13.x
# Upgrade pip
python -m pip install --upgrade pip
# Install dependencies
pip install -r requirements.txt
# Install development tools
pip install flake8 black isort mypy bandit safety-
Create
.envfile (never commit this):# AWS Configuration (Required for testing) AWS_ACCESS_KEY=your_aws_access_key AWS_SECRET_KEY=your_aws_secret_key S3_BUCKET=your_test_bucket CLOUDFRONT_DOMAIN=your_test_domain # AltText.ai Configuration (Optional) ALTTEXT_AI_API_KEY=your_api_key ALTTEXT_AI_KEYWORDS=test,development
-
Test your setup:
# Test basic functionality python upload_files.py # Test AltText.ai integration (if configured) python alttext_ai.py # Test CSV processing ./process_csv.sh
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following our coding standards
-
Test thoroughly:
# Test core functionality python upload_files.py # Test with sample images ./process_csv.sh # Test API endpoints export FLASK_RUN=1 python upload_files.py
-
Run code quality checks:
# Format code black . isort . # Lint code flake8 . # Security check bandit -r . # Check dependencies safety check
-
Commit with clear messages:
git add . git commit -m "feat: add new image format support"
We welcome various types of contributions:
- 🐛 Bug fixes: Fix issues and improve stability
- ✨ New features: Add new functionality
- 📚 Documentation: Improve docs, examples, and guides
- 🎨 UI/UX improvements: Enhance user experience
- ⚡ Performance: Optimize code and processes
- 🧪 Testing: Add tests and improve coverage
- 🔧 Tooling: Improve development tools and workflows
- Image format support: Add support for new formats (AVIF, HEIF, etc.)
- Performance optimization: Improve processing speed and memory usage
- Error handling: Better error messages and recovery
- Testing: Add comprehensive test suite
- Documentation: Improve examples and tutorials
- API enhancements: New endpoints and features
- Configuration options: More customization options
- Monitoring: Add metrics and logging
- Security: Improve security practices
- UI improvements: Better CLI interface
- Integration: Support for other cloud providers
- Automation: Additional workflow automations
- Check existing issues: Look for related issues or discussions
- Follow coding standards: Ensure your code follows our guidelines
- Test thoroughly: Test your changes with various scenarios
- Update documentation: Update relevant docs and examples
- Write clear commit messages: Use conventional commit format
-
Create a clear title:
feat: add WebP optimization support fix: resolve S3 upload timeout issues docs: improve installation instructions -
Provide detailed description:
## Description Brief description of changes ## Changes Made - List of specific changes - Any breaking changes ## Testing - How you tested the changes - Test cases covered ## Screenshots (if applicable) - Before/after screenshots
-
Link related issues:
Fixes #123 Relates to #456
- Automated checks: CI/CD will run automated tests
- Code review: Maintainers will review your code
- Feedback: Address any feedback or requested changes
- Approval: Once approved, your PR will be merged
Follow the guidelines in PROJECT_RULES.md:
- PEP 8: Follow Python style guidelines
- Type hints: Use type hints where appropriate
- Docstrings: Document all functions and classes
- Error handling: Use consistent error patterns
- Logging: Use emoji prefixes for clarity
We use several tools to maintain code quality:
# Format code with Black
black .
# Sort imports with isort
isort .
# Lint with flake8
flake8 . --max-line-length=127 --extend-ignore=E203,W503
# Type checking with mypy
mypy . --ignore-missing-imports
# Security scanning with bandit
bandit -r .
# Dependency vulnerability check
safety checkdef optimize_image(image_path: str, max_width: Optional[int] = None,
quality: int = 82, smart_format: bool = True) -> Tuple[bool, str]:
"""
Optimize an image by resizing, adjusting quality, and choosing the best format
Args:
image_path: Path to the image file
max_width: Maximum width for resizing (None = no resizing)
quality: JPEG/WebP quality (1-100)
smart_format: Enable smart format selection
Returns:
Tuple of (success: bool, optimized_path: str)
Raises:
FileNotFoundError: If image file doesn't exist
ValueError: If quality is not in valid range
"""
try:
# Implementation here
print(f"✅ Image optimized successfully: {image_path}")
return True, optimized_path
except Exception as e:
print(f"❌ Failed to optimize image: {e}")
return False, image_pathTest your changes with:
# Test with different Python versions (if available)
python3.9 upload_files.py
python3.10 upload_files.py
python3.11 upload_files.py
python3.12 upload_files.py
python3.13 upload_files.py
# Core functionality
python upload_files.py
# CSV processing
./process_csv.sh
# API endpoints
export FLASK_RUN=1
python upload_files.py
curl -X POST -F "file=@test.jpg" http://localhost:5000/upload
# AltText.ai integration
python alttext_ai.py https://example.com/test.jpg- Image formats: JPEG, PNG, WebP, GIF
- Various sizes: Small, medium, large images
- Error scenarios: Invalid files, network issues, API failures
- Configuration: Different quality settings, max width values
- Alt text: With and without keywords
- Python versions: Test on supported versions (3.9-3.13)
We're working on adding automated testing. Contributions to testing infrastructure are highly welcome!
- Clear examples: Provide working code examples
- Step-by-step guides: Break down complex processes
- Screenshots: Include visual aids where helpful
- Keep updated: Update docs when making changes
- API reference: Complete endpoint documentation
- Tutorials: Step-by-step guides for common use cases
- Troubleshooting: Common issues and solutions
- Examples: Real-world usage examples
- Search existing issues: Check if the issue already exists
- Check documentation: Review README and troubleshooting guides
- Test with latest version: Ensure you're using the latest code
**Bug Description**
Clear description of the bug
**Steps to Reproduce**
1. Step one
2. Step two
3. Step three
**Expected Behavior**
What should happen
**Actual Behavior**
What actually happens
**Environment**
- OS: [e.g., macOS 12.0]
- Python version: [e.g., 3.13.0]
- Project version: [e.g., latest main branch]
**Additional Context**
- Error messages
- Screenshots
- Configuration details (without sensitive info)**Feature Description**
Clear description of the proposed feature
**Use Case**
Why is this feature needed? What problem does it solve?
**Proposed Solution**
How should this feature work?
**Alternatives Considered**
Other solutions you've considered
**Additional Context**
- Examples from other tools
- Implementation ideas
- Potential challenges- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Documentation: Check README and project docs first
Contributors will be recognized in:
- README.md: Contributors section
- Release notes: Major contributions highlighted
- GitHub: Contributor badges and stats
- Cagri Sarigoz (@cagrisarigoz) - Creator and Lead Maintainer
By contributing to this project, you agree that your contributions will be licensed under the MIT License. See LICENSE for details.
Thank you for contributing to the CloudFront Image Upload Utility! Your contributions help make this tool better for everyone.
Questions? Feel free to open an issue or start a discussion. We're here to help!