prefect-client 2.16.8__tar.gz → 2.17.0__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 (304) hide show
  1. {prefect-client-2.16.8 → prefect-client-2.17.0}/PKG-INFO +1 -1
  2. {prefect-client-2.16.8 → prefect-client-2.17.0}/requirements-client.txt +3 -2
  3. {prefect-client-2.16.8 → prefect-client-2.17.0}/requirements.txt +3 -1
  4. {prefect-client-2.16.8 → prefect-client-2.17.0}/setup.cfg +1 -0
  5. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/__init__.py +0 -18
  6. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/compatibility/deprecated.py +108 -5
  7. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/compatibility/experimental.py +9 -8
  8. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/api.py +23 -42
  9. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/waiters.py +25 -22
  10. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/__init__.py +16 -3
  11. prefect-client-2.17.0/src/prefect/_internal/pydantic/_base_model.py +51 -0
  12. prefect-client-2.17.0/src/prefect/_internal/pydantic/_compat.py +81 -0
  13. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/_flags.py +5 -0
  14. prefect-client-2.17.0/src/prefect/_internal/pydantic/_types.py +8 -0
  15. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/config_dict.py +72 -0
  16. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/field_validator.py +135 -0
  17. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_construct.py +56 -0
  18. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_copy.py +55 -0
  19. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_dump.py +136 -0
  20. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_dump_json.py +112 -0
  21. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_fields.py +50 -0
  22. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_fields_set.py +29 -0
  23. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_json_schema.py +82 -0
  24. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_rebuild.py +80 -0
  25. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_validate.py +75 -0
  26. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_validate_json.py +68 -0
  27. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/model_validator.py +79 -0
  28. prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities/type_adapter.py +71 -0
  29. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/schemas/bases.py +1 -17
  30. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/schemas/validators.py +425 -4
  31. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/agent.py +1 -1
  32. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/kubernetes.py +7 -3
  33. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/notifications.py +18 -18
  34. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/webhook.py +1 -1
  35. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/base.py +7 -0
  36. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/cloud.py +1 -1
  37. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/orchestration.py +51 -11
  38. prefect-client-2.17.0/src/prefect/client/schemas/actions.py +736 -0
  39. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/schemas/filters.py +28 -28
  40. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/schemas/objects.py +78 -147
  41. prefect-client-2.17.0/src/prefect/client/schemas/responses.py +431 -0
  42. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/schemas/schedules.py +6 -8
  43. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/concurrency/events.py +2 -2
  44. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/context.py +4 -2
  45. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/base.py +6 -13
  46. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/deployments.py +34 -9
  47. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/runner.py +9 -27
  48. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/base.py +5 -6
  49. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/docker.py +19 -25
  50. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/file.py +10 -5
  51. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/orion.py +9 -4
  52. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/serializers.py +8 -58
  53. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/engine.py +55 -618
  54. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/actions.py +16 -1
  55. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/clients.py +45 -13
  56. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/filters.py +19 -2
  57. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/related.py +4 -4
  58. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/schemas/automations.py +13 -2
  59. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/schemas/deployment_triggers.py +73 -5
  60. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/schemas/events.py +1 -1
  61. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/utilities.py +12 -4
  62. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/worker.py +26 -8
  63. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/exceptions.py +3 -8
  64. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/filesystems.py +7 -7
  65. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/flows.py +7 -3
  66. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/provisioners/ecs.py +1 -0
  67. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/configuration.py +2 -2
  68. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/manifests.py +1 -8
  69. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/profiles.toml +1 -1
  70. prefect-client-2.17.0/src/prefect/pydantic/__init__.py +76 -0
  71. prefect-client-2.17.0/src/prefect/pydantic/main.py +39 -0
  72. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/serializers.py +6 -31
  73. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/settings.py +72 -26
  74. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/software/python.py +3 -5
  75. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/task_server.py +2 -2
  76. prefect-client-2.17.0/src/prefect/utilities/__init__.py +0 -0
  77. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/callables.py +1 -1
  78. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/collections.py +2 -1
  79. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/dispatch.py +1 -0
  80. prefect-client-2.17.0/src/prefect/utilities/engine.py +629 -0
  81. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/pydantic.py +1 -1
  82. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/schema_tools/validation.py +2 -2
  83. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/visualization.py +1 -1
  84. prefect-client-2.17.0/src/prefect/variables.py +114 -0
  85. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/base.py +20 -11
  86. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/block.py +4 -8
  87. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/process.py +2 -5
  88. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect_client.egg-info/PKG-INFO +1 -1
  89. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect_client.egg-info/SOURCES.txt +17 -1
  90. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect_client.egg-info/requires.txt +3 -2
  91. prefect-client-2.16.8/src/prefect/_internal/pydantic/_base_model.py +0 -16
  92. prefect-client-2.16.8/src/prefect/_internal/pydantic/_compat.py +0 -464
  93. prefect-client-2.16.8/src/prefect/_internal/schemas/transformations.py +0 -106
  94. prefect-client-2.16.8/src/prefect/client/schemas/actions.py +0 -666
  95. prefect-client-2.16.8/src/prefect/client/schemas/responses.py +0 -251
  96. prefect-client-2.16.8/src/prefect/pydantic/__init__.py +0 -4
  97. prefect-client-2.16.8/src/prefect/pydantic/main.py +0 -15
  98. prefect-client-2.16.8/src/prefect/variables.py +0 -38
  99. {prefect-client-2.16.8 → prefect-client-2.17.0}/LICENSE +0 -0
  100. {prefect-client-2.16.8 → prefect-client-2.17.0}/MANIFEST.in +0 -0
  101. {prefect-client-2.16.8 → prefect-client-2.17.0}/README.md +0 -0
  102. {prefect-client-2.16.8 → prefect-client-2.17.0}/requirements-dev.txt +0 -0
  103. {prefect-client-2.16.8 → prefect-client-2.17.0}/setup.py +0 -0
  104. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/.prefectignore +0 -0
  105. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/__init__.py +0 -0
  106. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/_logging.py +0 -0
  107. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/compatibility/__init__.py +0 -0
  108. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/__init__.py +0 -0
  109. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/calls.py +0 -0
  110. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  111. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  112. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/inspection.py +0 -0
  113. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/primitives.py +0 -0
  114. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/services.py +0 -0
  115. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/concurrency/threads.py +0 -0
  116. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  117. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
  118. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/schemas.py +0 -0
  119. {prefect-client-2.16.8/src/prefect/_internal/schemas → prefect-client-2.17.0/src/prefect/_internal/pydantic/utilities}/__init__.py +0 -0
  120. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
  121. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
  122. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  123. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/pytz.py +0 -0
  124. {prefect-client-2.16.8/src/prefect/_vendor → prefect-client-2.17.0/src/prefect/_internal/schemas}/__init__.py +0 -0
  125. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/schemas/fields.py +0 -0
  126. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_internal/schemas/serializers.py +0 -0
  127. {prefect-client-2.16.8/src/prefect/_vendor/fastapi/dependencies → prefect-client-2.17.0/src/prefect/_vendor}/__init__.py +0 -0
  128. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/__init__.py +0 -0
  129. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/applications.py +0 -0
  130. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/background.py +0 -0
  131. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/concurrency.py +0 -0
  132. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/datastructures.py +0 -0
  133. {prefect-client-2.16.8/src/prefect/_vendor/fastapi/openapi → prefect-client-2.17.0/src/prefect/_vendor/fastapi/dependencies}/__init__.py +0 -0
  134. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/dependencies/models.py +0 -0
  135. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/dependencies/utils.py +0 -0
  136. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/encoders.py +0 -0
  137. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/exception_handlers.py +0 -0
  138. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/exceptions.py +0 -0
  139. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/logger.py +0 -0
  140. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/__init__.py +0 -0
  141. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/asyncexitstack.py +0 -0
  142. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/cors.py +0 -0
  143. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/gzip.py +0 -0
  144. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/httpsredirect.py +0 -0
  145. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/trustedhost.py +0 -0
  146. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/middleware/wsgi.py +0 -0
  147. {prefect-client-2.16.8/src/prefect/concurrency → prefect-client-2.17.0/src/prefect/_vendor/fastapi/openapi}/__init__.py +0 -0
  148. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/openapi/constants.py +0 -0
  149. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/openapi/docs.py +0 -0
  150. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/openapi/models.py +0 -0
  151. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/openapi/utils.py +0 -0
  152. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/param_functions.py +0 -0
  153. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/params.py +0 -0
  154. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/requests.py +0 -0
  155. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/responses.py +0 -0
  156. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/routing.py +0 -0
  157. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/__init__.py +0 -0
  158. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/api_key.py +0 -0
  159. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/base.py +0 -0
  160. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/http.py +0 -0
  161. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/oauth2.py +0 -0
  162. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/open_id_connect_url.py +0 -0
  163. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/security/utils.py +0 -0
  164. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/staticfiles.py +0 -0
  165. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/templating.py +0 -0
  166. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/testclient.py +0 -0
  167. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/types.py +0 -0
  168. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/utils.py +0 -0
  169. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/fastapi/websockets.py +0 -0
  170. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/__init__.py +0 -0
  171. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/_compat.py +0 -0
  172. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/_exception_handler.py +0 -0
  173. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/_utils.py +0 -0
  174. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/applications.py +0 -0
  175. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/authentication.py +0 -0
  176. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/background.py +0 -0
  177. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/concurrency.py +0 -0
  178. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/config.py +0 -0
  179. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/convertors.py +0 -0
  180. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/datastructures.py +0 -0
  181. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/endpoints.py +0 -0
  182. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/exceptions.py +0 -0
  183. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/formparsers.py +0 -0
  184. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/__init__.py +0 -0
  185. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/authentication.py +0 -0
  186. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/base.py +0 -0
  187. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/cors.py +0 -0
  188. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/errors.py +0 -0
  189. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/exceptions.py +0 -0
  190. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/gzip.py +0 -0
  191. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/httpsredirect.py +0 -0
  192. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/sessions.py +0 -0
  193. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/trustedhost.py +0 -0
  194. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/middleware/wsgi.py +0 -0
  195. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/requests.py +0 -0
  196. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/responses.py +0 -0
  197. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/routing.py +0 -0
  198. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/schemas.py +0 -0
  199. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/staticfiles.py +0 -0
  200. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/status.py +0 -0
  201. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/templating.py +0 -0
  202. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/testclient.py +0 -0
  203. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/types.py +0 -0
  204. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_vendor/starlette/websockets.py +0 -0
  205. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/_version.py +0 -0
  206. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/artifacts.py +0 -0
  207. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/__init__.py +0 -0
  208. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/abstract.py +0 -0
  209. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/core.py +0 -0
  210. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/fields.py +0 -0
  211. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/blocks/system.py +0 -0
  212. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/__init__.py +0 -0
  213. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/collections.py +0 -0
  214. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/constants.py +0 -0
  215. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/schemas/__init__.py +0 -0
  216. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/schemas/sorting.py +0 -0
  217. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/subscriptions.py +0 -0
  218. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/client/utilities.py +0 -0
  219. {prefect-client-2.16.8/src/prefect/deprecated → prefect-client-2.17.0/src/prefect/concurrency}/__init__.py +0 -0
  220. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/concurrency/asyncio.py +0 -0
  221. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/concurrency/common.py +0 -0
  222. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/concurrency/services.py +0 -0
  223. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/concurrency/sync.py +0 -0
  224. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/__init__.py +0 -0
  225. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/schedules.py +0 -0
  226. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/steps/__init__.py +0 -0
  227. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/steps/core.py +0 -0
  228. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/steps/pull.py +0 -0
  229. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deployments/steps/utility.py +0 -0
  230. {prefect-client-2.16.8/src/prefect/utilities → prefect-client-2.17.0/src/prefect/deprecated}/__init__.py +0 -0
  231. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/data_documents.py +0 -0
  232. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/deprecated/packaging/__init__.py +0 -0
  233. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/__init__.py +0 -0
  234. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/instrument.py +0 -0
  235. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/schemas/__init__.py +0 -0
  236. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/events/schemas/labelling.py +0 -0
  237. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/flow_runs.py +0 -0
  238. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/futures.py +0 -0
  239. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/__init__.py +0 -0
  240. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/base.py +0 -0
  241. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/container.py +0 -0
  242. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/kubernetes.py +0 -0
  243. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/process.py +0 -0
  244. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
  245. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  246. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  247. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  248. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/input/__init__.py +0 -0
  249. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/input/actions.py +0 -0
  250. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/input/run_input.py +0 -0
  251. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/__init__.py +0 -0
  252. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/filters.py +0 -0
  253. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/formatters.py +0 -0
  254. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/handlers.py +0 -0
  255. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/highlighters.py +0 -0
  256. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/loggers.py +0 -0
  257. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/logging/logging.yml +0 -0
  258. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/plugins.py +0 -0
  259. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/py.typed +0 -0
  260. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/results.py +0 -0
  261. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/__init__.py +0 -0
  262. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/runner.py +0 -0
  263. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/server.py +0 -0
  264. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/storage.py +0 -0
  265. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/submit.py +0 -0
  266. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runner/utils.py +0 -0
  267. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runtime/__init__.py +0 -0
  268. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runtime/deployment.py +0 -0
  269. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runtime/flow_run.py +0 -0
  270. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/runtime/task_run.py +0 -0
  271. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  272. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  273. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/software/__init__.py +0 -0
  274. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/software/base.py +0 -0
  275. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/software/conda.py +0 -0
  276. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/software/pip.py +0 -0
  277. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/states.py +0 -0
  278. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/task_engine.py +0 -0
  279. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/task_runners.py +0 -0
  280. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/tasks.py +0 -0
  281. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/annotations.py +0 -0
  282. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/asyncutils.py +0 -0
  283. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/compat.py +0 -0
  284. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/context.py +0 -0
  285. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/dockerutils.py +0 -0
  286. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/filesystem.py +0 -0
  287. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/hashing.py +0 -0
  288. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/importtools.py +0 -0
  289. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/math.py +0 -0
  290. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/names.py +0 -0
  291. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/processutils.py +0 -0
  292. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/render_swagger.py +0 -0
  293. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  294. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/schema_tools/hydration.py +0 -0
  295. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/services.py +0 -0
  296. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/slugify.py +0 -0
  297. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/templating.py +0 -0
  298. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/utilities/text.py +0 -0
  299. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/__init__.py +0 -0
  300. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/server.py +0 -0
  301. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect/workers/utilities.py +0 -0
  302. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect_client.egg-info/dependency_links.txt +0 -0
  303. {prefect-client-2.16.8 → prefect-client-2.17.0}/src/prefect_client.egg-info/top_level.txt +0 -0
  304. {prefect-client-2.16.8 → prefect-client-2.17.0}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 2.16.8
3
+ Version: 2.17.0
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -7,12 +7,12 @@ croniter >= 1.0.12, < 3.0.0
7
7
  fsspec >= 2022.5.0
8
8
  graphviz >= 0.20.1
9
9
  griffe >= 0.20.0
10
- httpcore >=0.15.0, < 2.0.0
10
+ httpcore >=1.0.5, < 2.0.0
11
11
  httpx[http2] >= 0.23, != 0.23.2
12
12
  importlib_metadata >= 4.4; python_version < '3.10'
13
13
  importlib-resources >= 6.1.3, < 6.2.0
14
14
  jsonpatch >= 1.32, < 2.0
15
- jsonschema >= 3.2.0, < 5.0.0
15
+ jsonschema >= 4.0.0, < 5.0.0
16
16
  orjson >= 3.7, < 4.0
17
17
  packaging >= 21.3, < 24.3
18
18
  pathspec >= 0.8.0
@@ -21,6 +21,7 @@ pendulum < 3.0; python_version < '3.12'
21
21
  pendulum >= 3.0.0, <4; python_version >= '3.12'
22
22
  # the version constraints for pydantic are merged with those from fastapi 0.103.2
23
23
  pydantic[email]>=1.10.0,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0
24
+ pydantic_core >= 2.12.0, < 3.0.0
24
25
  python_dateutil >= 2.8.2, < 3.0.0
25
26
  python-slugify >= 5.0, < 9.0
26
27
  pyyaml >= 5.4.1, < 7.0.0
@@ -11,8 +11,10 @@ docker >= 4.0, < 7.0
11
11
  graphviz >= 0.20.1
12
12
  griffe >= 0.20.0
13
13
  jinja2 >= 3.0.0, < 4.0.0
14
+ jinja2-humanize-extension >= 0.4.0
15
+ humanize >= 4.9.0
14
16
  kubernetes >= 24.2.0, < 30.0.0
15
17
  pytz >= 2021.1, < 2025
16
18
  readchar >= 4.0.0, < 5.0.0
17
19
  sqlalchemy[asyncio] >= 1.4.22, != 1.4.33, < 3.0.0
18
- typer >= 0.4.2
20
+ typer >= 0.12.0, != 0.12.2, < 0.13.0
@@ -13,6 +13,7 @@ markers =
13
13
  clear_db: marker to clear the database after test completion
14
14
  env =
15
15
  PREFECT_TEST_MODE = 1
16
+ PREFECT_LOGGING_SERVER_LEVEL = DEBUG
16
17
  asyncio_mode = auto
17
18
  timeout = 90
18
19
  filterwarnings =
@@ -106,24 +106,6 @@ from prefect._internal.compatibility.deprecated import (
106
106
  register_renamed_module,
107
107
  )
108
108
 
109
- register_renamed_module(
110
- "prefect.client.orchestration",
111
- "prefect.client.orchestration",
112
- start_date="Feb 2023",
113
- )
114
- register_renamed_module(
115
- "prefect.docker",
116
- "prefect.utilities.dockerutils",
117
- start_date="Mar 2023",
118
- )
119
- register_renamed_module(
120
- "prefect.infrastructure.docker",
121
- "prefect.infrastructure.container",
122
- start_date="Mar 2023",
123
- )
124
- register_renamed_module(
125
- "prefect.projects", "prefect.deployments", start_date="Jun 2023"
126
- )
127
109
  register_renamed_module(
128
110
  "prefect.packaging", "prefect.deprecated.packaging", start_date="Mar 2024"
129
111
  )
@@ -12,16 +12,18 @@ e.g. Jan 2023.
12
12
  import functools
13
13
  import sys
14
14
  import warnings
15
- from typing import Any, Callable, List, Optional, Type, TypeVar
15
+ from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
16
16
 
17
17
  import pendulum
18
18
 
19
19
  from prefect._internal.pydantic import HAS_PYDANTIC_V2
20
20
 
21
21
  if HAS_PYDANTIC_V2:
22
- import pydantic.v1 as pydantic
22
+ from pydantic.v1 import BaseModel, Field, root_validator
23
+ from pydantic.v1.schema import default_ref_template
23
24
  else:
24
- import pydantic
25
+ from pydantic import BaseModel, Field, root_validator
26
+ from pydantic.schema import default_ref_template
25
27
 
26
28
  from prefect.utilities.callables import get_call_parameters
27
29
  from prefect.utilities.importtools import (
@@ -31,7 +33,7 @@ from prefect.utilities.importtools import (
31
33
  )
32
34
 
33
35
  T = TypeVar("T", bound=Callable)
34
- M = TypeVar("M", bound=pydantic.BaseModel)
36
+ M = TypeVar("M", bound=BaseModel)
35
37
 
36
38
 
37
39
  DEPRECATED_WARNING = (
@@ -207,7 +209,7 @@ def deprecated_field(
207
209
  ```python
208
210
 
209
211
  @deprecated_field("x", when=lambda x: x is not None)
210
- class Model(pydantic.BaseModel)
212
+ class Model(BaseModel)
211
213
  x: Optional[int] = None
212
214
  y: str
213
215
  ```
@@ -276,3 +278,104 @@ def register_renamed_module(old_name: str, new_name: str, start_date: str):
276
278
  DEPRECATED_MODULE_ALIASES.append(
277
279
  AliasedModuleDefinition(old_name, new_name, callback)
278
280
  )
281
+
282
+
283
+ class DeprecatedInfraOverridesField(BaseModel):
284
+ """
285
+ A model mixin that handles the deprecated `infra_overrides` field.
286
+
287
+ The `infra_overrides` field has been renamed to `job_variables`. This mixin maintains
288
+ backwards compatibility with users of the `infra_overrides` field while presenting
289
+ `job_variables` as the user-facing field.
290
+
291
+ When we remove support for `infra_overrides`, we can remove this class as a parent of
292
+ all schemas that use it, leaving them with only the `job_variables` field.
293
+ """
294
+
295
+ infra_overrides: Optional[Dict[str, Any]] = Field(
296
+ default_factory=dict,
297
+ description="Deprecated field. Use `job_variables` instead.",
298
+ )
299
+
300
+ @root_validator(pre=True)
301
+ def _job_variables_from_infra_overrides(
302
+ cls, values: Dict[str, Any]
303
+ ) -> Dict[str, Any]:
304
+ """
305
+ Validate that only one of `infra_overrides` or `job_variables` is used
306
+ and keep them in sync during init.
307
+ """
308
+ job_variables = values.get("job_variables")
309
+ infra_overrides = values.get("infra_overrides")
310
+
311
+ if job_variables is not None and infra_overrides is not None:
312
+ if job_variables != infra_overrides:
313
+ raise ValueError(
314
+ "The `infra_overrides` field has been renamed to `job_variables`."
315
+ "Use one of these fields, but not both."
316
+ )
317
+ return values
318
+ elif job_variables is not None and infra_overrides is None:
319
+ values["infra_overrides"] = job_variables
320
+ elif job_variables is None and infra_overrides is not None:
321
+ values["job_variables"] = infra_overrides
322
+ return values
323
+
324
+ def __setattr__(self, key: str, value: Any) -> None:
325
+ """
326
+ Override the default __setattr__ to ensure that setting `infra_overrides` or
327
+ `job_variables` will update both fields.
328
+ """
329
+ if key == "infra_overrides" or key == "job_variables":
330
+ updates = {"infra_overrides": value, "job_variables": value}
331
+ self.__dict__.update(updates)
332
+ return
333
+ super().__setattr__(key, value)
334
+
335
+ def dict(self, **kwargs) -> Dict[str, Any]:
336
+ """
337
+ Override the default dict method to ensure only `infra_overrides` is serialized.
338
+ This preserves backwards compatibility for newer clients talking to older servers.
339
+ """
340
+ exclude: Union[set, Dict[str, Any]] = kwargs.pop("exclude", set())
341
+ exclude_type = type(exclude)
342
+
343
+ if exclude_type is set:
344
+ exclude.add("job_variables")
345
+ elif exclude_type is dict:
346
+ exclude["job_variables"] = True
347
+ kwargs["exclude"] = exclude
348
+
349
+ return super().dict(**kwargs)
350
+
351
+ @classmethod
352
+ def schema(
353
+ cls, by_alias: bool = True, ref_template: str = default_ref_template
354
+ ) -> Dict[str, Any]:
355
+ """
356
+ Don't use the mixin docstring as the description if this class is missing a
357
+ docstring.
358
+ """
359
+ schema = super().schema(by_alias=by_alias, ref_template=ref_template)
360
+
361
+ if not cls.__doc__:
362
+ schema.pop("description", None)
363
+
364
+ return schema
365
+
366
+
367
+ def handle_deprecated_infra_overrides_parameter(
368
+ job_variables: Dict[str, Any], infra_overrides: Dict[str, Any]
369
+ ) -> Optional[Dict[str, Any]]:
370
+ if infra_overrides is not None and job_variables is not None:
371
+ raise RuntimeError(
372
+ "The `infra_overrides` argument has been renamed to `job_variables`."
373
+ "Use one or the other, but not both."
374
+ )
375
+ elif infra_overrides is not None and job_variables is None:
376
+ jv = infra_overrides
377
+ elif job_variables is not None and infra_overrides is None:
378
+ jv = job_variables
379
+ else:
380
+ jv = None
381
+ return jv
@@ -10,6 +10,7 @@ Warnings may also be disabled globally with the setting `PREFECT_EXPERIMENTAL_WA
10
10
  Some experimental features require opt-in to enable any usage. These require the setting
11
11
  `PREFECT_EXPERIMENTAL_ENABLE_<GROUP>` to be set or an error will be thrown on use.
12
12
  """
13
+
13
14
  import functools
14
15
  import warnings
15
16
  from typing import Any, Callable, Optional, Set, Type, TypeVar
@@ -24,7 +25,7 @@ else:
24
25
  from prefect.settings import PREFECT_EXPERIMENTAL_WARN, SETTING_VARIABLES, Setting
25
26
  from prefect.utilities.callables import get_call_parameters
26
27
 
27
- T = TypeVar("T", bound=Callable)
28
+ T = TypeVar("T", bound=Callable[..., Any])
28
29
  M = TypeVar("M", bound=pydantic.BaseModel)
29
30
 
30
31
 
@@ -47,12 +48,6 @@ class ExperimentalWarning(Warning):
47
48
  """
48
49
 
49
50
 
50
- class ExperimentalError(Exception):
51
- """
52
- An exception related to experimental code.
53
- """
54
-
55
-
56
51
  class ExperimentalFeature(ExperimentalWarning):
57
52
  """
58
53
  A warning displayed on use of an experimental feature.
@@ -61,6 +56,12 @@ class ExperimentalFeature(ExperimentalWarning):
61
56
  """
62
57
 
63
58
 
59
+ class ExperimentalError(Exception):
60
+ """
61
+ An exception related to experimental code.
62
+ """
63
+
64
+
64
65
  class ExperimentalFeatureDisabled(ExperimentalError):
65
66
  """
66
67
  An error displayed on use of a disabled experimental feature that requires opt-in.
@@ -112,7 +113,7 @@ def experimental(
112
113
 
113
114
  group_warn = _warn_setting_for_group(group)
114
115
 
115
- def decorator(fn: T):
116
+ def decorator(fn: T) -> T:
116
117
  @functools.wraps(fn)
117
118
  def wrapper(*args, **kwargs):
118
119
  if opt_in and not group_opt_in:
@@ -1,6 +1,7 @@
1
1
  """
2
2
  Primary developer-facing API for concurrency management.
3
3
  """
4
+
4
5
  import abc
5
6
  import asyncio
6
7
  import concurrent.futures
@@ -18,6 +19,7 @@ from typing import (
18
19
 
19
20
  from typing_extensions import ParamSpec
20
21
 
22
+ from prefect._internal.concurrency.calls import get_current_call
21
23
  from prefect._internal.concurrency.threads import (
22
24
  WorkerThread,
23
25
  get_global_loop,
@@ -104,40 +106,6 @@ class _base(abc.ABC):
104
106
  runner.submit(call)
105
107
  return call
106
108
 
107
- @staticmethod
108
- def call_soon_in_waiting_thread(
109
- __call: Union[Callable[[], T], Call[T]],
110
- thread: threading.Thread,
111
- timeout: Optional[float] = None,
112
- ) -> Call[T]:
113
- """
114
- Schedule a call for execution in the thread that is waiting for the current
115
- call.
116
-
117
- Returns the submitted call.
118
- """
119
- call = _cast_to_call(__call)
120
- waiter = get_waiter_for_thread(thread)
121
- if waiter is None:
122
- raise RuntimeError(f"No waiter found for thread {thread}.")
123
-
124
- call.set_timeout(timeout)
125
- waiter.submit(call)
126
- return call
127
-
128
- @staticmethod
129
- def call_in_waiting_thread(
130
- __call: Union[Callable[[], T], Call[T]],
131
- thread: threading.Thread,
132
- timeout: Optional[float] = None,
133
- ) -> T:
134
- """
135
- Run a call in the thread that is waiting for the current call.
136
-
137
- Returns the result of the call.
138
- """
139
- raise NotImplementedError()
140
-
141
109
  @staticmethod
142
110
  def call_in_new_thread(
143
111
  __call: Union[Callable[[], T], Call[T]], timeout: Optional[float] = None
@@ -196,13 +164,20 @@ class from_async(_base):
196
164
  return call.result()
197
165
 
198
166
  @staticmethod
199
- def call_in_waiting_thread(
167
+ def call_soon_in_waiting_thread(
200
168
  __call: Union[Callable[[], T], Call[T]],
201
169
  thread: threading.Thread,
202
170
  timeout: Optional[float] = None,
203
- ) -> Awaitable[T]:
204
- call = _base.call_soon_in_waiting_thread(__call, thread, timeout=timeout)
205
- return call.aresult()
171
+ ) -> Call[T]:
172
+ call = _cast_to_call(__call)
173
+ parent_call = get_current_call()
174
+ waiter = get_waiter_for_thread(thread, parent_call)
175
+ if waiter is None:
176
+ raise RuntimeError(f"No waiter found for thread {thread}.")
177
+
178
+ call.set_timeout(timeout)
179
+ waiter.submit(call)
180
+ return call
206
181
 
207
182
  @staticmethod
208
183
  def call_in_new_thread(
@@ -257,13 +232,19 @@ class from_sync(_base):
257
232
  return call.result()
258
233
 
259
234
  @staticmethod
260
- def call_in_waiting_thread(
235
+ def call_soon_in_waiting_thread(
261
236
  __call: Union[Callable[[], T], Call[T]],
262
237
  thread: threading.Thread,
263
238
  timeout: Optional[float] = None,
264
- ) -> T:
265
- call = _base.call_soon_in_waiting_thread(__call, thread, timeout=timeout)
266
- return call.result()
239
+ ) -> Call[T]:
240
+ call = _cast_to_call(__call)
241
+ waiter = get_waiter_for_thread(thread)
242
+ if waiter is None:
243
+ raise RuntimeError(f"No waiter found for thread {thread}.")
244
+
245
+ call.set_timeout(timeout)
246
+ waiter.submit(call)
247
+ return call
267
248
 
268
249
  @staticmethod
269
250
  def call_in_new_thread(
@@ -9,9 +9,9 @@ import contextlib
9
9
  import inspect
10
10
  import queue
11
11
  import threading
12
- import weakref
13
12
  from collections import deque
14
13
  from typing import Awaitable, Generic, List, Optional, TypeVar, Union
14
+ from weakref import WeakKeyDictionary
15
15
 
16
16
  import anyio
17
17
 
@@ -24,34 +24,37 @@ T = TypeVar("T")
24
24
 
25
25
 
26
26
  # Waiters are stored in a stack for each thread
27
- _WAITERS_BY_THREAD: "weakref.WeakKeyDictionary[threading.Thread, deque[Waiter]]" = (
28
- weakref.WeakKeyDictionary()
27
+ _WAITERS_BY_THREAD: "WeakKeyDictionary[threading.Thread, deque[Waiter]]" = (
28
+ WeakKeyDictionary()
29
29
  )
30
30
 
31
31
 
32
- def get_waiter_for_thread(thread: threading.Thread) -> Optional["Waiter"]:
32
+ def get_waiter_for_thread(
33
+ thread: threading.Thread, parent_call: Optional[Call] = None
34
+ ) -> Optional["Waiter"]:
33
35
  """
34
- Get the current waiter for a thread.
36
+ Get the current waiter for a thread and an optional parent call.
35
37
 
36
- Returns `None` if one does not exist.
38
+ To avoid assigning outer callbacks to inner waiters in the case of nested calls,
39
+ the parent call is used to determine which waiter to return. If a parent call is
40
+ not provided, we return the most recently created waiter (last in the stack).
41
+
42
+ see https://github.com/PrefectHQ/prefect/issues/12036
43
+
44
+ Returns `None` if no active waiter is found for the thread.
37
45
  """
38
- waiters = _WAITERS_BY_THREAD.get(thread)
39
-
40
- if waiters:
41
- idx = -1
42
- while abs(idx) <= len(waiters):
43
- try:
44
- waiter = waiters[idx]
45
- if not waiter.call_is_done():
46
- return waiter
47
- idx = idx - 1
48
- # It is possible that items are being added or removed
49
- # from the deque, so the index we're using may not always
50
- # be valid.
51
- except IndexError:
52
- break
53
46
 
54
- return None
47
+ waiters: "Optional[deque[Waiter]]" = _WAITERS_BY_THREAD.get(thread)
48
+
49
+ if waiters and (active_waiters := [w for w in waiters if not w.call_is_done()]):
50
+ if parent_call and (
51
+ matching_waiter := next(
52
+ (w for w in active_waiters if w._call == parent_call), None
53
+ )
54
+ ): # if exists an active waiter responsible for the parent call, return it
55
+ return matching_waiter
56
+ else: # otherwise, return the most recently created waiter
57
+ return active_waiters[-1]
55
58
 
56
59
 
57
60
  def add_waiter_for_thread(waiter: "Waiter", thread: threading.Thread):
@@ -6,21 +6,27 @@
6
6
  ### This is a tradeoff we're willing to make for now until pydantic v1 is
7
7
  ### no longer supported.
8
8
 
9
- from pydantic.version import VERSION as PYDANTIC_VERSION
10
9
 
11
- HAS_PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")
10
+ from ._flags import HAS_PYDANTIC_V2
12
11
 
13
12
  from ._compat import (
14
13
  model_dump,
15
14
  model_json_schema,
16
15
  model_validate,
17
- IncEx,
18
16
  model_dump_json,
19
17
  model_copy,
20
18
  model_validate_json,
19
+ TypeAdapter,
21
20
  validate_python,
21
+ BaseModel,
22
+ Field,
23
+ FieldInfo,
24
+ field_validator,
25
+ model_validator,
22
26
  )
23
27
 
28
+ from ._types import IncEx
29
+
24
30
  __all__ = [
25
31
  "model_dump",
26
32
  "model_json_schema",
@@ -29,5 +35,12 @@ __all__ = [
29
35
  "model_dump_json",
30
36
  "model_copy",
31
37
  "model_validate_json",
38
+ "TypeAdapter",
32
39
  "validate_python",
40
+ "BaseModel",
41
+ "HAS_PYDANTIC_V2",
42
+ "Field",
43
+ "FieldInfo",
44
+ "field_validator",
45
+ "model_validator",
33
46
  ]
@@ -0,0 +1,51 @@
1
+ """
2
+ This file introduces a conditional import of `BaseModel` from Pydantic, depending on the Pydantic version available. If Pydantic V2 is not used, it falls back to importing `BaseModel` from Pydantic V1. This is to ensure compatibility with different versions of Pydantic.
3
+ """
4
+ import typing
5
+
6
+ from prefect._internal.pydantic._flags import (
7
+ HAS_PYDANTIC_V2,
8
+ USE_PYDANTIC_V2,
9
+ )
10
+
11
+ if typing.TYPE_CHECKING:
12
+ from pydantic import (
13
+ BaseModel,
14
+ ConfigDict,
15
+ Field,
16
+ PrivateAttr,
17
+ SecretStr,
18
+ ValidationError,
19
+ )
20
+ from pydantic.fields import FieldInfo
21
+
22
+ if HAS_PYDANTIC_V2 and not USE_PYDANTIC_V2:
23
+ from pydantic.v1 import (
24
+ BaseModel,
25
+ ConfigDict,
26
+ Field,
27
+ PrivateAttr,
28
+ SecretStr,
29
+ ValidationError,
30
+ )
31
+ from pydantic.v1.fields import FieldInfo
32
+ else:
33
+ from pydantic import (
34
+ BaseModel,
35
+ ConfigDict,
36
+ Field,
37
+ PrivateAttr,
38
+ SecretStr,
39
+ ValidationError,
40
+ )
41
+ from pydantic.fields import FieldInfo
42
+
43
+ __all__ = [
44
+ "BaseModel",
45
+ "Field",
46
+ "FieldInfo",
47
+ "PrivateAttr",
48
+ "SecretStr",
49
+ "ConfigDict",
50
+ "ValidationError",
51
+ ]
@@ -0,0 +1,81 @@
1
+ """
2
+ Functions within this module check for Pydantic V2 compatibility and provide mechanisms for copying,
3
+ dumping, and validating models in a way that is agnostic to the underlying Pydantic version.
4
+ """
5
+ import typing
6
+
7
+ from ._base_model import BaseModel as PydanticBaseModel
8
+ from ._base_model import (
9
+ ConfigDict,
10
+ Field,
11
+ FieldInfo,
12
+ PrivateAttr,
13
+ SecretStr,
14
+ ValidationError,
15
+ )
16
+ from ._flags import HAS_PYDANTIC_V2, USE_PYDANTIC_V2
17
+ from .utilities.config_dict import ConfigMixin
18
+ from .utilities.field_validator import field_validator
19
+ from .utilities.model_construct import ModelConstructMixin, model_construct
20
+ from .utilities.model_copy import ModelCopyMixin, model_copy
21
+ from .utilities.model_dump import ModelDumpMixin, model_dump
22
+ from .utilities.model_dump_json import ModelDumpJsonMixin, model_dump_json
23
+ from .utilities.model_fields import ModelFieldMixin
24
+ from .utilities.model_fields_set import ModelFieldsSetMixin, model_fields_set
25
+ from .utilities.model_json_schema import ModelJsonSchemaMixin, model_json_schema
26
+ from .utilities.model_validate import ModelValidateMixin, model_validate
27
+ from .utilities.model_validate_json import ModelValidateJsonMixin, model_validate_json
28
+ from .utilities.model_validator import model_validator
29
+ from .utilities.type_adapter import TypeAdapter, validate_python
30
+
31
+ if typing.TYPE_CHECKING:
32
+
33
+ class BaseModel(PydanticBaseModel): # type: ignore
34
+ pass
35
+
36
+ elif HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
37
+ # In this case, there's no functionality to add, so we just alias the Pydantic v2 BaseModel
38
+ class BaseModel(PydanticBaseModel): # type: ignore
39
+ pass
40
+
41
+ else:
42
+ # In this case, we're working with a Pydantic v1 model, so we need to add Pydantic v2 functionality
43
+ # TODO: Find a smarter way of attaching these methods so that they don't need to be redefined
44
+
45
+ class BaseModel(
46
+ ModelConstructMixin,
47
+ ModelCopyMixin,
48
+ ModelDumpMixin,
49
+ ModelDumpJsonMixin,
50
+ ModelJsonSchemaMixin,
51
+ ModelValidateMixin,
52
+ ModelValidateJsonMixin,
53
+ ModelFieldMixin,
54
+ ConfigMixin,
55
+ ModelFieldsSetMixin,
56
+ PydanticBaseModel,
57
+ ):
58
+ pass
59
+
60
+
61
+ __all__ = [
62
+ "model_construct",
63
+ "model_copy",
64
+ "model_dump",
65
+ "model_dump_json",
66
+ "model_json_schema",
67
+ "model_validate",
68
+ "model_validate_json",
69
+ "model_fields_set",
70
+ "TypeAdapter",
71
+ "validate_python",
72
+ "BaseModel",
73
+ "Field",
74
+ "FieldInfo",
75
+ "field_validator",
76
+ "model_validator",
77
+ "PrivateAttr",
78
+ "SecretStr",
79
+ "ConfigDict",
80
+ "ValidationError",
81
+ ]
@@ -1,3 +1,6 @@
1
+ """
2
+ This file defines flags that determine whether Pydantic V2 is available and whether its features should be used.
3
+ """
1
4
  import os
2
5
 
3
6
  # Retrieve current version of Pydantic installed in environment
@@ -11,5 +14,7 @@ USE_PYDANTIC_V2 = os.environ.get(
11
14
  "PREFECT_EXPERIMENTAL_ENABLE_PYDANTIC_V2_INTERNALS", False
12
15
  ) in {"1", "true", "True"}
13
16
 
17
+ USE_V2_MODELS = HAS_PYDANTIC_V2 and USE_PYDANTIC_V2
18
+
14
19
  # Set to True if Pydantic v2 is present but not enabled, indicating deprecation warnings may occur.
15
20
  EXPECT_DEPRECATION_WARNINGS = HAS_PYDANTIC_V2 and not USE_PYDANTIC_V2
@@ -0,0 +1,8 @@
1
+ from typing import Any, Dict, Literal, Set, Union
2
+
3
+ from typing_extensions import TypeAlias
4
+
5
+ IncEx: TypeAlias = "Union[Set[int], Set[str], Dict[int, Any], Dict[str, Any], None]"
6
+
7
+ DEFAULT_REF_TEMPLATE = "#/$defs/{model}"
8
+ JsonSchemaMode = Literal["validation", "serialization"]