prefect-client 2.16.5__tar.gz → 2.16.7__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 (286) hide show
  1. {prefect-client-2.16.5 → prefect-client-2.16.7}/PKG-INFO +1 -1
  2. {prefect-client-2.16.5 → prefect-client-2.16.7}/requirements-client.txt +1 -1
  3. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/__init__.py +21 -1
  4. prefect-client-2.16.7/src/prefect/_internal/pydantic/_base_model.py +16 -0
  5. prefect-client-2.16.7/src/prefect/_internal/pydantic/_compat.py +464 -0
  6. prefect-client-2.16.7/src/prefect/_internal/pydantic/_flags.py +15 -0
  7. prefect-client-2.16.7/src/prefect/_internal/pydantic/v1_schema.py +48 -0
  8. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/v2_schema.py +6 -2
  9. prefect-client-2.16.7/src/prefect/_internal/schemas/validators.py +609 -0
  10. prefect-client-2.16.7/src/prefect/artifacts.py +294 -0
  11. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/cloud.py +4 -1
  12. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/orchestration.py +1 -1
  13. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/actions.py +2 -2
  14. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/objects.py +13 -24
  15. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/schedules.py +18 -80
  16. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/deployments.py +22 -86
  17. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/runner.py +8 -11
  18. prefect-client-2.16.7/src/prefect/events/__init__.py +48 -0
  19. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/clients.py +17 -20
  20. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/filters.py +5 -6
  21. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/related.py +1 -1
  22. prefect-client-2.16.7/src/prefect/events/schemas/__init__.py +5 -0
  23. prefect-client-2.16.7/src/prefect/events/schemas/automations.py +303 -0
  24. prefect-client-2.16.5/src/prefect/events/schemas.py → prefect-client-2.16.7/src/prefect/events/schemas/deployment_triggers.py +146 -270
  25. prefect-client-2.16.7/src/prefect/events/schemas/events.py +285 -0
  26. prefect-client-2.16.7/src/prefect/events/schemas/labelling.py +106 -0
  27. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/utilities.py +2 -2
  28. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/worker.py +1 -1
  29. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/filesystems.py +8 -37
  30. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/flows.py +4 -4
  31. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/kubernetes.py +12 -56
  32. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/provisioners/__init__.py +1 -0
  33. prefect-client-2.16.7/src/prefect/pydantic/__init__.py +4 -0
  34. prefect-client-2.16.7/src/prefect/pydantic/main.py +15 -0
  35. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/runner.py +2 -2
  36. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/server.py +1 -1
  37. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/serializers.py +13 -61
  38. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/settings.py +35 -13
  39. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/task_server.py +21 -7
  40. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/asyncutils.py +1 -1
  41. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/callables.py +2 -2
  42. prefect-client-2.16.7/src/prefect/utilities/context.py +48 -0
  43. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/schema_tools/hydration.py +14 -6
  44. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/base.py +1 -2
  45. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/block.py +3 -7
  46. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect_client.egg-info/PKG-INFO +1 -1
  47. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect_client.egg-info/SOURCES.txt +10 -2
  48. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect_client.egg-info/requires.txt +1 -1
  49. prefect-client-2.16.5/src/prefect/_internal/pydantic/_compat.py +0 -180
  50. prefect-client-2.16.5/src/prefect/_internal/schemas/validators.py +0 -36
  51. prefect-client-2.16.5/src/prefect/artifacts.py +0 -185
  52. prefect-client-2.16.5/src/prefect/events/__init__.py +0 -9
  53. prefect-client-2.16.5/src/prefect/utilities/context.py +0 -16
  54. prefect-client-2.16.5/src/prefect/utilities/validation.py +0 -63
  55. {prefect-client-2.16.5 → prefect-client-2.16.7}/LICENSE +0 -0
  56. {prefect-client-2.16.5 → prefect-client-2.16.7}/MANIFEST.in +0 -0
  57. {prefect-client-2.16.5 → prefect-client-2.16.7}/README.md +0 -0
  58. {prefect-client-2.16.5 → prefect-client-2.16.7}/requirements-dev.txt +0 -0
  59. {prefect-client-2.16.5 → prefect-client-2.16.7}/requirements.txt +0 -0
  60. {prefect-client-2.16.5 → prefect-client-2.16.7}/setup.cfg +0 -0
  61. {prefect-client-2.16.5 → prefect-client-2.16.7}/setup.py +0 -0
  62. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/.prefectignore +0 -0
  63. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/__init__.py +0 -0
  64. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/__init__.py +0 -0
  65. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/_logging.py +0 -0
  66. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/compatibility/__init__.py +0 -0
  67. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/compatibility/deprecated.py +0 -0
  68. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/compatibility/experimental.py +0 -0
  69. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/__init__.py +0 -0
  70. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/api.py +0 -0
  71. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/calls.py +0 -0
  72. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  73. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  74. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/inspection.py +0 -0
  75. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/primitives.py +0 -0
  76. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/services.py +0 -0
  77. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/threads.py +0 -0
  78. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/concurrency/waiters.py +0 -0
  79. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  80. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
  81. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/schemas.py +0 -0
  82. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  83. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/pytz.py +0 -0
  84. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/schemas/__init__.py +0 -0
  85. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/schemas/bases.py +0 -0
  86. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/schemas/fields.py +0 -0
  87. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/schemas/serializers.py +0 -0
  88. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_internal/schemas/transformations.py +0 -0
  89. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/__init__.py +0 -0
  90. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/__init__.py +0 -0
  91. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/applications.py +0 -0
  92. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/background.py +0 -0
  93. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/concurrency.py +0 -0
  94. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/datastructures.py +0 -0
  95. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/dependencies/__init__.py +0 -0
  96. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/dependencies/models.py +0 -0
  97. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/dependencies/utils.py +0 -0
  98. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/encoders.py +0 -0
  99. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/exception_handlers.py +0 -0
  100. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/exceptions.py +0 -0
  101. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/logger.py +0 -0
  102. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/__init__.py +0 -0
  103. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/asyncexitstack.py +0 -0
  104. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/cors.py +0 -0
  105. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/gzip.py +0 -0
  106. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/httpsredirect.py +0 -0
  107. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/trustedhost.py +0 -0
  108. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/middleware/wsgi.py +0 -0
  109. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/openapi/__init__.py +0 -0
  110. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/openapi/constants.py +0 -0
  111. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/openapi/docs.py +0 -0
  112. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/openapi/models.py +0 -0
  113. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/openapi/utils.py +0 -0
  114. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/param_functions.py +0 -0
  115. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/params.py +0 -0
  116. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/requests.py +0 -0
  117. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/responses.py +0 -0
  118. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/routing.py +0 -0
  119. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/__init__.py +0 -0
  120. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/api_key.py +0 -0
  121. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/base.py +0 -0
  122. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/http.py +0 -0
  123. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/oauth2.py +0 -0
  124. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/open_id_connect_url.py +0 -0
  125. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/security/utils.py +0 -0
  126. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/staticfiles.py +0 -0
  127. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/templating.py +0 -0
  128. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/testclient.py +0 -0
  129. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/types.py +0 -0
  130. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/utils.py +0 -0
  131. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/fastapi/websockets.py +0 -0
  132. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/__init__.py +0 -0
  133. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/_compat.py +0 -0
  134. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/_exception_handler.py +0 -0
  135. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/_utils.py +0 -0
  136. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/applications.py +0 -0
  137. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/authentication.py +0 -0
  138. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/background.py +0 -0
  139. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/concurrency.py +0 -0
  140. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/config.py +0 -0
  141. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/convertors.py +0 -0
  142. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/datastructures.py +0 -0
  143. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/endpoints.py +0 -0
  144. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/exceptions.py +0 -0
  145. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/formparsers.py +0 -0
  146. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/__init__.py +0 -0
  147. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/authentication.py +0 -0
  148. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/base.py +0 -0
  149. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/cors.py +0 -0
  150. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/errors.py +0 -0
  151. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/exceptions.py +0 -0
  152. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/gzip.py +0 -0
  153. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/httpsredirect.py +0 -0
  154. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/sessions.py +0 -0
  155. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/trustedhost.py +0 -0
  156. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/middleware/wsgi.py +0 -0
  157. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/requests.py +0 -0
  158. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/responses.py +0 -0
  159. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/routing.py +0 -0
  160. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/schemas.py +0 -0
  161. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/staticfiles.py +0 -0
  162. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/status.py +0 -0
  163. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/templating.py +0 -0
  164. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/testclient.py +0 -0
  165. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/types.py +0 -0
  166. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_vendor/starlette/websockets.py +0 -0
  167. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/_version.py +0 -0
  168. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/agent.py +0 -0
  169. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/__init__.py +0 -0
  170. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/abstract.py +0 -0
  171. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/core.py +0 -0
  172. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/fields.py +0 -0
  173. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/kubernetes.py +0 -0
  174. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/notifications.py +0 -0
  175. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/system.py +0 -0
  176. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/blocks/webhook.py +0 -0
  177. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/__init__.py +0 -0
  178. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/base.py +0 -0
  179. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/collections.py +0 -0
  180. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/constants.py +0 -0
  181. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/__init__.py +0 -0
  182. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/filters.py +0 -0
  183. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/responses.py +0 -0
  184. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/schemas/sorting.py +0 -0
  185. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/subscriptions.py +0 -0
  186. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/client/utilities.py +0 -0
  187. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/__init__.py +0 -0
  188. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/asyncio.py +0 -0
  189. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/common.py +0 -0
  190. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/events.py +0 -0
  191. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/services.py +0 -0
  192. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/concurrency/sync.py +0 -0
  193. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/context.py +0 -0
  194. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/__init__.py +0 -0
  195. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/base.py +0 -0
  196. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/schedules.py +0 -0
  197. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/steps/__init__.py +0 -0
  198. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/steps/core.py +0 -0
  199. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/steps/pull.py +0 -0
  200. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deployments/steps/utility.py +0 -0
  201. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/__init__.py +0 -0
  202. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/data_documents.py +0 -0
  203. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/__init__.py +0 -0
  204. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/base.py +0 -0
  205. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/docker.py +0 -0
  206. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/file.py +0 -0
  207. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/orion.py +0 -0
  208. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/deprecated/packaging/serializers.py +0 -0
  209. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/engine.py +0 -0
  210. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/actions.py +0 -0
  211. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/events/instrument.py +0 -0
  212. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/exceptions.py +0 -0
  213. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/flow_runs.py +0 -0
  214. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/futures.py +0 -0
  215. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/__init__.py +0 -0
  216. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/base.py +0 -0
  217. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/container.py +0 -0
  218. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/process.py +0 -0
  219. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  220. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  221. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
  222. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  223. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/input/__init__.py +0 -0
  224. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/input/actions.py +0 -0
  225. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/input/run_input.py +0 -0
  226. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/__init__.py +0 -0
  227. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/configuration.py +0 -0
  228. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/filters.py +0 -0
  229. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/formatters.py +0 -0
  230. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/handlers.py +0 -0
  231. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/highlighters.py +0 -0
  232. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/loggers.py +0 -0
  233. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/logging/logging.yml +0 -0
  234. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/manifests.py +0 -0
  235. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/plugins.py +0 -0
  236. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/profiles.toml +0 -0
  237. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/py.typed +0 -0
  238. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/results.py +0 -0
  239. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/__init__.py +0 -0
  240. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/storage.py +0 -0
  241. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/submit.py +0 -0
  242. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runner/utils.py +0 -0
  243. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runtime/__init__.py +0 -0
  244. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runtime/deployment.py +0 -0
  245. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runtime/flow_run.py +0 -0
  246. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/runtime/task_run.py +0 -0
  247. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  248. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  249. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/software/__init__.py +0 -0
  250. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/software/base.py +0 -0
  251. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/software/conda.py +0 -0
  252. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/software/pip.py +0 -0
  253. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/software/python.py +0 -0
  254. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/states.py +0 -0
  255. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/task_engine.py +0 -0
  256. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/task_runners.py +0 -0
  257. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/tasks.py +0 -0
  258. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/__init__.py +0 -0
  259. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/annotations.py +0 -0
  260. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/collections.py +0 -0
  261. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/compat.py +0 -0
  262. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/dispatch.py +0 -0
  263. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/dockerutils.py +0 -0
  264. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/filesystem.py +0 -0
  265. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/hashing.py +0 -0
  266. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/importtools.py +0 -0
  267. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/math.py +0 -0
  268. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/names.py +0 -0
  269. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/processutils.py +0 -0
  270. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/pydantic.py +0 -0
  271. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/render_swagger.py +0 -0
  272. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  273. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/schema_tools/validation.py +0 -0
  274. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/services.py +0 -0
  275. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/slugify.py +0 -0
  276. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/templating.py +0 -0
  277. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/text.py +0 -0
  278. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/utilities/visualization.py +0 -0
  279. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/variables.py +0 -0
  280. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/__init__.py +0 -0
  281. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/process.py +0 -0
  282. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/server.py +0 -0
  283. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect/workers/utilities.py +0 -0
  284. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect_client.egg-info/dependency_links.txt +0 -0
  285. {prefect-client-2.16.5 → prefect-client-2.16.7}/src/prefect_client.egg-info/top_level.txt +0 -0
  286. {prefect-client-2.16.5 → prefect-client-2.16.7}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 2.16.5
3
+ Version: 2.16.7
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -31,7 +31,7 @@ sniffio >=1.3.0, < 2.0.0
31
31
  toml >= 0.10.0
32
32
  typing_extensions >= 4.5.0, < 5.0.0
33
33
  ujson >= 5.8.0, < 6.0.0
34
- uvicorn >= 0.14.0
34
+ uvicorn >= 0.14.0, < 0.29.0
35
35
  websockets >= 10.4, < 13.0
36
36
 
37
37
  # additional dependencies of starlette, which we're currently vendoring
@@ -10,4 +10,24 @@ from pydantic.version import VERSION as PYDANTIC_VERSION
10
10
 
11
11
  HAS_PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")
12
12
 
13
- from ._compat import model_dump, IncEx, model_json_schema
13
+ from ._compat import (
14
+ model_dump,
15
+ model_json_schema,
16
+ model_validate,
17
+ IncEx,
18
+ model_dump_json,
19
+ model_copy,
20
+ model_validate_json,
21
+ validate_python,
22
+ )
23
+
24
+ __all__ = [
25
+ "model_dump",
26
+ "model_json_schema",
27
+ "model_validate",
28
+ "IncEx",
29
+ "model_dump_json",
30
+ "model_copy",
31
+ "model_validate_json",
32
+ "validate_python",
33
+ ]
@@ -0,0 +1,16 @@
1
+ import typing
2
+
3
+ from prefect._internal.pydantic._flags import (
4
+ HAS_PYDANTIC_V2,
5
+ USE_PYDANTIC_V2,
6
+ )
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from pydantic import BaseModel
10
+
11
+ if HAS_PYDANTIC_V2 and not USE_PYDANTIC_V2:
12
+ from pydantic.v1 import BaseModel
13
+ else:
14
+ from pydantic import BaseModel
15
+
16
+ __all__ = ["BaseModel"]
@@ -0,0 +1,464 @@
1
+ from typing import Any, Dict, Generic, Literal, Optional, Set, Type, TypeVar, Union
2
+
3
+ from typing_extensions import Self, TypeAlias
4
+
5
+ from prefect._internal.pydantic._flags import (
6
+ HAS_PYDANTIC_V2,
7
+ USE_PYDANTIC_V2,
8
+ )
9
+ from prefect.logging.loggers import get_logger
10
+
11
+ from ._base_model import BaseModel as PydanticBaseModel
12
+
13
+ IncEx: TypeAlias = "Union[Set[int], Set[str], Dict[int, Any], Dict[str, Any], None]"
14
+ logger = get_logger("prefect._internal.pydantic")
15
+
16
+ T = TypeVar("T")
17
+ B = TypeVar("B", bound=PydanticBaseModel)
18
+
19
+ if HAS_PYDANTIC_V2:
20
+ from pydantic import (
21
+ TypeAdapter as BaseTypeAdapter,
22
+ )
23
+ from pydantic import (
24
+ parse_obj_as, # type: ignore
25
+ )
26
+ from pydantic.json_schema import GenerateJsonSchema # type: ignore
27
+ else:
28
+ from pydantic import parse_obj_as # type: ignore
29
+
30
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
31
+ TypeAdapter = BaseTypeAdapter # type: ignore
32
+
33
+ else:
34
+
35
+ class TypeAdapter(Generic[T]):
36
+ def __init__(self, type_: Union[T, Type[T]]) -> None:
37
+ self.type_ = type_
38
+
39
+ def validate_python(
40
+ self,
41
+ __object: Any,
42
+ /,
43
+ *,
44
+ strict: Optional[bool] = None,
45
+ from_attributes: Optional[bool] = None,
46
+ context: Optional[Dict[str, Any]] = None,
47
+ ) -> Any:
48
+ return parse_obj_as(self.type_, __object) # type: ignore
49
+
50
+
51
+ # BaseModel methods and definitions
52
+
53
+
54
+ def model_copy(
55
+ model_instance: PydanticBaseModel,
56
+ *,
57
+ update: Optional[Dict[str, Any]] = None,
58
+ deep: bool = False,
59
+ ) -> PydanticBaseModel:
60
+ """Usage docs: https://docs.pydantic.dev/2.7/concepts/serialization/#model_copy
61
+
62
+ Returns a copy of the model.
63
+
64
+ Args:
65
+ update: Values to change/add in the new model. Note: the data is not validated
66
+ before creating the new model. You should trust this data.
67
+ deep: Set to `True` to make a deep copy of the model.
68
+
69
+ Returns:
70
+ New model instance.
71
+ """
72
+ if not hasattr(model_instance, "copy") and not hasattr(
73
+ model_instance, "model_copy"
74
+ ):
75
+ raise TypeError("Expected a Pydantic model instance")
76
+
77
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
78
+ return model_instance.model_copy(update=update, deep=deep)
79
+
80
+ return model_instance.copy(update=update, deep=deep) # type: ignore
81
+
82
+
83
+ def model_dump_json(
84
+ model_instance: PydanticBaseModel,
85
+ *,
86
+ indent: Optional[int] = None,
87
+ include: IncEx = None,
88
+ exclude: IncEx = None,
89
+ by_alias: bool = False,
90
+ exclude_unset: bool = False,
91
+ exclude_defaults: bool = False,
92
+ exclude_none: bool = False,
93
+ round_trip: bool = False,
94
+ warnings: bool = True,
95
+ ) -> str:
96
+ """
97
+ Generate a JSON representation of the model, optionally specifying which fields to include or exclude.
98
+
99
+ Args:
100
+ indent: If provided, the number of spaces to indent the JSON output.
101
+ include: A list of fields to include in the output.
102
+ exclude: A list of fields to exclude from the output.
103
+ by_alias: Whether to use the field's alias in the dictionary key if defined.
104
+ exclude_unset: Whether to exclude fields that have not been explicitly set.
105
+ exclude_defaults: Whether to exclude fields that are set to their default value.
106
+ exclude_none: Whether to exclude fields that have a value of `None`.
107
+ round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
108
+ warnings: Whether to log warnings when invalid fields are encountered.
109
+
110
+ Returns:
111
+ A JSON representation of the model.
112
+ """
113
+ if not hasattr(model_instance, "json") and not hasattr(
114
+ model_instance, "model_dump_json"
115
+ ):
116
+ raise TypeError("Expected a Pydantic model instance")
117
+
118
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
119
+ return model_instance.model_dump_json(
120
+ indent=indent,
121
+ include=include,
122
+ exclude=exclude,
123
+ by_alias=by_alias,
124
+ exclude_unset=exclude_unset,
125
+ exclude_defaults=exclude_defaults,
126
+ exclude_none=exclude_none,
127
+ round_trip=round_trip,
128
+ warnings=warnings,
129
+ )
130
+
131
+ return model_instance.json( # type: ignore
132
+ include=include,
133
+ exclude=exclude,
134
+ by_alias=by_alias,
135
+ exclude_unset=exclude_unset,
136
+ exclude_defaults=exclude_defaults,
137
+ exclude_none=exclude_none,
138
+ )
139
+
140
+
141
+ def model_dump(
142
+ model_instance: PydanticBaseModel,
143
+ *,
144
+ mode: Union[Literal["json", "python"], str] = "python",
145
+ include: IncEx = None,
146
+ exclude: IncEx = None,
147
+ by_alias: bool = False,
148
+ exclude_unset: bool = False,
149
+ exclude_defaults: bool = False,
150
+ exclude_none: bool = False,
151
+ round_trip: bool = False,
152
+ warnings: bool = True,
153
+ ) -> Dict[str, Any]:
154
+ """
155
+ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
156
+
157
+ Args:
158
+ mode: The mode in which `to_python` should run.
159
+ If mode is 'json', the output will only contain JSON serializable types.
160
+ If mode is 'python', the output may contain non-JSON-serializable Python objects.
161
+ include: A list of fields to include in the output.
162
+ exclude: A list of fields to exclude from the output.
163
+ by_alias: Whether to use the field's alias in the dictionary key if defined.
164
+ exclude_unset: Whether to exclude fields that have not been explicitly set.
165
+ exclude_defaults: Whether to exclude fields that are set to their default value.
166
+ exclude_none: Whether to exclude fields that have a value of `None`.
167
+ round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
168
+ warnings: Whether to log warnings when invalid fields are encountered.
169
+
170
+ Returns:
171
+ A dictionary representation of the model.
172
+ """
173
+ if not hasattr(model_instance, "dict") and not hasattr(
174
+ model_instance, "model_dump"
175
+ ):
176
+ raise TypeError("Expected a Pydantic model instance")
177
+
178
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
179
+ return model_instance.model_dump(
180
+ mode=mode,
181
+ include=include,
182
+ exclude=exclude,
183
+ by_alias=by_alias,
184
+ exclude_unset=exclude_unset,
185
+ exclude_defaults=exclude_defaults,
186
+ exclude_none=exclude_none,
187
+ round_trip=round_trip,
188
+ warnings=warnings,
189
+ )
190
+
191
+ return getattr(model_instance, "dict")(
192
+ include=include,
193
+ exclude=exclude,
194
+ by_alias=by_alias,
195
+ exclude_unset=exclude_unset,
196
+ exclude_defaults=exclude_defaults,
197
+ exclude_none=exclude_none,
198
+ )
199
+
200
+
201
+ DEFAULT_REF_TEMPLATE = "#/$defs/{model}"
202
+ JsonSchemaMode = Literal["validation", "serialization"]
203
+
204
+
205
+ def model_json_schema(
206
+ model: Type[PydanticBaseModel],
207
+ *,
208
+ by_alias: bool = True,
209
+ ref_template: str = DEFAULT_REF_TEMPLATE,
210
+ schema_generator: Any = None,
211
+ mode: JsonSchemaMode = "validation",
212
+ ) -> Dict[str, Any]:
213
+ """
214
+ Generates a JSON schema for a model class.
215
+
216
+ Parameters
217
+ ----------
218
+ by_alias : bool, optional
219
+ Whether to use attribute aliases or not, by default True
220
+ ref_template : str, optional
221
+ The reference template, by default DEFAULT_REF_TEMPLATE
222
+ schema_generator : type[GenerateEmptySchemaForUserClasses], optional
223
+ To override the logic used to generate the JSON schema, as a subclass of GenerateEmptySchemaForUserClasses with your desired modifications, by default GenerateEmptySchemaForUserClasses
224
+ mode : JsonSchemaMode, optional
225
+ The mode in which to generate the schema, by default 'validation'
226
+
227
+ Returns
228
+ -------
229
+ dict[str, Any]
230
+ The JSON schema for the given model class.
231
+ """
232
+ if not hasattr(model, "schema") and not hasattr(model, "model_json_schema"):
233
+ raise TypeError("Expected a Pydantic model type")
234
+
235
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
236
+ schema_generator = GenerateJsonSchema # type: ignore
237
+ return model.model_json_schema(
238
+ by_alias=by_alias,
239
+ ref_template=ref_template,
240
+ schema_generator=schema_generator,
241
+ mode=mode,
242
+ )
243
+
244
+ return model.schema( # type: ignore
245
+ by_alias=by_alias,
246
+ ref_template=ref_template,
247
+ )
248
+
249
+
250
+ def model_validate(
251
+ model: Type[B],
252
+ obj: Any,
253
+ *,
254
+ strict: Optional[bool] = False,
255
+ from_attributes: Optional[bool] = False,
256
+ context: Optional[Dict[str, Any]] = None,
257
+ ) -> B:
258
+ """Validate a pydantic model instance.
259
+
260
+ Args:
261
+ obj: The object to validate.
262
+ strict: Whether to enforce types strictly.
263
+ from_attributes: Whether to extract data from object attributes.
264
+ context: Additional context to pass to the validator.
265
+
266
+ Raises:
267
+ ValidationError: If the object could not be validated.
268
+
269
+ Returns:
270
+ The validated model instance.
271
+ """
272
+ if not hasattr(model, "parse_obj") and not hasattr(model, "model_validate"):
273
+ raise TypeError("Expected a Pydantic model type")
274
+
275
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
276
+ return model.model_validate(
277
+ obj=obj,
278
+ strict=strict,
279
+ from_attributes=from_attributes,
280
+ context=context,
281
+ )
282
+
283
+ return getattr(model, "parse_obj")(obj)
284
+
285
+
286
+ def model_validate_json(
287
+ model: Type[B],
288
+ json_data: Union[str, bytes, bytearray],
289
+ *,
290
+ strict: Optional[bool] = False,
291
+ context: Optional[Dict[str, Any]] = None,
292
+ ) -> B:
293
+ """Validate the given JSON data against the Pydantic model.
294
+
295
+ Args:
296
+ json_data: The JSON data to validate.
297
+ strict: Whether to enforce types strictly.
298
+ context: Extra variables to pass to the validator.
299
+
300
+ Returns:
301
+ The validated Pydantic model.
302
+
303
+ Raises:
304
+ ValueError: If `json_data` is not a JSON string.
305
+ """
306
+ if not hasattr(model, "parse_raw") and not hasattr(model, "model_validate_json"):
307
+ raise TypeError("Expected a Pydantic model type")
308
+
309
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
310
+ return model.model_validate_json(
311
+ json_data=json_data,
312
+ strict=strict,
313
+ context=context,
314
+ )
315
+
316
+ return getattr(model, "parse_raw")(json_data)
317
+
318
+
319
+ if HAS_PYDANTIC_V2 and USE_PYDANTIC_V2:
320
+ # In this case, there's no functionality to add, so we just alias the Pydantic v2 BaseModel
321
+ class BaseModel(PydanticBaseModel): # type: ignore
322
+ pass
323
+
324
+ else:
325
+ # In this case, we're working with a Pydantic v1 model, so we need to add Pydantic v2 functionality
326
+ class BaseModel(PydanticBaseModel):
327
+ def model_dump(
328
+ self: "BaseModel",
329
+ *,
330
+ mode: str = "python",
331
+ include: IncEx = None,
332
+ exclude: IncEx = None,
333
+ by_alias: bool = False,
334
+ exclude_unset: bool = False,
335
+ exclude_defaults: bool = False,
336
+ exclude_none: bool = False,
337
+ round_trip: bool = False,
338
+ warnings: bool = True,
339
+ ) -> Dict[str, Any]:
340
+ return model_dump(
341
+ self,
342
+ mode=mode,
343
+ include=include,
344
+ exclude=exclude,
345
+ by_alias=by_alias,
346
+ exclude_unset=exclude_unset,
347
+ exclude_defaults=exclude_defaults,
348
+ exclude_none=exclude_none,
349
+ round_trip=round_trip,
350
+ warnings=warnings,
351
+ )
352
+
353
+ def model_dump_json(
354
+ self,
355
+ *,
356
+ indent: Optional[int] = None,
357
+ include: Optional[IncEx] = None,
358
+ exclude: Optional[IncEx] = None,
359
+ by_alias: bool = False,
360
+ exclude_unset: bool = False,
361
+ exclude_defaults: bool = False,
362
+ exclude_none: bool = False,
363
+ round_trip: bool = False,
364
+ warnings: bool = True,
365
+ ) -> str:
366
+ return model_dump_json(
367
+ model_instance=self,
368
+ indent=indent,
369
+ include=include,
370
+ exclude=exclude,
371
+ by_alias=by_alias,
372
+ exclude_unset=exclude_unset,
373
+ exclude_defaults=exclude_defaults,
374
+ exclude_none=exclude_none,
375
+ round_trip=round_trip,
376
+ warnings=warnings,
377
+ )
378
+
379
+ def model_copy(
380
+ self: "Self",
381
+ *,
382
+ update: Optional[Dict[str, Any]] = None,
383
+ deep: bool = False,
384
+ ) -> "Self":
385
+ return super().model_copy(update=update, deep=deep)
386
+
387
+ @classmethod
388
+ def model_json_schema(
389
+ cls,
390
+ by_alias: bool = True,
391
+ ref_template: str = DEFAULT_REF_TEMPLATE,
392
+ schema_generator: Any = None,
393
+ mode: JsonSchemaMode = "validation",
394
+ ) -> Dict[str, Any]:
395
+ return model_json_schema(
396
+ cls,
397
+ by_alias=by_alias,
398
+ ref_template=ref_template,
399
+ schema_generator=schema_generator,
400
+ mode=mode,
401
+ )
402
+
403
+ @classmethod
404
+ def model_validate(
405
+ cls: Type["Self"],
406
+ obj: Any,
407
+ *,
408
+ strict: Optional[bool] = False,
409
+ from_attributes: Optional[bool] = False,
410
+ context: Optional[Dict[str, Any]] = None,
411
+ ) -> "Self":
412
+ return model_validate(
413
+ cls,
414
+ obj,
415
+ strict=strict,
416
+ from_attributes=from_attributes,
417
+ context=context,
418
+ )
419
+
420
+ @classmethod
421
+ def model_validate_json(
422
+ cls: Type["Self"],
423
+ json_data: Union[str, bytes, bytearray],
424
+ *,
425
+ strict: Optional[bool] = False,
426
+ context: Optional[Dict[str, Any]] = None,
427
+ ) -> "Self":
428
+ return model_validate_json(
429
+ cls,
430
+ json_data,
431
+ strict=strict,
432
+ context=context,
433
+ )
434
+
435
+
436
+ # TypeAdapter methods and definitions
437
+
438
+
439
+ def validate_python(
440
+ type_: Union[T, Type[T]],
441
+ __object: Any,
442
+ /,
443
+ *,
444
+ strict: Optional[bool] = None,
445
+ from_attributes: Optional[bool] = None,
446
+ context: Optional[Dict[str, Any]] = None,
447
+ ) -> T:
448
+ """Validate a Python object against the model.
449
+
450
+ Args:
451
+ type_: The type to validate against.
452
+ __object: The Python object to validate against the model.
453
+ strict: Whether to strictly check types.
454
+ from_attributes: Whether to extract data from object attributes.
455
+ context: Additional context to pass to the validator.
456
+
457
+ !!! note
458
+ When using `TypeAdapter` with a Pydantic `dataclass`, the use of the `from_attributes`
459
+ argument is not supported.
460
+
461
+ Returns:
462
+ The validated object.
463
+ """
464
+ return TypeAdapter(type_).validate_python(__object)
@@ -0,0 +1,15 @@
1
+ import os
2
+
3
+ # Retrieve current version of Pydantic installed in environment
4
+ from pydantic.version import VERSION as PYDANTIC_VERSION
5
+
6
+ # Check if Pydantic version 2 is the installed version
7
+ HAS_PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")
8
+
9
+ # Determine if Pydantic v2 internals should be used based on an environment variable.
10
+ USE_PYDANTIC_V2 = os.environ.get(
11
+ "PREFECT_EXPERIMENTAL_ENABLE_PYDANTIC_V2_INTERNALS", False
12
+ ) in {"1", "true", "True"}
13
+
14
+ # Set to True if Pydantic v2 is present but not enabled, indicating deprecation warnings may occur.
15
+ EXPECT_DEPRECATION_WARNINGS = HAS_PYDANTIC_V2 and not USE_PYDANTIC_V2
@@ -0,0 +1,48 @@
1
+ import inspect
2
+ import typing
3
+
4
+ from prefect._internal.pydantic import HAS_PYDANTIC_V2
5
+
6
+ if HAS_PYDANTIC_V2:
7
+ from pydantic.v1 import BaseModel as V1BaseModel
8
+ else:
9
+ from pydantic import BaseModel as V1BaseModel
10
+
11
+
12
+ def is_v1_model(v) -> bool:
13
+ if isinstance(v, V1BaseModel):
14
+ return True
15
+ try:
16
+ if inspect.isclass(v) and issubclass(v, V1BaseModel):
17
+ return True
18
+ except TypeError:
19
+ pass
20
+
21
+ return False
22
+
23
+
24
+ def is_v1_type(v) -> bool:
25
+ if HAS_PYDANTIC_V2:
26
+ if is_v1_model(v):
27
+ return True
28
+
29
+ try:
30
+ return v.__module__.startswith("pydantic.v1.types")
31
+ except AttributeError:
32
+ return False
33
+
34
+ return True
35
+
36
+
37
+ def has_v1_type_as_param(signature: inspect.Signature) -> bool:
38
+ parameters = signature.parameters.values()
39
+ for p in parameters:
40
+ # check if this parameter is a v1 model
41
+ if is_v1_type(p.annotation):
42
+ return True
43
+
44
+ # check if this parameter is a collection of types
45
+ for v in typing.get_args(p.annotation):
46
+ if is_v1_type(v):
47
+ return True
48
+ return False
@@ -7,7 +7,7 @@ import typing as t
7
7
  import pendulum
8
8
  import pydantic
9
9
  from pydantic import BaseModel as V2BaseModel
10
- from pydantic import ConfigDict, create_model
10
+ from pydantic import ConfigDict, PydanticUndefinedAnnotation, create_model
11
11
  from pydantic.type_adapter import TypeAdapter
12
12
 
13
13
  from prefect._internal.pydantic.annotations.pendulum import (
@@ -106,7 +106,11 @@ def create_v2_schema(
106
106
  model = create_model(
107
107
  name_, __config__=model_cfg, __base__=model_base, **model_fields
108
108
  )
109
- adapter = TypeAdapter(model)
109
+ try:
110
+ adapter = TypeAdapter(model)
111
+ except PydanticUndefinedAnnotation as exc:
112
+ # in v1 this raises a TypeError, which is handled by parameter_schema
113
+ raise TypeError(exc.message)
110
114
 
111
115
  # root model references under #definitions
112
116
  schema = adapter.json_schema(