Enhance repo organization and structure#1
Merged
hoangsonww merged 2 commits intomainfrom Nov 14, 2025
Merged
Conversation
This commit comprehensively reorganizes and enhances the entire weather-cli repository with professional Python package structure and modern development practices. Major Changes: Project Structure: - Created proper Python package structure (weather_cli/) - Separated concerns into modular components (cli.py, config.py, weather.py) - Added __init__.py and __main__.py for proper package installation - Removed monolithic main.py in favor of modular architecture Code Quality Improvements: - Added comprehensive type hints throughout the codebase - Implemented proper error handling and validation - Added context manager support for HTTP client - Improved CLI with argparse for better argument handling - Added support for environment variables and .env files - Enhanced weather data display with more information Testing Infrastructure: - Created comprehensive test suite with pytest - Added tests for all modules (test_cli.py, test_config.py, test_weather.py) - Configured pytest with coverage reporting - Mocked external API calls for reliable testing Documentation: - Created comprehensive README.md with installation and usage instructions - Added CONTRIBUTING.md with development guidelines - Added CHANGELOG.md for version tracking - Created .env.example for configuration template - Added inline docstrings following Google style Configuration Files: - Added pyproject.toml for modern Python packaging - Created requirements.txt for production dependencies - Created requirements-dev.txt for development dependencies - Added setup.py for backward compatibility - Configured code quality tools (.flake8, black, isort, mypy) Development Tools: - Added Makefile with common development tasks - Configured GitHub Actions CI/CD pipeline - Added support for multiple Python versions (3.7-3.12) - Cross-platform testing (Linux, macOS, Windows) - Security scanning with bandit and safety Additional Features: - Support for multiple temperature units (metric, imperial, standard) - Detailed weather information (humidity, pressure, wind speed, cloudiness) - User-friendly error messages - Proper timeout handling for API requests - Clean separation of configuration and business logic This reorganization transforms the project from a simple script into a professional, maintainable Python package ready for distribution.
This commit adds significant enhancements to make weather-cli a feature-rich, professional-grade CLI application with modern development practices and extensive tooling support. New Features: Colorized Output with Rich: - Added Rich library for beautiful terminal output - Implemented rich formatting with colors, tables, and panels - Temperature-based color coding (blue for cold, yellow for warm, red for hot) - Enhanced user experience with emoji indicators - Added formatter module (weather_cli/formatter.py) Multiple Output Formats: - JSON output format for programmatic usage - Plain text output for scripting - Rich/colorized output (default) - --format flag to choose output type - --no-color flag for plain output Examples Directory: - basic_usage.py - Demonstrates programmatic usage for multiple cities - json_export.py - Export weather data to timestamped JSON files - temperature_comparison.py - Compare temperatures across cities with rich tables - Comprehensive examples README with usage instructions Docker Support: - Multi-stage Dockerfile for optimal image size (~150-200MB) - docker-compose.yml with multiple service profiles - .dockerignore for efficient builds - Non-root user for security - Comprehensive Docker usage guide in docker/README.md - Support for environment variables and volume mounting Community and Contribution: - CODE_OF_CONDUCT.md (Contributor Covenant 2.0) - GitHub issue templates (bug report, feature request, question) - Pull request template with comprehensive checklist - Issue template configuration Development Environment: VS Code Configuration: - settings.json with Python development best practices - launch.json with debug configurations for various scenarios - tasks.json with common development tasks - extensions.json with recommended VS Code extensions - Auto-formatting, linting, and testing integration Pre-commit Hooks: - .pre-commit-config.yaml with comprehensive hooks - Code formatting (Black, isort) - Linting (flake8, mypy) - Security checks (bandit, safety) - Docstring coverage (interrogate) - Syntax upgrades (pyupgrade) - General file checks (trailing whitespace, YAML/JSON validation) Updated Dependencies: - Added rich>=13.7.0 for terminal formatting - Added click>=8.1.0 for enhanced CLI support - Added bandit for security scanning - Added safety for dependency vulnerability checks - Added pre-commit for automated code quality checks - Updated pyproject.toml with all new dependencies Enhanced CLI: - --format flag (rich, plain, json) - --no-color flag for disabling colors - Improved error messages with rich formatting - Better user guidance for configuration issues This commit transforms the project into a production-ready application with comprehensive tooling for development, testing, and deployment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.