Skip to content

Replace environments.yml with environments.py#4

Open
OmerBaddour wants to merge 1 commit into
mainfrom
worktree-ob-envirnoments-yaml-improvement
Open

Replace environments.yml with environments.py#4
OmerBaddour wants to merge 1 commit into
mainfrom
worktree-ob-envirnoments-yaml-improvement

Conversation

@OmerBaddour

Copy link
Copy Markdown
Member

Summary

  • ~/.clair/environments.yml is replaced by ~/.clair/environments.py, loaded via importlib
  • Environment.routing now accepts any Callable[[str, str, str], str] alongside the existing RoutingConfig subclasses — callable receives (database, schema, table) as separate args
  • InvalidRoutingPolicyError removed; InvalidEnvironmentsFileError added for malformed .py files
  • write_environments_ymlwrite_environments_py; scaffold template updated to Python

Example config:

from clair.environments import Environment

environments = {
    "dev": Environment(
        account="myorg-myaccount",
        user="me@example.com",
        warehouse="my_wh",
        routing=lambda db, schema, table: f"{db}_dev.{schema}.{table}",
    ),
}

Test plan

  • uv run pytest tests/ — 494 passed

🤖 Generated with Claude Code

…xpressiveness

Routing policies are now arbitrary Python callables instead of a fixed
YAML DSL, eliminating the need for Jinja-style templating and hardcoded
policy types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant