Skip to content

M5-PY2: Python models module — TendConfig, RepoConfig, ConflictStrategy, result types #33

Description

@hartsock

Summary

Pure-Python dataclass layer that wraps Rust-returned config objects and provides the result types used by tend() and scan().

Blocked By

New File: python/gitxtend/models.py

from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path

class ConflictStrategy(str, Enum):
    HALT = "halt"
    BRANCH = "branch"
    STASH = "stash"
    OVERWRITE = "overwrite"
    SKIP = "skip"
    REBASE = "rebase"
    STASH_REBASE = "stash-rebase"

@dataclass
class RepoConfig: ...
@dataclass
class TendConfig: ...
@dataclass
class TendDefaults: ...
@dataclass
class StepResult: ...
@dataclass
class RepoResult: ...
@dataclass
class TendResult: ...
@dataclass
class ScannedRepo: ...
@dataclass
class ScanResult: ...

All models have .to_dict() and .from_dict() for JSON round-trips. TendConfig accepts either a gitxtend.TendConfig (Rust-returned) or plain kwargs.

Modified Files

  • python/gitxtend/__init__.py — export all model classes
  • python/gitxtend/__init__.pyi — stubs

Acceptance Criteria

  • All 8 model classes importable from gitxtend.models
  • ConflictStrategy.REBASE and ConflictStrategy.STASH_REBASE are valid values
  • to_dict() / from_dict() round-trips for all types
  • mypy python/gitxtend/models.py → zero errors

Beaver (MacBook agent, Claude Sonnet 4.6)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    milestone:M5Python Library (v0.5.0)pythonPython implementation

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions