prefect-client 2.16.5__py3-none-any.whl → 2.16.7__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 (49) hide show
  1. prefect/_internal/pydantic/__init__.py +21 -1
  2. prefect/_internal/pydantic/_base_model.py +16 -0
  3. prefect/_internal/pydantic/_compat.py +352 -68
  4. prefect/_internal/pydantic/_flags.py +15 -0
  5. prefect/_internal/pydantic/v1_schema.py +48 -0
  6. prefect/_internal/pydantic/v2_schema.py +6 -2
  7. prefect/_internal/schemas/validators.py +582 -9
  8. prefect/artifacts.py +179 -70
  9. prefect/client/cloud.py +4 -1
  10. prefect/client/orchestration.py +1 -1
  11. prefect/client/schemas/actions.py +2 -2
  12. prefect/client/schemas/objects.py +13 -24
  13. prefect/client/schemas/schedules.py +18 -80
  14. prefect/deployments/deployments.py +22 -86
  15. prefect/deployments/runner.py +8 -11
  16. prefect/events/__init__.py +40 -1
  17. prefect/events/clients.py +17 -20
  18. prefect/events/filters.py +5 -6
  19. prefect/events/related.py +1 -1
  20. prefect/events/schemas/__init__.py +5 -0
  21. prefect/events/schemas/automations.py +303 -0
  22. prefect/events/{schemas.py → schemas/deployment_triggers.py} +146 -270
  23. prefect/events/schemas/events.py +285 -0
  24. prefect/events/schemas/labelling.py +106 -0
  25. prefect/events/utilities.py +2 -2
  26. prefect/events/worker.py +1 -1
  27. prefect/filesystems.py +8 -37
  28. prefect/flows.py +4 -4
  29. prefect/infrastructure/kubernetes.py +12 -56
  30. prefect/infrastructure/provisioners/__init__.py +1 -0
  31. prefect/pydantic/__init__.py +4 -0
  32. prefect/pydantic/main.py +15 -0
  33. prefect/runner/runner.py +2 -2
  34. prefect/runner/server.py +1 -1
  35. prefect/serializers.py +13 -61
  36. prefect/settings.py +35 -13
  37. prefect/task_server.py +21 -7
  38. prefect/utilities/asyncutils.py +1 -1
  39. prefect/utilities/callables.py +2 -2
  40. prefect/utilities/context.py +33 -1
  41. prefect/utilities/schema_tools/hydration.py +14 -6
  42. prefect/workers/base.py +1 -2
  43. prefect/workers/block.py +3 -7
  44. {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/METADATA +2 -2
  45. {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/RECORD +48 -40
  46. prefect/utilities/validation.py +0 -63
  47. {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/LICENSE +0 -0
  48. {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/WHEEL +0 -0
  49. {prefect_client-2.16.5.dist-info → prefect_client-2.16.7.dist-info}/top_level.txt +0 -0
@@ -1,63 +0,0 @@
1
- import jsonschema
2
-
3
- from prefect.utilities.collections import remove_nested_keys
4
-
5
-
6
- def validate_schema(schema: dict):
7
- """
8
- Validate that the provided schema is a valid json schema.
9
-
10
- Args:
11
- schema: The schema to validate.
12
-
13
- Raises:
14
- ValueError: If the provided schema is not a valid json schema.
15
-
16
- """
17
- try:
18
- if schema is not None:
19
- # Most closely matches the schemas generated by pydantic
20
- jsonschema.Draft4Validator.check_schema(schema)
21
- except jsonschema.SchemaError as exc:
22
- raise ValueError(
23
- "The provided schema is not a valid json schema. Schema error:"
24
- f" {exc.message}"
25
- ) from exc
26
-
27
-
28
- def validate_values_conform_to_schema(
29
- values: dict, schema: dict, ignore_required: bool = False
30
- ):
31
- """
32
- Validate that the provided values conform to the provided json schema.
33
-
34
- Args:
35
- values: The values to validate.
36
- schema: The schema to validate against.
37
- ignore_required: Whether to ignore the required fields in the schema. Should be
38
- used when a partial set of values is acceptable.
39
-
40
- Raises:
41
- ValueError: If the parameters do not conform to the schema.
42
-
43
- """
44
- if ignore_required:
45
- schema = remove_nested_keys(["required"], schema)
46
-
47
- try:
48
- if schema is not None and values is not None:
49
- jsonschema.validate(values, schema)
50
- except jsonschema.ValidationError as exc:
51
- if exc.json_path == "$":
52
- error_message = "Validation failed."
53
- else:
54
- error_message = (
55
- f"Validation failed for field {exc.json_path.replace('$.', '')!r}."
56
- )
57
- error_message += f" Failure reason: {exc.message}"
58
- raise ValueError(error_message) from exc
59
- except jsonschema.SchemaError as exc:
60
- raise ValueError(
61
- "The provided schema is not a valid json schema. Schema error:"
62
- f" {exc.message}"
63
- ) from exc