Skip to content

Latest commit

 

History

History
283 lines (209 loc) · 6.55 KB

File metadata and controls

283 lines (209 loc) · 6.55 KB

v0.2.0 Quick Start Guide

🎯 Immediate Action Items for v0.2.0 Release

Quick Wins (Can implement in 1-2 days)

1. Public API Exports (__init__.py) - 30 minutes

Currently, users must import from specific modules:

# Current (v0.1.0)
from sqlmodel_crud_utils.sync import get_row, update_row
from sqlmodel_crud_utils.a_sync import get_row as a_get_row

Should allow:

# Proposed (v0.2.0)
from sqlmodel_crud_utils import get_row, update_row, a_get_row

Implementation: Update sqlmodel_crud_utils/__init__.py with exports.


2. CHANGELOG.md - 15 minutes

Create a changelog file tracking v0.1.0 → v0.2.0 changes.

Implementation: Create CHANGELOG.md with standard format.


3. Version Bump - 5 minutes

Update version from 0.1.0 → 0.2.0 in pyproject.toml.


4. Enhanced Type Hints - 1 hour

Add generic TypeVars for better IDE support:

from typing import TypeVar

T = TypeVar('T', bound=SQLModel)

def get_row(
    id_str: str | int,
    session_inst: Session,
    model: type[T],
    ...
) -> tuple[bool, T | None]:
    ...

High-Value Features (1-3 days each)

5. Custom Exception Hierarchy - 1 day

Impact: Better error handling for users. Effort: Low Files: Create sqlmodel_crud_utils/exceptions.py

Key exceptions:

  • RecordNotFoundError
  • MultipleRecordsError
  • BulkOperationError

Backward Compatible: Add raise_on_error=False parameter (default).


6. Transaction Context Managers - 1 day

Impact: Safer transaction handling. Effort: Low Files: Create sqlmodel_crud_utils/transactions.py

# Usage
with transaction(session) as tx:
    write_row(data, tx)
    update_row(id, data, tx)
    # Auto-commits on success, rolls back on error

7. Audit Trail Mixins - 2 days

Impact: Very high (common requirement). Effort: Medium Files: Create sqlmodel_crud_utils/mixins.py

class MyModel(SQLModel, AuditMixin, table=True):
    id: int = Field(primary_key=True)
    name: str
    # Automatically adds: created_at, updated_at, created_by, updated_by

8. Soft Delete Support - 2 days

Impact: High (common requirement). Effort: Medium

class MyModel(SQLModel, SoftDeleteMixin, table=True):
    id: int = Field(primary_key=True)
    name: str
    # Automatically adds: deleted_at, deleted_by, is_deleted

# Usage
model.soft_delete(user="admin")
model.restore()

Modification: Update get_rows() to exclude soft-deleted by default.


Medium Priority (3-5 days)

9. Lifecycle Hooks - 3 days

Allow users to inject logic before/after operations:

register_hook(MyModel, MyHook())

# Hooks called automatically:
# - before_create, after_create
# - before_update, after_update
# - before_delete, after_delete

10. Enhanced Documentation - 5 days

  • Comprehensive docstrings
  • Usage examples for each function
  • Migration guide (v0.1.0 → v0.2.0)
  • Troubleshooting guide

📋 Recommended Implementation Order

Phase 1: Quick Wins (Day 1)

  1. ✅ Type checking fixes (DONE)
  2. Public API exports
  3. CHANGELOG.md
  4. Version bump to 0.2.0
  5. Enhanced type hints

Output: Immediately usable v0.2.0-alpha


Phase 2: Core Features (Days 2-4)

  1. Custom exception hierarchy
  2. Transaction context managers
  3. Audit trail mixins
  4. Soft delete support

Output: v0.2.0-beta with production-ready features


Phase 3: Polish (Days 5-7)

  1. Lifecycle hooks
  2. Enhanced documentation
  3. Complete test coverage for new features
  4. Migration guide

Output: v0.2.0-rc1 (release candidate)


Phase 4: Release (Day 8)

  1. Final testing
  2. Update README
  3. PyPI release
  4. GitHub release notes
  5. Announce on discussions

Output: v0.2.0 stable release


🔍 What NOT to Include in v0.2.0

To keep scope manageable, defer these to v0.3.0:

  • ❌ Query Builder (complex, needs more design)
  • ❌ Caching Layer (needs external dependencies)
  • ❌ Change Tracking (complex feature)
  • ❌ Migration Utilities (out of scope)
  • ❌ GraphQL Support (different domain)

📊 Comparison: v0.1.0 vs v0.2.0

Feature v0.1.0 v0.2.0
CRUD Operations
Sync/Async
Type Checking ⚠️
Public API
Exceptions Basic Custom Hierarchy
Transactions Manual Context Managers
Audit Trail ✅ Mixins
Soft Deletes
Hooks
CHANGELOG
Documentation Basic Comprehensive

🎯 Success Metrics

Code Quality

  • ✅ 100% test coverage (maintain)
  • ✅ Type checking passing
  • ✅ All pre-commit hooks passing
  • ✅ No regressions in existing functionality

User Experience

  • 📦 Easier imports (public API)
  • 🔧 Better error messages (custom exceptions)
  • 🛡️ Safer operations (transaction managers)
  • 📝 Production-ready features (audit, soft delete)

Adoption

  • 📈 Increase GitHub stars
  • 💬 Positive feedback on discussions
  • 🐛 Fewer bug reports
  • 📖 More comprehensive docs

💡 Quick Decision Matrix

Feature Effort Impact Priority Include in v0.2.0?
Public API Exports 🟢 Low 🔥 High P0 ✅ YES
CHANGELOG 🟢 Low 🔥 High P0 ✅ YES
Type Hints 🟢 Low 🔥 High P0 ✅ YES
Exceptions 🟡 Medium 🔥 High P1 ✅ YES
Transactions 🟡 Medium 🔥 High P1 ✅ YES
Audit Mixins 🟡 Medium 🔥 High P1 ✅ YES
Soft Deletes 🟡 Medium 🔥 High P1 ✅ YES
Hooks 🟡 Medium 🟡 Medium P2 ⚠️ MAYBE
Documentation 🔴 High 🔥 High P1 ✅ YES
Query Builder 🔴 High 🟡 Medium P3 ❌ NO (v0.3.0)
Caching 🔴 High 🟡 Medium P3 ❌ NO (v0.3.0)

🚀 Getting Started

For Reviewers

Read v0.2.0_ENHANCEMENT_DESIGN.md for full details.

For Implementers

  1. Start with Phase 1 quick wins
  2. Ensure all tests pass after each change
  3. Maintain backward compatibility
  4. Document as you go

For Users

v0.2.0 will be 100% backward compatible with v0.1.0. No breaking changes!


📞 Questions?


Next Steps:

  1. Review both design documents
  2. Prioritize features based on your needs
  3. Start with Phase 1 quick wins
  4. Iterate and release!