corvix.config ============= .. py:module:: corvix.config .. autoapi-nested-parse:: YAML configuration for Corvix dashboards and polling. Attributes ---------- .. autoapisummary:: corvix.config._POLLING_PER_PAGE_MIN corvix.config._POLLING_PER_PAGE_MAX corvix.config._CONTEXT_OPERATORS corvix.config.DEFAULT_CONFIG Classes ------- .. autoapisummary:: corvix.config.ContextPredicate corvix.config.MatchCriteria corvix.config.RuleAction corvix.config.Rule corvix.config.RuleSet corvix.config.DashboardSpec corvix.config.ScoringConfig corvix.config.PollingConfig corvix.config.GitHubConfig corvix.config.GitHubAccountConfig corvix.config.GitHubLatestCommentEnrichmentConfig corvix.config.GitHubPRStateEnrichmentConfig corvix.config.EnrichmentConfig corvix.config.StateConfig corvix.config.BrowserTabTargetConfig corvix.config.WebPushTargetConfig corvix.config.NotificationsDetectConfig corvix.config.NotificationsConfig corvix.config.AuthConfig corvix.config.DatabaseConfig corvix.config.AppConfig Functions --------- .. autoapisummary:: corvix.config._ensure_map corvix.config._ensure_list corvix.config._as_bool corvix.config._as_int corvix.config._as_float corvix.config._as_str corvix.config._get_str corvix.config._get_optional_str corvix.config._get_bool corvix.config._get_optional_bool corvix.config._get_int corvix.config._get_float corvix.config._get_optional_float corvix.config._to_str_list corvix.config._parse_match corvix.config._parse_context_predicates corvix.config._parse_context_predicate corvix.config._parse_rules corvix.config._parse_rule corvix.config._parse_dashboards corvix.config._parse_dashboard_ignore_rules corvix.config._parse_scoring corvix.config._to_float_map corvix.config._parse_github corvix.config._parse_polling corvix.config._parse_enrichment corvix.config._parse_state corvix.config._parse_auth corvix.config._parse_database corvix.config._parse_notifications corvix.config.load_config corvix.config.write_default_config Module Contents --------------- .. py:data:: _POLLING_PER_PAGE_MIN :value: 1 .. py:data:: _POLLING_PER_PAGE_MAX :value: 50 .. py:data:: _CONTEXT_OPERATORS .. py:class:: ContextPredicate Predicate evaluated against enriched notification context. .. py:attribute:: path :type: str .. py:attribute:: op :type: str .. py:attribute:: value :type: object | None :value: None .. py:attribute:: case_insensitive :type: bool :value: False .. py:class:: MatchCriteria Filter fields for rules and dashboards. .. py:attribute:: repository_in :type: list[str] :value: [] .. py:attribute:: repository_glob :type: list[str] :value: [] .. py:attribute:: reason_in :type: list[str] :value: [] .. py:attribute:: subject_type_in :type: list[str] :value: [] .. py:attribute:: title_contains_any :type: list[str] :value: [] .. py:attribute:: title_regex :type: str | None :value: None .. py:attribute:: unread :type: bool | None :value: None .. py:attribute:: min_score :type: float | None :value: None .. py:attribute:: max_age_hours :type: float | None :value: None .. py:attribute:: context :type: list[ContextPredicate] :value: [] .. py:class:: RuleAction Action emitted when a rule matches. .. py:attribute:: action_type :type: str .. py:class:: Rule Global or repository-scoped automation rule. .. py:attribute:: name :type: str .. py:attribute:: match :type: MatchCriteria .. py:attribute:: actions :type: list[RuleAction] :value: [] .. py:attribute:: exclude_from_dashboards :type: bool :value: False .. py:class:: RuleSet Collection of global and per-repository rules. .. py:attribute:: global_rules :type: list[Rule] :value: [] .. py:attribute:: per_repository :type: dict[str, list[Rule]] .. py:class:: DashboardSpec Dashboard configuration for sorting, grouping, and filtering. .. py:attribute:: name :type: str .. py:attribute:: group_by :type: str :value: 'none' .. py:attribute:: sort_by :type: str :value: 'score' .. py:attribute:: descending :type: bool :value: True .. py:attribute:: include_read :type: bool :value: False .. py:attribute:: max_items :type: int :value: 100 .. py:attribute:: match :type: MatchCriteria .. py:attribute:: ignore_rules :type: list[MatchCriteria] :value: [] .. py:class:: ScoringConfig Configurable scoring model for notifications. .. py:attribute:: unread_bonus :type: float :value: 15.0 .. py:attribute:: age_decay_per_hour :type: float :value: 0.25 .. py:attribute:: reason_weights :type: dict[str, float] .. py:attribute:: repository_weights :type: dict[str, float] .. py:attribute:: subject_type_weights :type: dict[str, float] .. py:attribute:: title_keyword_weights :type: dict[str, float] .. py:class:: PollingConfig Polling behavior for ingestion. .. py:attribute:: interval_seconds :type: int :value: 60 .. py:attribute:: per_page :type: int :value: 50 .. py:attribute:: max_pages :type: int :value: 5 .. py:attribute:: all :type: bool :value: False .. py:attribute:: participating :type: bool :value: False .. py:class:: GitHubConfig GitHub API configuration. .. py:attribute:: accounts :type: list[GitHubAccountConfig] :value: [] .. py:property:: token_env :type: str Backward-compatible shortcut to first account token env. .. py:property:: api_base_url :type: str Backward-compatible shortcut to first account API base URL. .. py:class:: GitHubAccountConfig One GitHub account configuration for multi-account polling. .. py:attribute:: id :type: str .. py:attribute:: label :type: str .. py:attribute:: token_env :type: str .. py:attribute:: api_base_url :type: str :value: 'https://api.github.com' .. py:class:: GitHubLatestCommentEnrichmentConfig Config for enriching comment notifications with latest-comment metadata. .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: timeout_seconds :type: float :value: 10.0 .. py:class:: GitHubPRStateEnrichmentConfig Config for enriching pull-request notifications with PR state. .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: timeout_seconds :type: float :value: 10.0 .. py:class:: EnrichmentConfig Top-level enrichment configuration. .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: max_requests_per_cycle :type: int :value: 25 .. py:attribute:: github_latest_comment :type: GitHubLatestCommentEnrichmentConfig .. py:attribute:: github_pr_state :type: GitHubPRStateEnrichmentConfig .. py:class:: StateConfig State/cache location for persisted notifications. .. py:attribute:: cache_file :type: pathlib.Path .. py:class:: BrowserTabTargetConfig Config for in-tab browser notification delivery. .. py:attribute:: enabled :type: bool :value: True .. py:attribute:: max_per_cycle :type: int :value: 5 .. py:attribute:: cooldown_seconds :type: int :value: 10 .. py:class:: WebPushTargetConfig Config for background Web Push notification delivery (phase 2). .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: vapid_public_key_env :type: str :value: 'CORVIX_VAPID_PUBLIC_KEY' .. py:attribute:: vapid_private_key_env :type: str :value: 'CORVIX_VAPID_PRIVATE_KEY' .. py:attribute:: subject :type: str :value: '' .. py:class:: NotificationsDetectConfig Controls which records qualify for notification events. .. py:attribute:: include_read :type: bool :value: False .. py:attribute:: min_score :type: float :value: 0.0 .. py:class:: NotificationsConfig Top-level notifications configuration. .. py:attribute:: enabled :type: bool :value: True .. py:attribute:: detect :type: NotificationsDetectConfig .. py:attribute:: browser_tab :type: BrowserTabTargetConfig .. py:attribute:: web_push :type: WebPushTargetConfig .. py:class:: AuthConfig Authentication mode configuration. .. py:attribute:: mode :type: str :value: 'single_user' .. py:attribute:: session_secret :type: str :value: '' .. py:class:: DatabaseConfig PostgreSQL connection configuration. .. py:attribute:: url_env :type: str :value: 'DATABASE_URL' .. py:class:: AppConfig Top-level application config. .. py:attribute:: github :type: GitHubConfig .. py:attribute:: enrichment :type: EnrichmentConfig .. py:attribute:: polling :type: PollingConfig .. py:attribute:: state :type: StateConfig .. py:attribute:: scoring :type: ScoringConfig .. py:attribute:: rules :type: RuleSet .. py:attribute:: dashboards :type: list[DashboardSpec] :value: [] .. py:attribute:: auth :type: AuthConfig .. py:attribute:: database :type: DatabaseConfig .. py:attribute:: notifications :type: NotificationsConfig .. py:method:: resolve_cache_file() -> pathlib.Path Resolve the configured cache path. .. py:data:: DEFAULT_CONFIG :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """github: accounts: - id: primary label: Primary token_env: GITHUB_TOKEN api_base_url: https://api.github.com enrichment: enabled: false max_requests_per_cycle: 25 github_latest_comment: enabled: false timeout_seconds: 10 github_pr_state: enabled: false timeout_seconds: 10 polling: interval_seconds: 60 per_page: 50 max_pages: 5 all: false participating: false state: cache_file: ~/.cache/corvix/notifications.json scoring: unread_bonus: 15 age_decay_per_hour: 0.25 reason_weights: mention: 50 review_requested: 40 assign: 30 author: 10 repository_weights: your-org/critical-repo: 25 subject_type_weights: PullRequest: 10 title_keyword_weights: security: 20 urgent: 15 rules: global: - name: mute-bot-noise match: title_regex: ".*\[bot\].*" actions: - type: mark_read exclude_from_dashboards: true per_repository: your-org/infra: - name: mute-chore-prs match: title_contains_any: ["chore", "deps"] actions: - type: mark_read exclude_from_dashboards: true dashboards: - name: overview group_by: reason sort_by: updated_at descending: true include_read: true max_items: 200 - name: triage group_by: repository sort_by: score descending: true include_read: false max_items: 100 match: reason_in: ["mention", "review_requested", "assign"] ignore_rules: - reason_in: ["comment"] context: - path: github.latest_comment.is_ci_only op: equals value: true """ .. raw:: html
.. py:function:: _ensure_map(value: object, section: str) -> dict[str, object] .. py:function:: _ensure_list(value: object, section: str) -> list[object] .. py:function:: _as_bool(value: object, field: str) -> bool .. py:function:: _as_int(value: object, field: str) -> int .. py:function:: _as_float(value: object, field: str) -> float .. py:function:: _as_str(value: object, field: str) -> str .. py:function:: _get_str(config: dict[str, object], key: str, default: str, field: str) -> str .. py:function:: _get_optional_str(config: dict[str, object], key: str, field: str) -> str | None .. py:function:: _get_bool(config: dict[str, object], key: str, default: bool, field: str) -> bool .. py:function:: _get_optional_bool(config: dict[str, object], key: str, field: str) -> bool | None .. py:function:: _get_int(config: dict[str, object], key: str, default: int, field: str) -> int .. py:function:: _get_float(config: dict[str, object], key: str, default: float, field: str) -> float .. py:function:: _get_optional_float(config: dict[str, object], key: str, field: str) -> float | None .. py:function:: _to_str_list(value: object) -> list[str] .. py:function:: _parse_match(value: object, *, section: str = 'match') -> MatchCriteria .. py:function:: _parse_context_predicates(value: object, *, section: str = 'match.context') -> list[ContextPredicate] .. py:function:: _parse_context_predicate(value: object, *, section: str = 'match.context[]') -> ContextPredicate .. py:function:: _parse_rules(value: object) -> RuleSet .. py:function:: _parse_rule(value: object) -> Rule .. py:function:: _parse_dashboards(value: object) -> list[DashboardSpec] .. py:function:: _parse_dashboard_ignore_rules(value: object) -> list[MatchCriteria] .. py:function:: _parse_scoring(value: object) -> ScoringConfig .. py:function:: _to_float_map(value: object, section: str) -> dict[str, float] .. py:function:: _parse_github(value: object) -> GitHubConfig .. py:function:: _parse_polling(value: object) -> PollingConfig .. py:function:: _parse_enrichment(value: object) -> EnrichmentConfig .. py:function:: _parse_state(value: object) -> StateConfig .. py:function:: _parse_auth(value: object) -> AuthConfig .. py:function:: _parse_database(value: object) -> DatabaseConfig .. py:function:: _parse_notifications(value: object) -> NotificationsConfig .. py:function:: load_config(path: pathlib.Path) -> AppConfig Load and validate YAML config from disk. .. py:function:: write_default_config(path: pathlib.Path) -> None Write a starter configuration file.