Skip to content

Conversation

@vdavez
Copy link

@vdavez vdavez commented Jun 17, 2025

This PR represents a major modernization of the cw-tail project, migrating from traditional Python package management to UV, adding comprehensive test coverage, and improving project structure and configuration management.

🔧 Package Management & Build System Changes

  • Migrated to UV package manager: Added uv.lock and .python-version (3.12) files for modern Python dependency management
  • Removed legacy installation: Deleted install.sh script in favor of UV-based installation workflows
  • Enhanced pyproject.toml:
    • Added comprehensive tool configurations (pytest, coverage, black, ruff)
    • Added development dependencies (pytest, pytest-cov, black, ruff)
    • Set minimum coverage threshold (79%)
    • Configured linting and formatting standards

📝 Configuration Management Improvements

  • Moved config file: Relocated config.example.yml from cw_tail/ directory to project root for better discoverability
  • Enhanced configuration hierarchy: Implemented intelligent config file discovery:
    1. ./config.yml (project-specific, recommended for teams)
    2. ./.cw-tail.yml (project-specific, hidden file)
    3. ~/.config/cw-tail/config.yml (user-global fallback)
  • Expanded example configurations: Added staging, local, and more detailed environment-specific configs with regex highlighting examples

🧪 Comprehensive Test Suite Addition

Added tests with 79% code coverage:

  • test_cw_tail.py: Core CloudWatchTailer class functionality

    • Initialization and configuration parsing
    • Message formatting and highlighting
    • Log line formatting with color support
    • Boto3 integration and stream filtering
    • Header display and scroll functionality
  • test_utils.py: Utility function testing

    • Configuration loading from multiple sources
    • Command-line argument parsing
    • Time string parsing (1h, 15m, 10s formats)
    • Query string parsing and list chunking
  • test_main.py: CLI integration testing

    • Argument parsing and validation
    • Configuration merging (CLI args + config files)
    • Error handling and edge cases
  • test_formatters.py: JSON formatter testing

    • Key removal and filtering
    • Key-value pair parsing and formatting
    • Error handling for malformed JSON
  • test_colors.py: Color function testing

  • test_sleep.py: Interruptible sleep functionality

🎨 Code Quality & Modernization

  • Rich library integration: Enhanced terminal output with proper Text objects and color handling
  • Version handling: Dynamic version reading from pyproject.toml using tomllib
  • Improved error handling: Better exception handling and user feedback
  • Code formatting standards: Black and Ruff configuration for consistent code style

📚 Documentation Enhancements

  • Comprehensive README updates:
    • UV installation instructions with multiple options
    • Detailed configuration file hierarchy explanation
    • Project-specific vs personal configuration guidance
    • Enhanced development workflow documentation
    • Test coverage reporting and commands

🔍 Manual QA Recommendations for Reviewers

Configuration Testing:

# Test config file hierarchy
uv run cw-tail --config prod  # Should use ./config.yml
mv config.yml .cw-tail.yml
uv run cw-tail --config prod  # Should use ./.cw-tail.yml

Installation Testing:

# Test global tool installation
uv tool install .
cw-tail --help

# Test development installation  
uv sync
uv run cw-tail --help

Test Suite Verification:

# Run full test suite
uv run pytest -v

# Test coverage report
uv run pytest --cov=cw_tail --cov-report=term-missing

# Test specific components
uv run pytest tests/test_utils.py -v
uv run pytest tests/test_cw_tail.py::TestCloudWatchTailer::test_init_basic -v

Configuration Merging:

# Test CLI arg override of config values
uv run cw-tail --config dev --since 30m --region us-west-2

⚠️ Breaking Changes

  • Installation method changed: Users must migrate from install.sh to UV-based installation
  • Config file location: Teams using cw_tail/config.example.yml need to move to config.yml in project root
  • Python version requirement: Now explicitly requires Python 3.12+

Areas for potential additional testing:

  • Live AWS CloudWatch integration (currently mocked)
  • Terminal scrolling behavior across different terminal types
  • Large log volume performance testing

- Migrate from traditional pip/setuptools to UV for modern Python package management
- Add comprehensive test suite with 89 tests achieving 74% code coverage
- Implement intelligent configuration file hierarchy (project -> hidden -> global)
- Move config.example.yml to project root for better team collaboration
- Add development dependencies and tooling (pytest, black, ruff, coverage)
- Enhance README with UV installation instructions and testing guidance
- Modernize code with Rich library integration and improved error handling
- Remove legacy install.sh in favor of UV-based workflows
- Require Python 3.12+ with explicit version specification

BREAKING CHANGE: Installation method changed from install.sh to UV-based installation.
Users must run `uv tool install .` or `uv sync` for development setup.
@vdavez vdavez requested a review from infinityplusone June 17, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants