Skip to content

v0.2.1

Choose a tag to compare

@psarno psarno released this 21 Oct 04:06
· 15 commits to main since this release

Overview

This release focuses on improving type safety, code quality, and maintainability through comprehensive refactoring. The CLI now uses Pydantic models throughout for better validation and type checking, with enhanced database interactions and improved presentation layer.

Breaking Changes

None - this is a backwards-compatible patch release.

New Features

Type-Safe Database Models

  • New db_types.py module with comprehensive Pydantic models for all database interactions
  • Type-safe row models: DebateRow, DebateMessageRow, JudgeDecisionRow, CriterionScoreRow, EnsembleSummaryRow
  • Enhanced models: DebateWithMessages, JudgeDecisionWithScores, TranscriptData
  • Custom exceptions: DatabaseError, DebateNotFoundError, JudgeDecisionNotFoundError, EnsembleSummaryNotFoundError

Improved Provider Detection

  • Auto-detection of model providers in list-models command
  • No longer requires manual provider specification for common models

Improvements

Type Safety

  • Migrated TypedDict classes to Pydantic models throughout codebase
  • Added strict type checking for all database operations
  • Improved type annotations across all modules
  • Better handling of optional fields with proper None checks

Database Layer (database.py)

  • Refactored to return Pydantic models instead of dictionaries
  • Type-safe constructors for all database operations
  • Improved error handling with specific exception types
  • Better separation of concerns with dedicated row types

Presentation Layer (presentation.py)

  • Refactored to work with Pydantic models
  • Improved dot-notation access for cleaner code
  • Enhanced serialization/deserialization for display
  • Better handling of ensemble summary data

Runner (runner.py)

  • Type-safe model handling throughout debate execution
  • Improved EnsembleResult integration from engine v0.3.1
  • Better error handling and validation
  • Cleaner async context management

Code Quality

  • Extracted magic numbers to named constants
  • Improved Click parameter naming for clarity
  • Simplified context managers
  • Better exception specificity
  • Consistent code formatting with Ruff

Testing

Enhanced Test Coverage

  • Updated all tests for Pydantic model assertions
  • Better test isolation with improved fixtures
  • More specific exception testing
  • Refactored test utilities for maintainability

Dependencies

Updated

  • dialectus-engine upgraded to >=0.3.1
    • Includes EnsembleResult improvements
    • Enhanced Pydantic type support
    • Better type safety across engine API

Developer Experience

Improved IDE Support

  • Better autocomplete with Pydantic models
  • Clearer type errors from Pyright
  • Enhanced documentation through type hints
  • More discoverable API surface

Code Organization

  • Clearer separation between data models and business logic
  • Better module organization with dedicated types file
  • More consistent naming conventions
  • Improved code documentation

Migration Notes

No migration required - existing databases continue to work unchanged. The new Pydantic models provide a type-safe layer over the existing SQLite schema.

Known Issues

None


For complete installation and usage instructions, see README.md.

For engine changes, see dialectus-engine v0.3.1 release notes.