Coverage for / home / runner / work / bijux-cli / bijux-cli / src / bijux_cli / services / config / contracts.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-26 17:59 +0000
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-26 17:59 +0000
1# SPDX-License-Identifier: Apache-2.0
2# Copyright © 2025 Bijan Mousavi
4"""Defines the contract for the application configuration service."""
6from __future__ import annotations
8from pathlib import Path
9from typing import Any, Protocol, runtime_checkable
12@runtime_checkable
13class ConfigProtocol(Protocol):
14 """Defines the contract for application configuration management."""
16 def load(self, path: str | Path | None = None) -> None:
17 """Load configuration from a file path."""
18 ...
20 def reload(self) -> None:
21 """Reload configuration from the last loaded path."""
22 ...
24 def get(self, key: str, default: Any = None) -> Any:
25 """Retrieve a configuration value."""
26 ...
28 def set(self, key: str, value: Any) -> None:
29 """Set a configuration value."""
30 ...
32 def unset(self, key: str) -> None:
33 """Remove a configuration key."""
34 ...
36 def clear(self) -> None:
37 """Clear all configuration values."""
38 ...
40 def all(self) -> dict[str, str]:
41 """Return all configuration values."""
42 ...
44 def list_keys(self) -> list[str]:
45 """List configuration keys."""
46 ...
48 def export(self, path: str | Path, out_format: str | None = None) -> None:
49 """Export configuration to a target path."""
50 ...
52 def save(self) -> None:
53 """Persist configuration to disk."""
54 ...
57__all__ = ["ConfigProtocol"]