Development Setup Summaryο
This document summarizes the development tools and configuration that have been added to the SMW Reader project.
β Whatβs Workingο
Core Development Toolsο
duties.py - Comprehensive development task runner using
dutyTaskfile.yaml - Convenient wrapper around duties for use with Task runner
ruff.toml - Code formatting and linting configuration
mypy.ini - Type checking configuration (available for manual use)
.pre-commit-config.yaml - Git hooks for automated quality checks
Updated pyproject.toml - Added comprehensive dev dependencies
Pre-commit Hooks (Active)ο
β Trailing whitespace removal
β End of file fixes
β YAML/TOML/JSON validation
β Merge conflict detection
β Large file detection
β Ruff linting (with security checks properly configured)
β Ruff formatting (automated code formatting)
Available Tasksο
Using Task (recommended):ο
task format # Format code with ruff
task lint # Run linting
task test # Run tests
task type-check # Run mypy (manual use)
task security # Run bandit (manual use)
task build # Build package
task clean # Clean artifacts
task check # Run all checks
task ci # Run CI pipeline
Using Duty directly:ο
uv run python -m duty format
uv run python -m duty test
uv run python -m duty check_all
π§ Temporarily Disabled (but available manually)ο
MyPy Type Checkingο
Status: Disabled in pre-commit due to existing type annotation issues
Manual use:
task type-checkoruv run python -m duty type_checkIssues: 6 type annotation errors in source code that need to be addressed
Bandit Security Scanningο
Status: Disabled in pre-commit due to false positives with urllib usage
Manual use:
task securityoruv run python -m duty securityIssues: Reports expected urllib.request.urlopen usage as security concern
π οΈ Configuration Files Createdο
duties.py- Task definitions for development workflowsTaskfile.yaml- Task runner wrapper for convenient CLI usageruff.toml- Linting and formatting rules (100 char line length)mypy.ini- Type checking configuration (strict mode).pre-commit-config.yaml- Git hooks configuration.bandit- Security scanning configuration
π Getting Startedο
First Time Setupο
# Install all development dependencies
task dev-setup
# Or manually:
uv sync --all-extras
uv run pre-commit install
Daily Development Workflowο
# Format and check code
task format
task lint
task test
# Or run all checks at once
task check
# Before committing (runs automatically with pre-commit)
task ci
π Future Tasksο
To fully enable type checking:ο
Fix the 6 MyPy errors in source files:
src/smw_reader/exceptions.py:11- Add type parameters for dictsrc/smw_reader/http_client.py:111- Fix Any return typesrc/smw_reader/endpoints/ask.py- Fix string to int assignment issuessrc/smw_reader/__init__.py:48- Add function type annotation
Re-enable MyPy in
.pre-commit-config.yaml
To enable security scanning:ο
Review and document urllib usage in HTTP client as safe
Configure bandit to allow expected urllib patterns
Re-enable bandit in
.pre-commit-config.yaml
π― Benefits Achievedο
Automated Code Quality: Pre-commit hooks ensure consistent formatting and catch issues early
Easy Task Management: Simple commands for common development tasks
Flexible Architecture: Can use either Task or Duty directly based on preference
Comprehensive Testing: Full test suite with coverage options
Modern Python Practices: Follows best practices outlined in AGENTS.md
Developer Experience: Quick setup and intuitive commands
The development environment is now ready for productive Python development with modern tooling and quality assurance measures in place.