prefect-client 3.0.11__tar.gz → 3.1.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 (248) hide show
  1. {prefect-client-3.0.11/src/prefect_client.egg-info → prefect-client-3.1.0}/PKG-INFO +1 -1
  2. {prefect-client-3.0.11 → prefect-client-3.1.0}/requirements-client.txt +1 -1
  3. {prefect-client-3.0.11 → prefect-client-3.1.0}/requirements-dev.txt +0 -1
  4. {prefect-client-3.0.11 → prefect-client-3.1.0}/requirements.txt +1 -0
  5. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_version.py +3 -3
  6. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/cache_policies.py +4 -4
  7. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/orchestration.py +25 -3
  8. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/actions.py +11 -18
  9. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/objects.py +17 -27
  10. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/context.py +6 -2
  11. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/base.py +0 -2
  12. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/schedules.py +0 -4
  13. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/logging.yml +4 -0
  14. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/results.py +27 -17
  15. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/base.py +65 -3
  16. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/legacy.py +1 -1
  17. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/api.py +5 -5
  18. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/cli.py +5 -5
  19. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/client.py +6 -8
  20. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/cloud.py +5 -5
  21. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/deployments.py +2 -5
  22. prefect-client-3.1.0/src/prefect/settings/models/experiments.py +24 -0
  23. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/flows.py +2 -5
  24. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/internal.py +2 -5
  25. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/logging.py +3 -8
  26. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/results.py +2 -5
  27. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/root.py +34 -34
  28. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/runner.py +3 -8
  29. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/api.py +2 -5
  30. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/database.py +2 -7
  31. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/deployments.py +2 -5
  32. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/ephemeral.py +2 -5
  33. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/events.py +2 -5
  34. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/flow_run_graph.py +2 -5
  35. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/root.py +2 -5
  36. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/services.py +13 -44
  37. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/tasks.py +3 -12
  38. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/ui.py +2 -5
  39. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/tasks.py +10 -11
  40. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/testing.py +2 -5
  41. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/worker.py +3 -8
  42. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/sources.py +74 -1
  43. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/states.py +22 -21
  44. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/task_engine.py +30 -11
  45. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/hashing.py +7 -3
  46. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/base.py +36 -5
  47. {prefect-client-3.0.11 → prefect-client-3.1.0/src/prefect_client.egg-info}/PKG-INFO +1 -1
  48. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect_client.egg-info/SOURCES.txt +1 -1
  49. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect_client.egg-info/requires.txt +1 -1
  50. prefect-client-3.0.11/src/prefect/settings/models/ui.py +0 -0
  51. {prefect-client-3.0.11 → prefect-client-3.1.0}/LICENSE +0 -0
  52. {prefect-client-3.0.11 → prefect-client-3.1.0}/MANIFEST.in +0 -0
  53. {prefect-client-3.0.11 → prefect-client-3.1.0}/README.md +0 -0
  54. {prefect-client-3.0.11 → prefect-client-3.1.0}/setup.cfg +0 -0
  55. {prefect-client-3.0.11 → prefect-client-3.1.0}/setup.py +0 -0
  56. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/.prefectignore +0 -0
  57. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/__init__.py +0 -0
  58. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/__init__.py +0 -0
  59. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/_logging.py +0 -0
  60. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/compatibility/__init__.py +0 -0
  61. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/compatibility/deprecated.py +0 -0
  62. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/compatibility/migration.py +0 -0
  63. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/__init__.py +0 -0
  64. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/api.py +0 -0
  65. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/calls.py +0 -0
  66. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  67. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  68. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/inspection.py +0 -0
  69. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/primitives.py +0 -0
  70. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/services.py +0 -0
  71. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/threads.py +0 -0
  72. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/concurrency/waiters.py +0 -0
  73. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/integrations.py +0 -0
  74. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/__init__.py +0 -0
  75. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  76. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
  77. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/schemas.py +0 -0
  78. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
  79. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
  80. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  81. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/pytz.py +0 -0
  82. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/retries.py +0 -0
  83. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/schemas/__init__.py +0 -0
  84. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/schemas/bases.py +0 -0
  85. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/schemas/fields.py +0 -0
  86. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/schemas/serializers.py +0 -0
  87. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/_internal/schemas/validators.py +0 -0
  88. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/agent.py +0 -0
  89. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/artifacts.py +0 -0
  90. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/automations.py +0 -0
  91. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/__init__.py +0 -0
  92. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/abstract.py +0 -0
  93. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/core.py +0 -0
  94. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/fields.py +0 -0
  95. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/notifications.py +0 -0
  96. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/redis.py +0 -0
  97. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/system.py +0 -0
  98. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/blocks/webhook.py +0 -0
  99. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/__init__.py +0 -0
  100. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/base.py +0 -0
  101. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/cloud.py +0 -0
  102. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/collections.py +0 -0
  103. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/constants.py +0 -0
  104. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/__init__.py +0 -0
  105. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/filters.py +0 -0
  106. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/responses.py +0 -0
  107. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/schedules.py +0 -0
  108. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/schemas/sorting.py +0 -0
  109. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/subscriptions.py +0 -0
  110. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/types/__init__.py +0 -0
  111. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/types/flexible_schedule_list.py +0 -0
  112. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/client/utilities.py +0 -0
  113. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/__init__.py +0 -0
  114. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/asyncio.py +0 -0
  115. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/context.py +0 -0
  116. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/events.py +0 -0
  117. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/services.py +0 -0
  118. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/sync.py +0 -0
  119. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/__init__.py +0 -0
  120. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/asyncio.py +0 -0
  121. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/context.py +0 -0
  122. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/events.py +0 -0
  123. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/services.py +0 -0
  124. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/concurrency/v1/sync.py +0 -0
  125. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/__init__.py +0 -0
  126. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/deployments.py +0 -0
  127. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/flow_runs.py +0 -0
  128. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/runner.py +0 -0
  129. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/steps/__init__.py +0 -0
  130. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/steps/core.py +0 -0
  131. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/steps/pull.py +0 -0
  132. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/deployments/steps/utility.py +0 -0
  133. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/docker/__init__.py +0 -0
  134. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/docker/docker_image.py +0 -0
  135. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/engine.py +0 -0
  136. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/__init__.py +0 -0
  137. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/actions.py +0 -0
  138. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/cli/__init__.py +0 -0
  139. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/cli/automations.py +0 -0
  140. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/clients.py +0 -0
  141. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/filters.py +0 -0
  142. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/related.py +0 -0
  143. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/schemas/__init__.py +0 -0
  144. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/schemas/automations.py +0 -0
  145. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/schemas/deployment_triggers.py +0 -0
  146. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/schemas/events.py +0 -0
  147. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/schemas/labelling.py +0 -0
  148. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/utilities.py +0 -0
  149. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/events/worker.py +0 -0
  150. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/exceptions.py +0 -0
  151. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/filesystems.py +0 -0
  152. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/flow_engine.py +0 -0
  153. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/flow_runs.py +0 -0
  154. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/flows.py +0 -0
  155. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/futures.py +0 -0
  156. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/__init__.py +0 -0
  157. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/base.py +0 -0
  158. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
  159. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  160. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  161. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
  162. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  163. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/input/__init__.py +0 -0
  164. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/input/actions.py +0 -0
  165. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/input/run_input.py +0 -0
  166. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/locking/__init__.py +0 -0
  167. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/locking/filesystem.py +0 -0
  168. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/locking/memory.py +0 -0
  169. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/locking/protocol.py +0 -0
  170. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/__init__.py +0 -0
  171. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/configuration.py +0 -0
  172. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/filters.py +0 -0
  173. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/formatters.py +0 -0
  174. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/handlers.py +0 -0
  175. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/highlighters.py +0 -0
  176. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/logging/loggers.py +0 -0
  177. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/main.py +0 -0
  178. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/plugins.py +0 -0
  179. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/py.typed +0 -0
  180. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/records/__init__.py +0 -0
  181. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/records/base.py +0 -0
  182. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/records/filesystem.py +0 -0
  183. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/records/memory.py +0 -0
  184. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/records/result_store.py +0 -0
  185. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/__init__.py +0 -0
  186. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/runner.py +0 -0
  187. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/server.py +0 -0
  188. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/storage.py +0 -0
  189. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/submit.py +0 -0
  190. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runner/utils.py +0 -0
  191. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runtime/__init__.py +0 -0
  192. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runtime/deployment.py +0 -0
  193. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runtime/flow_run.py +0 -0
  194. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/runtime/task_run.py +0 -0
  195. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/serializers.py +0 -0
  196. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  197. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  198. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/__init__.py +0 -0
  199. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/constants.py +0 -0
  200. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/context.py +0 -0
  201. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/__init__.py +0 -0
  202. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/models/server/__init__.py +0 -0
  203. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/profiles.py +0 -0
  204. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/settings/profiles.toml +0 -0
  205. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/task_runners.py +0 -0
  206. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/task_runs.py +0 -0
  207. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/task_worker.py +0 -0
  208. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/tasks.py +0 -0
  209. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/transactions.py +0 -0
  210. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/types/__init__.py +0 -0
  211. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/types/entrypoint.py +0 -0
  212. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/__init__.py +0 -0
  213. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/annotations.py +0 -0
  214. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/asyncutils.py +0 -0
  215. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/callables.py +0 -0
  216. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/collections.py +0 -0
  217. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/compat.py +0 -0
  218. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/context.py +0 -0
  219. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/dispatch.py +0 -0
  220. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/dockerutils.py +0 -0
  221. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/engine.py +0 -0
  222. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/filesystem.py +0 -0
  223. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/importtools.py +0 -0
  224. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/math.py +0 -0
  225. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/names.py +0 -0
  226. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/processutils.py +0 -0
  227. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/pydantic.py +0 -0
  228. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/render_swagger.py +0 -0
  229. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  230. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/schema_tools/hydration.py +0 -0
  231. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/schema_tools/validation.py +0 -0
  232. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/services.py +0 -0
  233. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/slugify.py +0 -0
  234. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/templating.py +0 -0
  235. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/text.py +0 -0
  236. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/timeout.py +0 -0
  237. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/urls.py +0 -0
  238. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/utilities/visualization.py +0 -0
  239. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/variables.py +0 -0
  240. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/__init__.py +0 -0
  241. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/block.py +0 -0
  242. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/cloud.py +0 -0
  243. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/process.py +0 -0
  244. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/server.py +0 -0
  245. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect/workers/utilities.py +0 -0
  246. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect_client.egg-info/dependency_links.txt +0 -0
  247. {prefect-client-3.0.11 → prefect-client-3.1.0}/src/prefect_client.egg-info/top_level.txt +0 -0
  248. {prefect-client-3.0.11 → prefect-client-3.1.0}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 3.0.11
3
+ Version: 3.1.0
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -3,7 +3,7 @@ asgi-lifespan >= 1.0, < 3.0
3
3
  cachetools >= 5.3, < 6.0
4
4
  cloudpickle >= 2.0, < 4.0
5
5
  coolname >= 1.0.4, < 3.0.0
6
- croniter >= 1.0.12, < 4.0.0
6
+ croniter >= 1.0.12, < 5.0.0
7
7
  exceptiongroup >= 1.0.0
8
8
  fastapi >= 0.111.0, < 1.0.0
9
9
  fsspec >= 2022.5.0
@@ -12,7 +12,6 @@ pluggy >= 1.4.0
12
12
  pytest >= 8.3
13
13
  pytest-asyncio >= 0.24
14
14
  pytest-benchmark
15
- pytest-codspeed
16
15
  pytest-cov
17
16
  pytest-env
18
17
  pytest-flakefinder
@@ -12,6 +12,7 @@ graphviz >= 0.20.1
12
12
  jinja2 >= 3.0.0, < 4.0.0
13
13
  jinja2-humanize-extension >= 0.4.0
14
14
  humanize >= 4.9.0, < 5.0.0
15
+ opentelemetry-api >= 1.27.0, < 2.0.0
15
16
  pytz >= 2021.1, < 2025
16
17
  readchar >= 4.0.0, < 5.0.0
17
18
  sqlalchemy[asyncio] >= 2.0, < 3.0.0
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-10-24T17:36:06-0500",
11
+ "date": "2024-10-31T12:43:46-0700",
12
12
  "dirty": true,
13
13
  "error": null,
14
- "full-revisionid": "a17ccfcf2be76360f13806d7aca1e2cf9fa3741e",
15
- "version": "3.0.11"
14
+ "full-revisionid": "a83ba39b095e5945140ab6313e39dbc56056afe1",
15
+ "version": "3.1.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -175,7 +175,7 @@ class CompoundCachePolicy(CachePolicy):
175
175
  keys.append(policy_key)
176
176
  if not keys:
177
177
  return None
178
- return hash_objects(*keys)
178
+ return hash_objects(*keys, raise_on_failure=True)
179
179
 
180
180
 
181
181
  @dataclass
@@ -224,7 +224,7 @@ class TaskSource(CachePolicy):
224
224
  else:
225
225
  raise
226
226
 
227
- return hash_objects(lines)
227
+ return hash_objects(lines, raise_on_failure=True)
228
228
 
229
229
 
230
230
  @dataclass
@@ -242,7 +242,7 @@ class FlowParameters(CachePolicy):
242
242
  ) -> Optional[str]:
243
243
  if not flow_parameters:
244
244
  return None
245
- return hash_objects(flow_parameters)
245
+ return hash_objects(flow_parameters, raise_on_failure=True)
246
246
 
247
247
 
248
248
  @dataclass
@@ -293,7 +293,7 @@ class Inputs(CachePolicy):
293
293
  if key not in exclude:
294
294
  hashed_inputs[key] = val
295
295
 
296
- return hash_objects(hashed_inputs)
296
+ return hash_objects(hashed_inputs, raise_on_failure=True)
297
297
 
298
298
  def __sub__(self, other: str) -> "CachePolicy":
299
299
  if not isinstance(other, str):
@@ -134,6 +134,7 @@ from prefect.settings import (
134
134
  PREFECT_CLOUD_API_URL,
135
135
  PREFECT_SERVER_ALLOW_EPHEMERAL_MODE,
136
136
  PREFECT_TESTING_UNIT_TEST_MODE,
137
+ get_current_settings,
137
138
  )
138
139
 
139
140
  if TYPE_CHECKING:
@@ -2594,22 +2595,43 @@ class PrefectClient:
2594
2595
  work_pool_name: str,
2595
2596
  worker_name: str,
2596
2597
  heartbeat_interval_seconds: Optional[float] = None,
2597
- ):
2598
+ get_worker_id: bool = False,
2599
+ ) -> Optional[UUID]:
2598
2600
  """
2599
2601
  Sends a worker heartbeat for a given work pool.
2600
2602
 
2601
2603
  Args:
2602
2604
  work_pool_name: The name of the work pool to heartbeat against.
2603
2605
  worker_name: The name of the worker sending the heartbeat.
2606
+ return_id: Whether to return the worker ID. Note: will return `None` if the connected server does not support returning worker IDs, even if `return_id` is `True`.
2604
2607
  """
2605
- await self._client.post(
2608
+
2609
+ if get_worker_id:
2610
+ return_dict = {"return_id": get_worker_id}
2611
+ else:
2612
+ return_dict = {}
2613
+
2614
+ resp = await self._client.post(
2606
2615
  f"/work_pools/{work_pool_name}/workers/heartbeat",
2607
2616
  json={
2608
2617
  "name": worker_name,
2609
2618
  "heartbeat_interval_seconds": heartbeat_interval_seconds,
2610
- },
2619
+ }
2620
+ | return_dict,
2611
2621
  )
2612
2622
 
2623
+ if (
2624
+ (
2625
+ self.server_type == ServerType.CLOUD
2626
+ or get_current_settings().testing.test_mode
2627
+ )
2628
+ and get_worker_id
2629
+ and resp.status_code == 200
2630
+ ):
2631
+ return UUID(resp.text)
2632
+ else:
2633
+ return None
2634
+
2613
2635
  async def read_workers_for_work_pool(
2614
2636
  self,
2615
2637
  work_pool_name: str,
@@ -85,18 +85,10 @@ class DeploymentScheduleCreate(ActionBaseModel):
85
85
  active: bool = Field(
86
86
  default=True, description="Whether or not the schedule is active."
87
87
  )
88
- max_active_runs: Optional[PositiveInteger] = Field(
89
- default=None,
90
- description="The maximum number of active runs for the schedule.",
91
- )
92
88
  max_scheduled_runs: Optional[PositiveInteger] = Field(
93
89
  default=None,
94
90
  description="The maximum number of scheduled runs for the schedule.",
95
91
  )
96
- catchup: bool = Field(
97
- default=False,
98
- description="Whether or not a worker should catch up on Late runs for the schedule.",
99
- )
100
92
 
101
93
  @field_validator("max_scheduled_runs")
102
94
  @classmethod
@@ -114,21 +106,11 @@ class DeploymentScheduleUpdate(ActionBaseModel):
114
106
  default=True, description="Whether or not the schedule is active."
115
107
  )
116
108
 
117
- max_active_runs: Optional[PositiveInteger] = Field(
118
- default=None,
119
- description="The maximum number of active runs for the schedule.",
120
- )
121
-
122
109
  max_scheduled_runs: Optional[PositiveInteger] = Field(
123
110
  default=None,
124
111
  description="The maximum number of scheduled runs for the schedule.",
125
112
  )
126
113
 
127
- catchup: Optional[bool] = Field(
128
- default=None,
129
- description="Whether or not a worker should catch up on Late runs for the schedule.",
130
- )
131
-
132
114
  @field_validator("max_scheduled_runs")
133
115
  @classmethod
134
116
  def validate_max_scheduled_runs(cls, v):
@@ -580,6 +562,17 @@ class LogCreate(ActionBaseModel):
580
562
  timestamp: DateTime = Field(default=..., description="The log timestamp.")
581
563
  flow_run_id: Optional[UUID] = Field(None)
582
564
  task_run_id: Optional[UUID] = Field(None)
565
+ worker_id: Optional[UUID] = Field(None)
566
+
567
+ def model_dump(self, *args, **kwargs):
568
+ """
569
+ The worker_id field is only included in logs sent to Prefect Cloud.
570
+ If it's unset, we should not include it in the log payload.
571
+ """
572
+ data = super().model_dump(*args, **kwargs)
573
+ if self.worker_id is None:
574
+ data.pop("worker_id")
575
+ return data
583
576
 
584
577
 
585
578
  class WorkPoolCreate(ActionBaseModel):
@@ -32,6 +32,7 @@ from pydantic.functional_validators import ModelWrapValidatorHandler
32
32
  from pydantic_extra_types.pendulum_dt import DateTime
33
33
  from typing_extensions import Literal, Self, TypeVar
34
34
 
35
+ from prefect._internal.compatibility import deprecated
35
36
  from prefect._internal.compatibility.migration import getattr_migration
36
37
  from prefect._internal.schemas.bases import ObjectBaseModel, PrefectBaseModel
37
38
  from prefect._internal.schemas.fields import CreatedBy, UpdatedBy
@@ -186,7 +187,7 @@ class StateDetails(PrefectBaseModel):
186
187
 
187
188
 
188
189
  def data_discriminator(x: Any) -> str:
189
- if isinstance(x, dict) and "type" in x:
190
+ if isinstance(x, dict) and "type" in x and x["type"] != "unpersisted":
190
191
  return "BaseResult"
191
192
  elif isinstance(x, dict) and "storage_key" in x:
192
193
  return "ResultRecordMetadata"
@@ -220,10 +221,17 @@ class State(ObjectBaseModel, Generic[R]):
220
221
  def result(self: "State[R]", raise_on_failure: bool = False) -> Union[R, Exception]:
221
222
  ...
222
223
 
224
+ @deprecated.deprecated_parameter(
225
+ "fetch",
226
+ when=lambda fetch: fetch is not True,
227
+ start_date="Oct 2024",
228
+ end_date="Jan 2025",
229
+ help="Please ensure you are awaiting the call to `result()` when calling in an async context.",
230
+ )
223
231
  def result(
224
232
  self,
225
233
  raise_on_failure: bool = True,
226
- fetch: Optional[bool] = None,
234
+ fetch: bool = True,
227
235
  retry_result_failure: bool = True,
228
236
  ) -> Union[R, Exception]:
229
237
  """
@@ -248,22 +256,6 @@ class State(ObjectBaseModel, Generic[R]):
248
256
  The result of the run
249
257
 
250
258
  Examples:
251
- >>> from prefect import flow, task
252
- >>> @task
253
- >>> def my_task(x):
254
- >>> return x
255
-
256
- Get the result from a task future in a flow
257
-
258
- >>> @flow
259
- >>> def my_flow():
260
- >>> future = my_task("hello")
261
- >>> state = future.wait()
262
- >>> result = state.result()
263
- >>> print(result)
264
- >>> my_flow()
265
- hello
266
-
267
259
  Get the result from a flow state
268
260
 
269
261
  >>> @flow
@@ -307,7 +299,7 @@ class State(ObjectBaseModel, Generic[R]):
307
299
  >>> raise ValueError("oh no!")
308
300
  >>> my_flow.deploy("my_deployment/my_flow")
309
301
  >>> flow_run = run_deployment("my_deployment/my_flow")
310
- >>> await flow_run.state.result(raise_on_failure=True, fetch=True) # Raises `ValueError("oh no!")`
302
+ >>> await flow_run.state.result(raise_on_failure=True) # Raises `ValueError("oh no!")`
311
303
  """
312
304
  from prefect.states import get_state_result
313
305
 
@@ -365,6 +357,12 @@ class State(ObjectBaseModel, Generic[R]):
365
357
  self.state_details.scheduled_time = DateTime.now("utc")
366
358
  return self
367
359
 
360
+ @model_validator(mode="after")
361
+ def set_unpersisted_results_to_none(self) -> Self:
362
+ if isinstance(self.data, dict) and self.data.get("type") == "unpersisted":
363
+ self.data = None
364
+ return self
365
+
368
366
  def is_scheduled(self) -> bool:
369
367
  return self.type == StateType.SCHEDULED
370
368
 
@@ -1061,18 +1059,10 @@ class DeploymentSchedule(ObjectBaseModel):
1061
1059
  active: bool = Field(
1062
1060
  default=True, description="Whether or not the schedule is active."
1063
1061
  )
1064
- max_active_runs: Optional[PositiveInteger] = Field(
1065
- default=None,
1066
- description="The maximum number of active runs for the schedule.",
1067
- )
1068
1062
  max_scheduled_runs: Optional[PositiveInteger] = Field(
1069
1063
  default=None,
1070
1064
  description="The maximum number of scheduled runs for the schedule.",
1071
1065
  )
1072
- catchup: bool = Field(
1073
- default=False,
1074
- description="Whether or not a worker should catch up on Late runs for the schedule.",
1075
- )
1076
1066
 
1077
1067
 
1078
1068
  class Deployment(ObjectBaseModel):
@@ -38,7 +38,11 @@ from prefect.client.orchestration import PrefectClient, SyncPrefectClient, get_c
38
38
  from prefect.client.schemas import FlowRun, TaskRun
39
39
  from prefect.events.worker import EventsWorker
40
40
  from prefect.exceptions import MissingContextError
41
- from prefect.results import ResultStore, get_default_persist_setting
41
+ from prefect.results import (
42
+ ResultStore,
43
+ get_default_persist_setting,
44
+ get_default_persist_setting_for_tasks,
45
+ )
42
46
  from prefect.settings import Profile, Settings
43
47
  from prefect.settings.legacy import _get_settings_fields
44
48
  from prefect.states import State
@@ -397,7 +401,7 @@ class TaskRunContext(RunContext):
397
401
 
398
402
  # Result handling
399
403
  result_store: ResultStore
400
- persist_result: bool = Field(default_factory=get_default_persist_setting)
404
+ persist_result: bool = Field(default_factory=get_default_persist_setting_for_tasks)
401
405
 
402
406
  __var__ = ContextVar("task_run")
403
407
 
@@ -272,8 +272,6 @@ def _format_deployment_for_saving_to_prefect_file(
272
272
  schedule_config = deployment_schedule.schedule.model_dump()
273
273
 
274
274
  schedule_config["active"] = deployment_schedule.active
275
- schedule_config["max_active_runs"] = deployment_schedule.max_active_runs
276
- schedule_config["catchup"] = deployment_schedule.catchup
277
275
  schedules.append(schedule_config)
278
276
 
279
277
  deployment["schedules"] = schedules
@@ -14,15 +14,11 @@ FlexibleScheduleList = Sequence[
14
14
  def create_deployment_schedule_create(
15
15
  schedule: "SCHEDULE_TYPES",
16
16
  active: Optional[bool] = True,
17
- max_active_runs: Optional[int] = None,
18
- catchup: bool = False,
19
17
  ) -> DeploymentScheduleCreate:
20
18
  """Create a DeploymentScheduleCreate object from common schedule parameters."""
21
19
  return DeploymentScheduleCreate(
22
20
  schedule=schedule,
23
21
  active=active if active is not None else True,
24
- max_active_runs=max_active_runs,
25
- catchup=catchup,
26
22
  )
27
23
 
28
24
 
@@ -102,9 +102,13 @@ loggers:
102
102
 
103
103
  uvicorn:
104
104
  level: "${PREFECT_SERVER_LOGGING_LEVEL}"
105
+ handlers: [console]
106
+ propagate: false
105
107
 
106
108
  fastapi:
107
109
  level: "${PREFECT_SERVER_LOGGING_LEVEL}"
110
+ handlers: [console]
111
+ propagate: false
108
112
 
109
113
  # The root logger: any logger without propagation disabled sends to here as well
110
114
  root:
@@ -56,13 +56,7 @@ from prefect.filesystems import (
56
56
  from prefect.locking.protocol import LockManager
57
57
  from prefect.logging import get_logger
58
58
  from prefect.serializers import PickleSerializer, Serializer
59
- from prefect.settings import (
60
- PREFECT_DEFAULT_RESULT_STORAGE_BLOCK,
61
- PREFECT_LOCAL_STORAGE_PATH,
62
- PREFECT_RESULTS_DEFAULT_SERIALIZER,
63
- PREFECT_RESULTS_PERSIST_BY_DEFAULT,
64
- PREFECT_TASK_SCHEDULING_DEFAULT_STORAGE_BLOCK,
65
- )
59
+ from prefect.settings.context import get_current_settings
66
60
  from prefect.utilities.annotations import NotSet
67
61
  from prefect.utilities.asyncutils import sync_compatible
68
62
  from prefect.utilities.pydantic import get_dispatch_key, lookup_type, register_base_type
@@ -94,8 +88,9 @@ async def get_default_result_storage() -> WritableFileSystem:
94
88
  """
95
89
  Generate a default file system for result storage.
96
90
  """
97
- default_block = PREFECT_DEFAULT_RESULT_STORAGE_BLOCK.value()
98
- basepath = PREFECT_LOCAL_STORAGE_PATH.value()
91
+ settings = get_current_settings()
92
+ default_block = settings.results.default_storage_block
93
+ basepath = settings.results.local_storage_path
99
94
 
100
95
  cache_key = (str(default_block), str(basepath))
101
96
 
@@ -169,13 +164,14 @@ async def get_or_create_default_task_scheduling_storage() -> ResultStorage:
169
164
  """
170
165
  Generate a default file system for background task parameter/result storage.
171
166
  """
172
- default_block = PREFECT_TASK_SCHEDULING_DEFAULT_STORAGE_BLOCK.value()
167
+ settings = get_current_settings()
168
+ default_block = settings.tasks.scheduling.default_storage_block
173
169
 
174
170
  if default_block is not None:
175
171
  return await Block.load(default_block)
176
172
 
177
173
  # otherwise, use the local file system
178
- basepath = PREFECT_LOCAL_STORAGE_PATH.value()
174
+ basepath = settings.results.local_storage_path
179
175
  return LocalFileSystem(basepath=basepath)
180
176
 
181
177
 
@@ -183,22 +179,36 @@ def get_default_result_serializer() -> Serializer:
183
179
  """
184
180
  Generate a default file system for result storage.
185
181
  """
186
- return resolve_serializer(PREFECT_RESULTS_DEFAULT_SERIALIZER.value())
182
+ settings = get_current_settings()
183
+ return resolve_serializer(settings.results.default_serializer)
187
184
 
188
185
 
189
186
  def get_default_persist_setting() -> bool:
190
187
  """
191
- Return the default option for result persistence (False).
188
+ Return the default option for result persistence.
189
+ """
190
+ settings = get_current_settings()
191
+ return settings.results.persist_by_default
192
+
193
+
194
+ def get_default_persist_setting_for_tasks() -> bool:
195
+ """
196
+ Return the default option for result persistence for tasks.
192
197
  """
193
- return PREFECT_RESULTS_PERSIST_BY_DEFAULT.value()
198
+ settings = get_current_settings()
199
+ return (
200
+ settings.tasks.default_persist_result
201
+ if settings.tasks.default_persist_result is not None
202
+ else settings.results.persist_by_default
203
+ )
194
204
 
195
205
 
196
206
  def should_persist_result() -> bool:
197
207
  """
198
208
  Return the default option for result persistence determined by the current run context.
199
209
 
200
- If there is no current run context, the default value set by
201
- `PREFECT_RESULTS_PERSIST_BY_DEFAULT` will be returned.
210
+ If there is no current run context, the value of `results.persist_by_default` on the
211
+ current settings will be returned.
202
212
  """
203
213
  from prefect.context import FlowRunContext, TaskRunContext
204
214
 
@@ -209,7 +219,7 @@ def should_persist_result() -> bool:
209
219
  if flow_run_context is not None:
210
220
  return flow_run_context.persist_result
211
221
 
212
- return PREFECT_RESULTS_PERSIST_BY_DEFAULT.value()
222
+ return get_default_persist_setting()
213
223
 
214
224
 
215
225
  def _format_user_supplied_storage_key(key: str) -> str:
@@ -1,3 +1,4 @@
1
+ import inspect
1
2
  from functools import partial
2
3
  from typing import Any, Dict, Tuple, Type
3
4
 
@@ -8,9 +9,18 @@ from pydantic import (
8
9
  SerializerFunctionWrapHandler,
9
10
  model_serializer,
10
11
  )
11
- from pydantic_settings import BaseSettings, PydanticBaseSettingsSource
12
+ from pydantic_settings import (
13
+ BaseSettings,
14
+ PydanticBaseSettingsSource,
15
+ SettingsConfigDict,
16
+ )
12
17
 
13
- from prefect.settings.sources import EnvFilterSettingsSource, ProfileSettingsTomlLoader
18
+ from prefect.settings.sources import (
19
+ EnvFilterSettingsSource,
20
+ PrefectTomlConfigSettingsSource,
21
+ ProfileSettingsTomlLoader,
22
+ PyprojectTomlConfigSettingsSource,
23
+ )
14
24
  from prefect.utilities.collections import visit_collection
15
25
  from prefect.utilities.pydantic import handle_secret_render
16
26
 
@@ -54,6 +64,8 @@ class PrefectBaseSettings(BaseSettings):
54
64
  ),
55
65
  dotenv_settings,
56
66
  file_secret_settings,
67
+ PrefectTomlConfigSettingsSource(settings_cls),
68
+ PyprojectTomlConfigSettingsSource(settings_cls),
57
69
  ProfileSettingsTomlLoader(settings_cls),
58
70
  )
59
71
 
@@ -105,7 +117,7 @@ class PrefectBaseSettings(BaseSettings):
105
117
  if isinstance(child_settings := getattr(self, key), PrefectBaseSettings):
106
118
  child_jsonable = child_settings.model_dump(
107
119
  mode=info.mode,
108
- include=child_include,
120
+ include=child_include, # type: ignore
109
121
  exclude=child_exclude,
110
122
  exclude_unset=info.exclude_unset,
111
123
  context=info.context,
@@ -129,3 +141,53 @@ class PrefectBaseSettings(BaseSettings):
129
141
  )
130
142
 
131
143
  return jsonable_self
144
+
145
+
146
+ class PrefectSettingsConfigDict(SettingsConfigDict, total=False):
147
+ """
148
+ Configuration for the behavior of Prefect settings models.
149
+ """
150
+
151
+ prefect_toml_table_header: tuple[str, ...]
152
+ """
153
+ Header of the TOML table within a prefect.toml file to use when filling variables.
154
+ This is supplied as a `tuple[str, ...]` instead of a `str` to accommodate for headers
155
+ containing a `.`.
156
+
157
+ To use the root table, exclude this config setting or provide an empty tuple.
158
+ """
159
+
160
+
161
+ def _add_environment_variables(
162
+ schema: Dict[str, Any], model: Type[PrefectBaseSettings]
163
+ ) -> None:
164
+ for property in schema["properties"]:
165
+ env_vars = []
166
+ schema["properties"][property]["supported_environment_variables"] = env_vars
167
+ field = model.model_fields[property]
168
+ if inspect.isclass(field.annotation) and issubclass(
169
+ field.annotation, PrefectBaseSettings
170
+ ):
171
+ continue
172
+ elif field.validation_alias:
173
+ if isinstance(field.validation_alias, AliasChoices):
174
+ for alias in field.validation_alias.choices:
175
+ if isinstance(alias, str):
176
+ env_vars.append(alias.upper())
177
+ else:
178
+ env_vars.append(f"{model.model_config.get('env_prefix')}{property.upper()}")
179
+
180
+
181
+ def _build_settings_config(
182
+ path: Tuple[str, ...] = tuple(),
183
+ ) -> PrefectSettingsConfigDict:
184
+ env_prefix = f"PREFECT_{'_'.join(path).upper()}_" if path else "PREFECT_"
185
+ return PrefectSettingsConfigDict(
186
+ env_prefix=env_prefix,
187
+ env_file=".env",
188
+ extra="ignore",
189
+ toml_file="prefect.toml",
190
+ prefect_toml_table_header=path,
191
+ pyproject_toml_table_header=("tool", "prefect", *path),
192
+ json_schema_extra=_add_environment_variables,
193
+ )
@@ -64,7 +64,7 @@ class Setting:
64
64
  for key in path:
65
65
  current_value = getattr(current_value, key, None)
66
66
  if isinstance(current_value, _SECRET_TYPES):
67
- return current_value.get_secret_value()
67
+ return current_value.get_secret_value() # type: ignore
68
68
  return current_value
69
69
 
70
70
  def __bool__(self) -> bool:
@@ -2,9 +2,11 @@ import os
2
2
  from typing import Optional
3
3
 
4
4
  from pydantic import Field, SecretStr
5
- from pydantic_settings import SettingsConfigDict
6
5
 
7
- from prefect.settings.base import PrefectBaseSettings
6
+ from prefect.settings.base import (
7
+ PrefectBaseSettings,
8
+ _build_settings_config,
9
+ )
8
10
 
9
11
 
10
12
  class APISettings(PrefectBaseSettings):
@@ -12,9 +14,7 @@ class APISettings(PrefectBaseSettings):
12
14
  Settings for interacting with the Prefect API
13
15
  """
14
16
 
15
- model_config = SettingsConfigDict(
16
- env_prefix="PREFECT_API_", env_file=".env", extra="ignore"
17
- )
17
+ model_config = _build_settings_config(("api",))
18
18
  url: Optional[str] = Field(
19
19
  default=None,
20
20
  description="The URL of the Prefect API. If not set, the client will attempt to infer it.",
@@ -1,9 +1,11 @@
1
1
  from typing import Optional
2
2
 
3
3
  from pydantic import Field
4
- from pydantic_settings import SettingsConfigDict
5
4
 
6
- from prefect.settings.base import PrefectBaseSettings
5
+ from prefect.settings.base import (
6
+ PrefectBaseSettings,
7
+ _build_settings_config,
8
+ )
7
9
 
8
10
 
9
11
  class CLISettings(PrefectBaseSettings):
@@ -11,9 +13,7 @@ class CLISettings(PrefectBaseSettings):
11
13
  Settings for controlling CLI behavior
12
14
  """
13
15
 
14
- model_config = SettingsConfigDict(
15
- env_prefix="PREFECT_CLI_", env_file=".env", extra="ignore"
16
- )
16
+ model_config = _build_settings_config(("cli",))
17
17
 
18
18
  colors: bool = Field(
19
19
  default=True,
@@ -1,7 +1,9 @@
1
1
  from pydantic import AliasChoices, AliasPath, Field
2
- from pydantic_settings import SettingsConfigDict
3
2
 
4
- from prefect.settings.base import PrefectBaseSettings
3
+ from prefect.settings.base import (
4
+ PrefectBaseSettings,
5
+ _build_settings_config,
6
+ )
5
7
  from prefect.types import ClientRetryExtraCodes
6
8
 
7
9
 
@@ -10,9 +12,7 @@ class ClientMetricsSettings(PrefectBaseSettings):
10
12
  Settings for controlling metrics reporting from the client
11
13
  """
12
14
 
13
- model_config = SettingsConfigDict(
14
- env_prefix="PREFECT_CLIENT_METRICS_", env_file=".env", extra="ignore"
15
- )
15
+ model_config = _build_settings_config(("client", "metrics"))
16
16
 
17
17
  enabled: bool = Field(
18
18
  default=False,
@@ -37,9 +37,7 @@ class ClientSettings(PrefectBaseSettings):
37
37
  Settings for controlling API client behavior
38
38
  """
39
39
 
40
- model_config = SettingsConfigDict(
41
- env_prefix="PREFECT_CLIENT_", env_file=".env", extra="ignore"
42
- )
40
+ model_config = _build_settings_config(("client",))
43
41
 
44
42
  max_retries: int = Field(
45
43
  default=5,