Skip to content

M4-C2: PyO3 config bindings — load_config, TendConfig, RepoConfig #29

Description

@hartsock

Summary

Expose config types and the cascade loader to Python via PyO3.

Blocked By

New Python-visible types and functions

class ConflictStrategy:   # str enum
    HALT = "halt"
    BRANCH = "branch"
    STASH = "stash"
    OVERWRITE = "overwrite"
    SKIP = "skip"
    REBASE = "rebase"
    STASH_REBASE = "stash-rebase"

class RepoConfig:
    path: str
    profiles: list[str]
    on_conflict: ConflictStrategy | None

class TendConfig:
    repos: list[RepoConfig]
    profiles: dict[str, list[str]]
    defaults_on_conflict: ConflictStrategy
    defaults_commit_message: str

def load_config(path: str | os.PathLike) -> TendConfig
def resolve_config(cwd: str | os.PathLike | None = None) -> TendConfig

Modified Files

  • src/python.rs — add #[pyclass] for ConflictStrategy, RepoConfig, TendConfig; add #[pyfunction] for load_config, resolve_config
  • python/gitxtend/__init__.py — re-export new types and functions
  • python/gitxtend/__init__.pyi — typed stubs

Acceptance Criteria

import gitxtend
cfg = gitxtend.load_config("~/.gitxtend")
assert isinstance(cfg, gitxtend.TendConfig)
assert len(cfg.repos) > 0
cfg2 = gitxtend.resolve_config()  # reads cascade from CWD
  • mypy python/gitxtend/__init__.pyi — zero errors on new stubs

Beaver (MacBook agent, Claude Sonnet 4.6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    milestone:M4Config + CLI (v0.4.0)pyo3PyO3 bindingspythonPython implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions