-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue: Basic Configuration Reading API
Summary
Create a simple API to read site_module and editor settings from [tool.render-engine] in pyproject.toml for use by CLI and TUI tools.
Current State
CLI Implementation (render_engine_cli.utils.CliConfig)
@dataclass
class CliConfig:
"""Handles loading and storing the config from disk"""
_module_site: str = None
_collection: str = None
_editor: str = None
def load_config(self, config_file: str = "pyproject.toml"):
"""Load config from [tool.render-engine.cli]"""TUI Implementation
Currently reads inline from pyproject.toml in SiteLoader
Proposed API
Create render_engine_api.config with:
class RenderEngineConfig:
"""Simple configuration reader for render-engine tools."""
def __init__(self, project_root: Optional[Path] = None):
"""Initialize from project root or cwd."""
def get_site_module(self) -> str:
"""Get site_module from [tool.render-engine].
Returns:
Site module path (e.g., "app.site")
Raises:
ConfigError: If site_module not found
"""
def get_editor(self) -> Optional[str]:
"""Get configured editor or fallback to $EDITOR env var."""Configuration Schema
[tool.render-engine]
site_module = "app.site" # Required: module path to Site instance
editor = "vim" # Optional: falls back to $EDITOR env varBenefits
- Simplicity: Single source of truth for basic config
- Consistency: All tools read config the same way
- Type Safety: Proper typing and validation
Migration Path
- Create
render_engine_api.config.RenderEngineConfig - Update CLI to use
RenderEngineConfig - Update TUI
SiteLoaderto useRenderEngineConfig
Dependencies
tomllib(Python 3.11+) ortomli(Python 3.10)- Must not depend on CLI or TUI packages (pure API)
Related Issues
- Create SiteLoader #1: Site Loader API
Metadata
Metadata
Assignees
Labels
No labels