dirigent-client 0.18.0__tar.gz → 0.18.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/PKG-INFO +2 -2
  2. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/pyproject.toml +2 -2
  3. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/pyproject.toml.orig +2 -2
  4. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/__init__.py +4 -0
  5. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/enums.py +16 -0
  6. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/alerts.py +10 -9
  7. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/__init__.py +2 -0
  8. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/alerts.py +25 -6
  9. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/pipelines.py +4 -1
  10. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/LICENSE +0 -0
  11. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/README.md +0 -0
  12. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/client.py +0 -0
  13. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/errors.py +0 -0
  14. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/messages.py +0 -0
  15. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/py.typed +0 -0
  16. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/__init__.py +0 -0
  17. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/auth.py +0 -0
  18. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/base.py +0 -0
  19. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/blocks.py +0 -0
  20. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/connections.py +0 -0
  21. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/examples.py +0 -0
  22. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/pipelines.py +0 -0
  23. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/runs.py +0 -0
  24. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/schedules.py +0 -0
  25. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/schemas.py +0 -0
  26. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/system.py +0 -0
  27. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/trigger_documents.py +0 -0
  28. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/resources/webhooks.py +0 -0
  29. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/auth.py +0 -0
  30. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/catalog.py +0 -0
  31. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/common.py +0 -0
  32. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/connections.py +0 -0
  33. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/examples.py +0 -0
  34. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/runs.py +0 -0
  35. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/schemas.py +0 -0
  36. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/system.py +0 -0
  37. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/schemas/triggers.py +0 -0
  38. {dirigent_client-0.18.0 → dirigent_client-0.18.2}/src/dirigent_client/transport.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirigent-client
3
- Version: 0.18.0
3
+ Version: 0.18.2
4
4
  Summary: The dirigent API contract: typed wire schemas and an async Python client.
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  License-File: LICENSE
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: Programming Language :: Python :: 3.13
9
- Requires-Dist: dirigent-common==0.18.0
9
+ Requires-Dist: dirigent-common==0.18.2
10
10
  Requires-Dist: httpx2>=2.12.0
11
11
  Requires-Dist: pydantic>=2.13.5
12
12
  Requires-Dist: pyyaml>=6.0.3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-client"
3
- version = "0.18.0"
3
+ version = "0.18.2"
4
4
  description = "The dirigent API contract: typed wire schemas and an async Python client."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -11,7 +11,7 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.13",
12
12
  ]
13
13
  dependencies = [
14
- "dirigent-common==0.18.0",
14
+ "dirigent-common==0.18.2",
15
15
  "httpx2>=2.12.0",
16
16
  "pydantic>=2.13.5",
17
17
  "pyyaml>=6.0.3",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-client"
3
- version = "0.18.0"
3
+ version = "0.18.2"
4
4
  description = "The dirigent API contract: typed wire schemas and an async Python client."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -11,7 +11,7 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.13",
12
12
  ]
13
13
  dependencies = [
14
- "dirigent-common==0.18.0",
14
+ "dirigent-common==0.18.2",
15
15
  "httpx2>=2.12.0",
16
16
  "pydantic>=2.13.5",
17
17
  "pyyaml>=6.0.3",
@@ -8,6 +8,7 @@ from dirigent_client.enums import (
8
8
  AttemptStatus,
9
9
  DocumentKind,
10
10
  FiringOutcome,
11
+ Importance,
11
12
  LogLevel,
12
13
  NotificationStatus,
13
14
  ProvenanceSource,
@@ -36,6 +37,7 @@ from dirigent_client.errors import (
36
37
  WaitTimeout,
37
38
  )
38
39
  from dirigent_client.schemas import (
40
+ LOG_NOTIFIER,
39
41
  TERMINAL_RUN_STATUSES,
40
42
  AlertRuleIn,
41
43
  AlertRuleOut,
@@ -119,6 +121,7 @@ __all__ = [
119
121
  "TERMINAL_RUN_STATUSES",
120
122
  "VERSION_HEADER",
121
123
  "AlertEvent",
124
+ "LOG_NOTIFIER",
122
125
  "AlertRuleIn",
123
126
  "AlertRuleOut",
124
127
  "AlertScope",
@@ -161,6 +164,7 @@ __all__ = [
161
164
  "Health",
162
165
  "HookAccepted",
163
166
  "Identity",
167
+ "Importance",
164
168
  "IssuedTokenOut",
165
169
  "ItemOut",
166
170
  "JsonList",
@@ -69,6 +69,22 @@ class RunPriority(StrEnum):
69
69
  PRIORITY_RANK: dict[RunPriority, int] = {RunPriority.LOW: 0, RunPriority.NORMAL: 1, RunPriority.HIGH: 2}
70
70
 
71
71
 
72
+ class Importance(StrEnum):
73
+ """How much a pipeline matters when it goes wrong, which is not when its work is claimed."""
74
+
75
+ ROUTINE = "routine"
76
+ """Nothing downstream waits on it, and a failure keeps until someone looks."""
77
+
78
+ NORMAL = "normal"
79
+
80
+ CRITICAL = "critical"
81
+ """A failure is worth interrupting someone for."""
82
+
83
+
84
+ #: What each importance is worth to a comparison, least first.
85
+ IMPORTANCE_RANK: dict[Importance, int] = {Importance.ROUTINE: 0, Importance.NORMAL: 1, Importance.CRITICAL: 2}
86
+
87
+
72
88
  class TriggerKind(StrEnum):
73
89
  """What started a run."""
74
90
 
@@ -3,7 +3,7 @@
3
3
  from datetime import timedelta
4
4
  from uuid import UUID
5
5
 
6
- from dirigent_client.enums import AlertEvent, AlertScope
6
+ from dirigent_client.enums import AlertEvent, AlertScope, Importance
7
7
  from dirigent_client.resources.base import Resource, query, request_body
8
8
  from dirigent_client.schemas import (
9
9
  AlertRuleIn,
@@ -31,23 +31,23 @@ class Alerts(Resource):
31
31
  name: str | None = None,
32
32
  description: str | None = None,
33
33
  event: AlertEvent,
34
- notifier: str,
35
34
  scope: AlertScope = AlertScope.GLOBAL,
36
35
  pipeline: str | None = None,
36
+ importance: Importance | None = None,
37
37
  connection: str | None = None,
38
38
  template: str | None = None,
39
39
  body: str | None = None,
40
40
  throttle: timedelta | str = timedelta(0),
41
41
  ) -> AlertRuleOut:
42
- """Declare an alert rule, refusing a notifier or a pipeline this instance does not have."""
42
+ """Declare an alert rule, refusing a target or a pipeline this instance does not have."""
43
43
  payload = AlertRuleIn(
44
44
  code=code,
45
45
  name=name,
46
46
  description=description,
47
47
  event=event,
48
- notifier=notifier,
49
48
  scope=scope,
50
49
  pipeline=pipeline,
50
+ importance=importance,
51
51
  connection=connection,
52
52
  template=template,
53
53
  body=body,
@@ -66,13 +66,15 @@ class Alerts(Resource):
66
66
  paused: bool | None = None,
67
67
  template: str | None = None,
68
68
  body: str | None = None,
69
+ importance: Importance | None = None,
70
+ connection: str | None = None,
69
71
  ) -> AlertRuleOut:
70
- """Change what a rule says or whether it delivers.
72
+ """Change what a rule says, where it delivers, or whether it delivers at all.
71
73
 
72
74
  A field this call was not given is absent from the body, which is how the endpoint
73
75
  tells "leave it alone" from "clear it".
74
76
  """
75
- named = query(paused=paused, template=template, body=body)
77
+ named = query(paused=paused, template=template, body=body, importance=importance, connection=connection)
76
78
  body_json = AlertRuleUpdate.model_validate(named).model_dump(mode="json", exclude_unset=True)
77
79
  return await self._one(AlertRuleOut, "PATCH", f"/alert-rules/{code}", json=body_json)
78
80
 
@@ -83,13 +85,12 @@ class Alerts(Resource):
83
85
  async def test(
84
86
  self,
85
87
  *,
86
- notifier: str,
87
88
  connection: str | None = None,
88
89
  subject: str | None = None,
89
90
  body: str | None = None,
90
91
  ) -> TestQueued:
91
- """Queue one message through a channel, on the same path a real alert takes."""
92
- declared = TestRequest(notifier=notifier, connection=connection)
92
+ """Queue one message through the target a rule would name, on the path a real alert takes."""
93
+ declared = TestRequest(connection=connection)
93
94
  payload = declared.model_copy(
94
95
  update=query(subject=subject, body=body),
95
96
  )
@@ -1,6 +1,7 @@
1
1
  """The wire schemas: one definition of every shape the REST API accepts and answers with."""
2
2
 
3
3
  from dirigent_client.schemas.alerts import (
4
+ LOG_NOTIFIER,
4
5
  AlertRuleIn,
5
6
  AlertRuleOut,
6
7
  AlertRuleUpdate,
@@ -87,6 +88,7 @@ from dirigent_common import JsonList, JsonMap
87
88
 
88
89
  __all__ = [
89
90
  "TERMINAL_RUN_STATUSES",
91
+ "LOG_NOTIFIER",
90
92
  "AlertRuleIn",
91
93
  "AlertRuleOut",
92
94
  "AlertRuleUpdate",
@@ -5,15 +5,28 @@ from uuid import UUID
5
5
 
6
6
  from pydantic import BaseModel, Field
7
7
 
8
- from dirigent_client.enums import AlertEvent, AlertScope, NotificationStatus
8
+ from dirigent_client.enums import AlertEvent, AlertScope, Importance, NotificationStatus
9
9
  from dirigent_client.schemas.common import WireModel
10
10
  from dirigent_common import EntityName
11
11
  from dirigent_common.durations import Duration
12
12
 
13
+ #: The notifier a rule that names no connection delivers through.
14
+ LOG_NOTIFIER = "log"
15
+
13
16
  SUBJECT_HELP = "Subject, a Jinja template over the run's facts."
14
17
 
15
18
  BODY_HELP = "Body, a Jinja template over the run's facts; `report` is the run's report document when it has one."
16
19
 
20
+ IMPORTANCE_HELP = "The least importance a pipeline must carry before this rule fires; absent fires for every one."
21
+
22
+ CONNECTION_HELP = (
23
+ "The connection this rule delivers through, whose kind names the sender; absent delivers to the process log."
24
+ )
25
+
26
+ TEST_CONNECTION_HELP = (
27
+ "The connection this message delivers through, whose kind names the sender; absent delivers to the process log."
28
+ )
29
+
17
30
 
18
31
  class AlertRuleIn(BaseModel):
19
32
  """An alert rule as a caller declares it."""
@@ -22,10 +35,10 @@ class AlertRuleIn(BaseModel):
22
35
  name: str | None = None
23
36
  description: str | None = None
24
37
  event: AlertEvent
25
- notifier: str
26
38
  scope: AlertScope = AlertScope.GLOBAL
27
39
  pipeline: str | None = None
28
- connection: str | None = None
40
+ importance: Importance | None = Field(default=None, description=IMPORTANCE_HELP)
41
+ connection: str | None = Field(default=None, description=CONNECTION_HELP)
29
42
  template: str | None = Field(default=None, description=SUBJECT_HELP)
30
43
  body: str | None = Field(default=None, description=BODY_HELP)
31
44
  throttle: Duration = timedelta(0)
@@ -41,7 +54,12 @@ class AlertRuleOut(WireModel):
41
54
  event: AlertEvent
42
55
  scope: AlertScope
43
56
  pipeline: str | None = None
57
+ importance: Importance | None = None
58
+ """The least importance a pipeline must carry before this rule fires."""
59
+
44
60
  notifier: str
61
+ """The sender this rule's target resolved to, which is its connection's kind or the log."""
62
+
45
63
  connection: str | None = None
46
64
  template: str | None = None
47
65
  body: str | None = None
@@ -61,6 +79,8 @@ class AlertRuleUpdate(BaseModel):
61
79
  paused: bool | None = None
62
80
  template: str | None = Field(default=None, description=SUBJECT_HELP)
63
81
  body: str | None = Field(default=None, description=BODY_HELP)
82
+ importance: Importance | None = Field(default=None, description=IMPORTANCE_HELP)
83
+ connection: str | None = Field(default=None, description=CONNECTION_HELP)
64
84
 
65
85
 
66
86
  class NotificationOut(WireModel):
@@ -85,10 +105,9 @@ class NotificationOut(WireModel):
85
105
 
86
106
 
87
107
  class TestRequest(BaseModel):
88
- """Which channel to send a test message through, and what to say."""
108
+ """Which target to send a test message through, and what to say."""
89
109
 
90
- notifier: str
91
- connection: str | None = None
110
+ connection: str | None = Field(default=None, description=TEST_CONNECTION_HELP)
92
111
  subject: str = "dirigent test alert"
93
112
  body: str = "This is a test message sent through the notifier surface."
94
113
 
@@ -7,7 +7,7 @@ from uuid import UUID
7
7
 
8
8
  from pydantic import AliasChoices, BaseModel, ConfigDict, Field, field_validator, model_validator
9
9
 
10
- from dirigent_client.enums import DocumentKind, LogLevel, ProvenanceSource, RunPriority, RunStatus
10
+ from dirigent_client.enums import DocumentKind, Importance, LogLevel, ProvenanceSource, RunPriority, RunStatus
11
11
  from dirigent_client.messages import (
12
12
  EMPTY_LOG_LEVEL_PATTERN,
13
13
  WINDOW_HAS_TWO_ENDS,
@@ -64,6 +64,9 @@ class PipelineOut(WireModel):
64
64
  tags: list[str] = Field(default_factory=list[str])
65
65
  """What the current document says this pipeline is for."""
66
66
 
67
+ importance: Importance = Importance.NORMAL
68
+ """How much the current document says this pipeline matters."""
69
+
67
70
  active: bool
68
71
  current_version: int | None = None
69
72
  active_runs: int = 0