prefect-client 3.1.10__py3-none-any.whl → 3.1.12__py3-none-any.whl

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 (141) hide show
  1. prefect/_experimental/lineage.py +7 -8
  2. prefect/_experimental/sla/__init__.py +0 -0
  3. prefect/_experimental/sla/client.py +66 -0
  4. prefect/_experimental/sla/objects.py +53 -0
  5. prefect/_internal/_logging.py +15 -3
  6. prefect/_internal/compatibility/async_dispatch.py +22 -16
  7. prefect/_internal/compatibility/deprecated.py +42 -18
  8. prefect/_internal/compatibility/migration.py +2 -2
  9. prefect/_internal/concurrency/inspection.py +12 -14
  10. prefect/_internal/concurrency/primitives.py +2 -2
  11. prefect/_internal/concurrency/services.py +154 -80
  12. prefect/_internal/concurrency/waiters.py +13 -9
  13. prefect/_internal/pydantic/annotations/pendulum.py +7 -7
  14. prefect/_internal/pytz.py +4 -3
  15. prefect/_internal/retries.py +10 -5
  16. prefect/_internal/schemas/bases.py +19 -10
  17. prefect/_internal/schemas/validators.py +227 -388
  18. prefect/_version.py +3 -3
  19. prefect/automations.py +236 -30
  20. prefect/blocks/__init__.py +3 -3
  21. prefect/blocks/abstract.py +53 -30
  22. prefect/blocks/core.py +183 -84
  23. prefect/blocks/notifications.py +133 -73
  24. prefect/blocks/redis.py +13 -9
  25. prefect/blocks/system.py +24 -11
  26. prefect/blocks/webhook.py +7 -5
  27. prefect/cache_policies.py +3 -2
  28. prefect/client/orchestration/__init__.py +1957 -0
  29. prefect/client/orchestration/_artifacts/__init__.py +0 -0
  30. prefect/client/orchestration/_artifacts/client.py +239 -0
  31. prefect/client/orchestration/_automations/__init__.py +0 -0
  32. prefect/client/orchestration/_automations/client.py +329 -0
  33. prefect/client/orchestration/_blocks_documents/__init__.py +0 -0
  34. prefect/client/orchestration/_blocks_documents/client.py +334 -0
  35. prefect/client/orchestration/_blocks_schemas/__init__.py +0 -0
  36. prefect/client/orchestration/_blocks_schemas/client.py +200 -0
  37. prefect/client/orchestration/_blocks_types/__init__.py +0 -0
  38. prefect/client/orchestration/_blocks_types/client.py +380 -0
  39. prefect/client/orchestration/_concurrency_limits/__init__.py +0 -0
  40. prefect/client/orchestration/_concurrency_limits/client.py +762 -0
  41. prefect/client/orchestration/_deployments/__init__.py +0 -0
  42. prefect/client/orchestration/_deployments/client.py +1128 -0
  43. prefect/client/orchestration/_flow_runs/__init__.py +0 -0
  44. prefect/client/orchestration/_flow_runs/client.py +903 -0
  45. prefect/client/orchestration/_flows/__init__.py +0 -0
  46. prefect/client/orchestration/_flows/client.py +343 -0
  47. prefect/client/orchestration/_logs/__init__.py +0 -0
  48. prefect/client/orchestration/_logs/client.py +97 -0
  49. prefect/client/orchestration/_variables/__init__.py +0 -0
  50. prefect/client/orchestration/_variables/client.py +157 -0
  51. prefect/client/orchestration/base.py +46 -0
  52. prefect/client/orchestration/routes.py +145 -0
  53. prefect/client/schemas/__init__.py +68 -28
  54. prefect/client/schemas/actions.py +2 -2
  55. prefect/client/schemas/filters.py +5 -0
  56. prefect/client/schemas/objects.py +8 -15
  57. prefect/client/schemas/schedules.py +22 -10
  58. prefect/concurrency/_asyncio.py +87 -0
  59. prefect/concurrency/{events.py → _events.py} +10 -10
  60. prefect/concurrency/asyncio.py +20 -104
  61. prefect/concurrency/context.py +6 -4
  62. prefect/concurrency/services.py +26 -74
  63. prefect/concurrency/sync.py +23 -44
  64. prefect/concurrency/v1/_asyncio.py +63 -0
  65. prefect/concurrency/v1/{events.py → _events.py} +13 -15
  66. prefect/concurrency/v1/asyncio.py +27 -80
  67. prefect/concurrency/v1/context.py +6 -4
  68. prefect/concurrency/v1/services.py +33 -79
  69. prefect/concurrency/v1/sync.py +18 -37
  70. prefect/context.py +66 -45
  71. prefect/deployments/base.py +10 -144
  72. prefect/deployments/flow_runs.py +12 -2
  73. prefect/deployments/runner.py +53 -4
  74. prefect/deployments/steps/pull.py +13 -0
  75. prefect/engine.py +17 -4
  76. prefect/events/clients.py +7 -1
  77. prefect/events/schemas/events.py +3 -2
  78. prefect/filesystems.py +6 -2
  79. prefect/flow_engine.py +101 -85
  80. prefect/flows.py +10 -1
  81. prefect/input/run_input.py +2 -1
  82. prefect/logging/logging.yml +1 -1
  83. prefect/main.py +1 -3
  84. prefect/results.py +2 -307
  85. prefect/runner/runner.py +4 -2
  86. prefect/runner/storage.py +87 -21
  87. prefect/serializers.py +32 -25
  88. prefect/settings/legacy.py +4 -4
  89. prefect/settings/models/api.py +3 -3
  90. prefect/settings/models/cli.py +3 -3
  91. prefect/settings/models/client.py +5 -3
  92. prefect/settings/models/cloud.py +8 -3
  93. prefect/settings/models/deployments.py +3 -3
  94. prefect/settings/models/experiments.py +4 -7
  95. prefect/settings/models/flows.py +3 -3
  96. prefect/settings/models/internal.py +4 -2
  97. prefect/settings/models/logging.py +4 -3
  98. prefect/settings/models/results.py +3 -3
  99. prefect/settings/models/root.py +3 -2
  100. prefect/settings/models/runner.py +4 -4
  101. prefect/settings/models/server/api.py +3 -3
  102. prefect/settings/models/server/database.py +11 -4
  103. prefect/settings/models/server/deployments.py +6 -2
  104. prefect/settings/models/server/ephemeral.py +4 -2
  105. prefect/settings/models/server/events.py +3 -2
  106. prefect/settings/models/server/flow_run_graph.py +6 -2
  107. prefect/settings/models/server/root.py +3 -3
  108. prefect/settings/models/server/services.py +26 -11
  109. prefect/settings/models/server/tasks.py +6 -3
  110. prefect/settings/models/server/ui.py +3 -3
  111. prefect/settings/models/tasks.py +5 -5
  112. prefect/settings/models/testing.py +3 -3
  113. prefect/settings/models/worker.py +5 -3
  114. prefect/settings/profiles.py +15 -2
  115. prefect/states.py +61 -45
  116. prefect/task_engine.py +54 -75
  117. prefect/task_runners.py +56 -55
  118. prefect/task_worker.py +2 -2
  119. prefect/tasks.py +90 -36
  120. prefect/telemetry/bootstrap.py +10 -9
  121. prefect/telemetry/run_telemetry.py +13 -8
  122. prefect/telemetry/services.py +4 -0
  123. prefect/transactions.py +4 -15
  124. prefect/utilities/_git.py +34 -0
  125. prefect/utilities/asyncutils.py +1 -1
  126. prefect/utilities/engine.py +3 -19
  127. prefect/utilities/generics.py +18 -0
  128. prefect/utilities/templating.py +25 -1
  129. prefect/workers/base.py +6 -3
  130. prefect/workers/process.py +1 -1
  131. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/METADATA +2 -2
  132. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/RECORD +135 -109
  133. prefect/client/orchestration.py +0 -4523
  134. prefect/records/__init__.py +0 -1
  135. prefect/records/base.py +0 -235
  136. prefect/records/filesystem.py +0 -213
  137. prefect/records/memory.py +0 -184
  138. prefect/records/result_store.py +0 -70
  139. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/LICENSE +0 -0
  140. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/WHEEL +0 -0
  141. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/top_level.txt +0 -0
prefect/serializers.py CHANGED
@@ -11,9 +11,8 @@ All serializers must implement `dumps` and `loads` which convert objects to byte
11
11
  bytes to an object respectively.
12
12
  """
13
13
 
14
- import abc
15
14
  import base64
16
- from typing import Any, Generic, Optional, Type, Union
15
+ from typing import Any, ClassVar, Generic, Optional, Union, overload
17
16
 
18
17
  from pydantic import (
19
18
  BaseModel,
@@ -54,7 +53,7 @@ def prefect_json_object_encoder(obj: Any) -> Any:
54
53
  }
55
54
 
56
55
 
57
- def prefect_json_object_decoder(result: dict[str, Any]):
56
+ def prefect_json_object_decoder(result: dict[str, Any]) -> Any:
58
57
  """
59
58
  `JSONDecoder.object_hook` for decoding objects from JSON when previously encoded
60
59
  with `prefect_json_object_encoder`
@@ -70,7 +69,7 @@ def prefect_json_object_decoder(result: dict[str, Any]):
70
69
 
71
70
 
72
71
  @register_base_type
73
- class Serializer(BaseModel, Generic[D], abc.ABC):
72
+ class Serializer(BaseModel, Generic[D]):
74
73
  """
75
74
  A serializer that can encode objects of type 'D' into bytes.
76
75
  """
@@ -80,10 +79,18 @@ class Serializer(BaseModel, Generic[D], abc.ABC):
80
79
  data.setdefault("type", type_string)
81
80
  super().__init__(**data)
82
81
 
83
- def __new__(cls: Type[Self], **kwargs: Any) -> Self:
84
- if "type" in kwargs:
82
+ @overload
83
+ def __new__(cls, *, type: str, **kwargs: Any) -> "Serializer[Any]":
84
+ ...
85
+
86
+ @overload
87
+ def __new__(cls, *, type: None = ..., **kwargs: Any) -> Self:
88
+ ...
89
+
90
+ def __new__(cls, **kwargs: Any) -> Union[Self, "Serializer[Any]"]:
91
+ if type_ := kwargs.get("type"):
85
92
  try:
86
- subcls = lookup_type(cls, dispatch_key=kwargs["type"])
93
+ subcls = lookup_type(cls, dispatch_key=type_)
87
94
  except KeyError as exc:
88
95
  raise ValidationError.from_exception_data(
89
96
  title=cls.__name__,
@@ -97,15 +104,15 @@ class Serializer(BaseModel, Generic[D], abc.ABC):
97
104
 
98
105
  type: str
99
106
 
100
- @abc.abstractmethod
101
107
  def dumps(self, obj: D) -> bytes:
102
108
  """Encode the object into a blob of bytes."""
109
+ raise NotImplementedError
103
110
 
104
- @abc.abstractmethod
105
111
  def loads(self, blob: bytes) -> D:
106
112
  """Decode the blob of bytes into an object."""
113
+ raise NotImplementedError
107
114
 
108
- model_config = ConfigDict(extra="forbid")
115
+ model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
109
116
 
110
117
  @classmethod
111
118
  def __dispatch_key__(cls) -> Optional[str]:
@@ -113,7 +120,7 @@ class Serializer(BaseModel, Generic[D], abc.ABC):
113
120
  return type_str if isinstance(type_str, str) else None
114
121
 
115
122
 
116
- class PickleSerializer(Serializer):
123
+ class PickleSerializer(Serializer[D]):
117
124
  """
118
125
  Serializes objects using the pickle protocol.
119
126
 
@@ -132,17 +139,17 @@ class PickleSerializer(Serializer):
132
139
  def check_picklelib(cls, value: str) -> str:
133
140
  return validate_picklelib(value)
134
141
 
135
- def dumps(self, obj: Any) -> bytes:
142
+ def dumps(self, obj: D) -> bytes:
136
143
  pickler = from_qualified_name(self.picklelib)
137
144
  blob = pickler.dumps(obj)
138
145
  return base64.encodebytes(blob)
139
146
 
140
- def loads(self, blob: bytes) -> Any:
147
+ def loads(self, blob: bytes) -> D:
141
148
  pickler = from_qualified_name(self.picklelib)
142
149
  return pickler.loads(base64.decodebytes(blob))
143
150
 
144
151
 
145
- class JSONSerializer(Serializer):
152
+ class JSONSerializer(Serializer[D]):
146
153
  """
147
154
  Serializes data to JSON.
148
155
 
@@ -186,7 +193,7 @@ class JSONSerializer(Serializer):
186
193
  ) -> dict[str, Any]:
187
194
  return validate_load_kwargs(value)
188
195
 
189
- def dumps(self, obj: Any) -> bytes:
196
+ def dumps(self, obj: D) -> bytes:
190
197
  json = from_qualified_name(self.jsonlib)
191
198
  kwargs = self.dumps_kwargs.copy()
192
199
  if self.object_encoder:
@@ -197,7 +204,7 @@ class JSONSerializer(Serializer):
197
204
  result = result.encode()
198
205
  return result
199
206
 
200
- def loads(self, blob: bytes) -> Any:
207
+ def loads(self, blob: bytes) -> D:
201
208
  json = from_qualified_name(self.jsonlib)
202
209
  kwargs = self.loads_kwargs.copy()
203
210
  if self.object_decoder:
@@ -205,7 +212,7 @@ class JSONSerializer(Serializer):
205
212
  return json.loads(blob.decode(), **kwargs)
206
213
 
207
214
 
208
- class CompressedSerializer(Serializer):
215
+ class CompressedSerializer(Serializer[D]):
209
216
  """
210
217
  Wraps another serializer, compressing its output.
211
218
  Uses `lzma` by default. See `compressionlib` for using alternative libraries.
@@ -219,43 +226,43 @@ class CompressedSerializer(Serializer):
219
226
 
220
227
  type: str = Field(default="compressed", frozen=True)
221
228
 
222
- serializer: Serializer
229
+ serializer: Serializer[D]
223
230
  compressionlib: str = "lzma"
224
231
 
225
232
  @field_validator("serializer", mode="before")
226
- def validate_serializer(cls, value: Union[str, Serializer]) -> Serializer:
233
+ def validate_serializer(cls, value: Union[str, Serializer[D]]) -> Serializer[D]:
227
234
  return cast_type_names_to_serializers(value)
228
235
 
229
236
  @field_validator("compressionlib")
230
237
  def check_compressionlib(cls, value: str) -> str:
231
238
  return validate_compressionlib(value)
232
239
 
233
- def dumps(self, obj: Any) -> bytes:
240
+ def dumps(self, obj: D) -> bytes:
234
241
  blob = self.serializer.dumps(obj)
235
242
  compressor = from_qualified_name(self.compressionlib)
236
243
  return base64.encodebytes(compressor.compress(blob))
237
244
 
238
- def loads(self, blob: bytes) -> Any:
245
+ def loads(self, blob: bytes) -> D:
239
246
  compressor = from_qualified_name(self.compressionlib)
240
247
  uncompressed = compressor.decompress(base64.decodebytes(blob))
241
248
  return self.serializer.loads(uncompressed)
242
249
 
243
250
 
244
- class CompressedPickleSerializer(CompressedSerializer):
251
+ class CompressedPickleSerializer(CompressedSerializer[D]):
245
252
  """
246
253
  A compressed serializer preconfigured to use the pickle serializer.
247
254
  """
248
255
 
249
256
  type: str = Field(default="compressed/pickle", frozen=True)
250
257
 
251
- serializer: Serializer = Field(default_factory=PickleSerializer)
258
+ serializer: Serializer[D] = Field(default_factory=PickleSerializer)
252
259
 
253
260
 
254
- class CompressedJSONSerializer(CompressedSerializer):
261
+ class CompressedJSONSerializer(CompressedSerializer[D]):
255
262
  """
256
263
  A compressed serializer preconfigured to use the json serializer.
257
264
  """
258
265
 
259
266
  type: str = Field(default="compressed/json", frozen=True)
260
267
 
261
- serializer: Serializer = Field(default_factory=JSONSerializer)
268
+ serializer: Serializer[D] = Field(default_factory=JSONSerializer)
@@ -23,9 +23,9 @@ class Setting:
23
23
  self._default = default
24
24
  self._type = type_
25
25
  if accessor is None:
26
- self.accessor = _env_var_to_accessor(name)
26
+ self.accessor: str = _env_var_to_accessor(name)
27
27
  else:
28
- self.accessor = accessor
28
+ self.accessor: str = accessor
29
29
 
30
30
  @property
31
31
  def name(self):
@@ -58,7 +58,7 @@ class Setting:
58
58
 
59
59
  return self.value_from(get_current_settings())
60
60
 
61
- def value_from(self: Self, settings: "Settings") -> Any:
61
+ def value_from(self: Self, settings: Settings) -> Any:
62
62
  path = self.accessor.split(".")
63
63
  current_value = settings
64
64
  for key in path:
@@ -97,7 +97,7 @@ def _get_valid_setting_names(cls: type[BaseSettings]) -> Set[str]:
97
97
  """
98
98
  A set of valid setting names, e.g. "PREFECT_API_URL" or "PREFECT_API_KEY".
99
99
  """
100
- settings_fields = set()
100
+ settings_fields: set[str] = set()
101
101
  for field_name, field in cls.model_fields.items():
102
102
  if inspect.isclass(field.annotation) and issubclass(
103
103
  field.annotation, PrefectBaseSettings
@@ -1,7 +1,7 @@
1
1
  import os
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
 
4
- from pydantic import Field, SecretStr
4
+ from pydantic import ConfigDict, Field, SecretStr
5
5
 
6
6
  from prefect.settings.base import (
7
7
  PrefectBaseSettings,
@@ -14,7 +14,7 @@ class APISettings(PrefectBaseSettings):
14
14
  Settings for interacting with the Prefect API
15
15
  """
16
16
 
17
- model_config = _build_settings_config(("api",))
17
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("api",))
18
18
  url: Optional[str] = Field(
19
19
  default=None,
20
20
  description="The URL of the Prefect API. If not set, the client will attempt to infer it.",
@@ -1,6 +1,6 @@
1
- from typing import Optional
1
+ from typing import ClassVar, Optional
2
2
 
3
- from pydantic import Field
3
+ from pydantic import ConfigDict, Field
4
4
 
5
5
  from prefect.settings.base import (
6
6
  PrefectBaseSettings,
@@ -13,7 +13,7 @@ class CLISettings(PrefectBaseSettings):
13
13
  Settings for controlling CLI behavior
14
14
  """
15
15
 
16
- model_config = _build_settings_config(("cli",))
16
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("cli",))
17
17
 
18
18
  colors: bool = Field(
19
19
  default=True,
@@ -1,4 +1,6 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import (
4
6
  PrefectBaseSettings,
@@ -12,7 +14,7 @@ class ClientMetricsSettings(PrefectBaseSettings):
12
14
  Settings for controlling metrics reporting from the client
13
15
  """
14
16
 
15
- model_config = _build_settings_config(("client", "metrics"))
17
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("client", "metrics"))
16
18
 
17
19
  enabled: bool = Field(
18
20
  default=False,
@@ -37,7 +39,7 @@ class ClientSettings(PrefectBaseSettings):
37
39
  Settings for controlling API client behavior
38
40
  """
39
41
 
40
- model_config = _build_settings_config(("client",))
42
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("client",))
41
43
 
42
44
  max_retries: int = Field(
43
45
  default=5,
@@ -1,7 +1,7 @@
1
1
  import re
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
 
4
- from pydantic import Field, model_validator
4
+ from pydantic import ConfigDict, Field, model_validator
5
5
  from typing_extensions import Self
6
6
 
7
7
  from prefect.settings.base import (
@@ -32,13 +32,18 @@ class CloudSettings(PrefectBaseSettings):
32
32
  Settings for interacting with Prefect Cloud
33
33
  """
34
34
 
35
- model_config = _build_settings_config(("cloud",))
35
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("cloud",))
36
36
 
37
37
  api_url: str = Field(
38
38
  default="https://api.prefect.cloud/api",
39
39
  description="API URL for Prefect Cloud. Used for authentication with Prefect Cloud.",
40
40
  )
41
41
 
42
+ enable_orchestration_telemetry: bool = Field(
43
+ default=True,
44
+ description="Whether or not to enable orchestration telemetry.",
45
+ )
46
+
42
47
  ui_url: Optional[str] = Field(
43
48
  default=None,
44
49
  description="The URL of the Prefect Cloud UI. If not set, the client will attempt to infer it.",
@@ -1,6 +1,6 @@
1
- from typing import Optional
1
+ from typing import ClassVar, Optional
2
2
 
3
- from pydantic import AliasChoices, AliasPath, Field
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
4
4
 
5
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
6
6
 
@@ -10,7 +10,7 @@ class DeploymentsSettings(PrefectBaseSettings):
10
10
  Settings for configuring deployments defaults
11
11
  """
12
12
 
13
- model_config = _build_settings_config(("deployments",))
13
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("deployments",))
14
14
 
15
15
  default_work_pool_name: Optional[str] = Field(
16
16
  default=None,
@@ -1,4 +1,6 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
4
6
 
@@ -8,7 +10,7 @@ class ExperimentsSettings(PrefectBaseSettings):
8
10
  Settings for configuring experimental features
9
11
  """
10
12
 
11
- model_config = _build_settings_config(("experiments",))
13
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("experiments",))
12
14
 
13
15
  warn: bool = Field(
14
16
  default=True,
@@ -18,11 +20,6 @@ class ExperimentsSettings(PrefectBaseSettings):
18
20
  ),
19
21
  )
20
22
 
21
- telemetry_enabled: bool = Field(
22
- default=False,
23
- description="Enables sending telemetry to Prefect Cloud.",
24
- )
25
-
26
23
  lineage_events_enabled: bool = Field(
27
24
  default=False,
28
25
  description="If `True`, enables emitting lineage events. Set to `False` to disable lineage event emission.",
@@ -1,6 +1,6 @@
1
- from typing import Union
1
+ from typing import ClassVar, Union
2
2
 
3
- from pydantic import AliasChoices, AliasPath, Field
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
4
4
 
5
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
6
6
 
@@ -10,7 +10,7 @@ class FlowsSettings(PrefectBaseSettings):
10
10
  Settings for controlling flow behavior
11
11
  """
12
12
 
13
- model_config = _build_settings_config(("flows",))
13
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("flows",))
14
14
 
15
15
  default_retries: int = Field(
16
16
  default=0,
@@ -1,11 +1,13 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
4
6
  from prefect.types import LogLevel
5
7
 
6
8
 
7
9
  class InternalSettings(PrefectBaseSettings):
8
- model_config = _build_settings_config(("internal",))
10
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("internal",))
9
11
 
10
12
  logging_level: LogLevel = Field(
11
13
  default="ERROR",
@@ -1,11 +1,12 @@
1
1
  from functools import partial
2
2
  from pathlib import Path
3
- from typing import Annotated, Literal, Optional, Union
3
+ from typing import Annotated, ClassVar, Literal, Optional, Union
4
4
 
5
5
  from pydantic import (
6
6
  AliasChoices,
7
7
  AliasPath,
8
8
  BeforeValidator,
9
+ ConfigDict,
9
10
  Field,
10
11
  model_validator,
11
12
  )
@@ -32,7 +33,7 @@ class LoggingToAPISettings(PrefectBaseSettings):
32
33
  Settings for controlling logging to the API
33
34
  """
34
35
 
35
- model_config = _build_settings_config(("logging", "to_api"))
36
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("logging", "to_api"))
36
37
 
37
38
  enabled: bool = Field(
38
39
  default=True,
@@ -85,7 +86,7 @@ class LoggingSettings(PrefectBaseSettings):
85
86
  Settings for controlling logging behavior
86
87
  """
87
88
 
88
- model_config = _build_settings_config(("logging",))
89
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("logging",))
89
90
 
90
91
  level: LogLevel = Field(
91
92
  default="INFO",
@@ -1,7 +1,7 @@
1
1
  from pathlib import Path
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
 
4
- from pydantic import AliasChoices, AliasPath, Field
4
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
5
5
 
6
6
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
7
7
 
@@ -11,7 +11,7 @@ class ResultsSettings(PrefectBaseSettings):
11
11
  Settings for controlling result storage behavior
12
12
  """
13
13
 
14
- model_config = _build_settings_config(("results",))
14
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("results",))
15
15
 
16
16
  default_serializer: str = Field(
17
17
  default="pickle",
@@ -4,13 +4,14 @@ from typing import (
4
4
  TYPE_CHECKING,
5
5
  Annotated,
6
6
  Any,
7
+ ClassVar,
7
8
  Iterable,
8
9
  Mapping,
9
10
  Optional,
10
11
  )
11
12
  from urllib.parse import urlparse
12
13
 
13
- from pydantic import BeforeValidator, Field, SecretStr, model_validator
14
+ from pydantic import BeforeValidator, ConfigDict, Field, SecretStr, model_validator
14
15
  from typing_extensions import Self
15
16
 
16
17
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
@@ -43,7 +44,7 @@ class Settings(PrefectBaseSettings):
43
44
  See https://docs.pydantic.dev/latest/concepts/pydantic_settings
44
45
  """
45
46
 
46
- model_config = _build_settings_config()
47
+ model_config: ClassVar[ConfigDict] = _build_settings_config()
47
48
 
48
49
  home: Annotated[Path, BeforeValidator(lambda x: Path(x).expanduser())] = Field(
49
50
  default=Path("~") / ".prefect",
@@ -1,6 +1,6 @@
1
- from typing import Optional
1
+ from typing import ClassVar, Optional
2
2
 
3
- from pydantic import Field
3
+ from pydantic import ConfigDict, Field
4
4
 
5
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
6
6
  from prefect.types import LogLevel
@@ -11,7 +11,7 @@ class RunnerServerSettings(PrefectBaseSettings):
11
11
  Settings for controlling runner server behavior
12
12
  """
13
13
 
14
- model_config = _build_settings_config(("runner", "server"))
14
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("runner", "server"))
15
15
 
16
16
  enable: bool = Field(
17
17
  default=False,
@@ -44,7 +44,7 @@ class RunnerSettings(PrefectBaseSettings):
44
44
  Settings for controlling runner behavior
45
45
  """
46
46
 
47
- model_config = _build_settings_config(("runner",))
47
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("runner",))
48
48
 
49
49
  process_limit: int = Field(
50
50
  default=5,
@@ -1,7 +1,7 @@
1
1
  from datetime import timedelta
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
 
4
- from pydantic import AliasChoices, AliasPath, Field, SecretStr
4
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field, SecretStr
5
5
 
6
6
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
7
7
 
@@ -11,7 +11,7 @@ class ServerAPISettings(PrefectBaseSettings):
11
11
  Settings for controlling API server behavior
12
12
  """
13
13
 
14
- model_config = _build_settings_config(("server", "api"))
14
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("server", "api"))
15
15
 
16
16
  auth_string: Optional[SecretStr] = Field(
17
17
  default=None,
@@ -1,8 +1,15 @@
1
1
  import warnings
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
  from urllib.parse import quote_plus
4
4
 
5
- from pydantic import AliasChoices, AliasPath, Field, SecretStr, model_validator
5
+ from pydantic import (
6
+ AliasChoices,
7
+ AliasPath,
8
+ ConfigDict,
9
+ Field,
10
+ SecretStr,
11
+ model_validator,
12
+ )
6
13
  from typing_extensions import Literal, Self
7
14
 
8
15
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
@@ -13,7 +20,7 @@ class ServerDatabaseSettings(PrefectBaseSettings):
13
20
  Settings for controlling server database behavior
14
21
  """
15
22
 
16
- model_config = _build_settings_config(("server", "database"))
23
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("server", "database"))
17
24
 
18
25
  connection_url: Optional[SecretStr] = Field(
19
26
  default=None,
@@ -130,7 +137,7 @@ class ServerDatabaseSettings(PrefectBaseSettings):
130
137
  )
131
138
 
132
139
  connection_timeout: Optional[float] = Field(
133
- default=5,
140
+ default=5.0,
134
141
  description="A connection timeout, in seconds, applied to database connections. Defaults to `5`.",
135
142
  validation_alias=AliasChoices(
136
143
  AliasPath("connection_timeout"),
@@ -1,10 +1,14 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
4
6
 
5
7
 
6
8
  class ServerDeploymentsSettings(PrefectBaseSettings):
7
- model_config = _build_settings_config(("server", "deployments"))
9
+ model_config: ClassVar[ConfigDict] = _build_settings_config(
10
+ ("server", "deployments")
11
+ )
8
12
 
9
13
  concurrency_slot_wait_seconds: float = Field(
10
14
  default=30.0,
@@ -1,4 +1,6 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
4
6
 
@@ -8,7 +10,7 @@ class ServerEphemeralSettings(PrefectBaseSettings):
8
10
  Settings for controlling ephemeral server behavior
9
11
  """
10
12
 
11
- model_config = _build_settings_config(("server", "ephemeral"))
13
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("server", "ephemeral"))
12
14
 
13
15
  enabled: bool = Field(
14
16
  default=False,
@@ -1,6 +1,7 @@
1
1
  from datetime import timedelta
2
+ from typing import ClassVar
2
3
 
3
- from pydantic import AliasChoices, AliasPath, Field
4
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
4
5
 
5
6
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
6
7
 
@@ -10,7 +11,7 @@ class ServerEventsSettings(PrefectBaseSettings):
10
11
  Settings for controlling behavior of the events subsystem
11
12
  """
12
13
 
13
- model_config = _build_settings_config(("server", "events"))
14
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("server", "events"))
14
15
 
15
16
  ###########################################################################
16
17
  # Events settings
@@ -1,4 +1,6 @@
1
- from pydantic import AliasChoices, AliasPath, Field
1
+ from typing import ClassVar
2
+
3
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
2
4
 
3
5
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
4
6
 
@@ -8,7 +10,9 @@ class ServerFlowRunGraphSettings(PrefectBaseSettings):
8
10
  Settings for controlling behavior of the flow run graph
9
11
  """
10
12
 
11
- model_config = _build_settings_config(("server", "flow_run_graph"))
13
+ model_config: ClassVar[ConfigDict] = _build_settings_config(
14
+ ("server", "flow_run_graph")
15
+ )
12
16
 
13
17
  max_nodes: int = Field(
14
18
  default=10000,
@@ -1,7 +1,7 @@
1
1
  from pathlib import Path
2
- from typing import Optional
2
+ from typing import ClassVar, Optional
3
3
 
4
- from pydantic import AliasChoices, AliasPath, Field
4
+ from pydantic import AliasChoices, AliasPath, ConfigDict, Field
5
5
 
6
6
  from prefect.settings.base import PrefectBaseSettings, _build_settings_config
7
7
  from prefect.types import LogLevel
@@ -22,7 +22,7 @@ class ServerSettings(PrefectBaseSettings):
22
22
  Settings for controlling server behavior
23
23
  """
24
24
 
25
- model_config = _build_settings_config(("server",))
25
+ model_config: ClassVar[ConfigDict] = _build_settings_config(("server",))
26
26
 
27
27
  logging_level: LogLevel = Field(
28
28
  default="WARNING",