__init__.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import wandb
  2. from wandb._pydantic import IS_PYDANTIC_V2
  3. from .actions import ActionType, DoNothing, SendNotification, SendWebhook
  4. from .automations import Automation, NewAutomation
  5. from .events import (
  6. ArtifactEvent,
  7. EventType,
  8. MetricChangeFilter,
  9. MetricThresholdFilter,
  10. MetricZScoreFilter,
  11. OnAddArtifactAlias,
  12. OnCreateArtifact,
  13. OnLinkArtifact,
  14. OnRunMetric,
  15. OnRunState,
  16. RunEvent,
  17. RunStateFilter,
  18. )
  19. from .integrations import Integration, SlackIntegration, WebhookIntegration
  20. from .scopes import ArtifactCollectionScope, ProjectScope, ScopeType
  21. # ----------------------------------------------------------------------------
  22. # WARNINGS on import
  23. if not IS_PYDANTIC_V2:
  24. # Raises an error in Pydantic v1 environments, where the Automations API
  25. # has not been tested and is unlikely to work as expected.
  26. #
  27. # Remove this when we either:
  28. # - Drop support for Pydantic v1
  29. # - Are able to implement (limited) Pydantic v1 support
  30. raise ImportError(
  31. "The W&B Automations API requires Pydantic v2. "
  32. "We recommend upgrading `pydantic` to use this feature."
  33. )
  34. # ----------------------------------------------------------------------------
  35. __all__ = [
  36. # Scopes
  37. "ScopeType", # doc:exclude
  38. "ArtifactCollectionScope", # doc:exclude
  39. "ProjectScope", # doc:exclude
  40. # Events
  41. "EventType", # doc:exclude
  42. "OnAddArtifactAlias",
  43. "OnCreateArtifact",
  44. "OnLinkArtifact",
  45. "OnRunMetric",
  46. "OnRunState",
  47. "ArtifactEvent", # doc:exclude
  48. "RunEvent", # doc:exclude
  49. "MetricThresholdFilter",
  50. "MetricChangeFilter",
  51. "RunStateFilter",
  52. "MetricZScoreFilter",
  53. # Actions
  54. "ActionType", # doc:exclude
  55. "SendNotification",
  56. "SendWebhook",
  57. "DoNothing",
  58. # Automations
  59. "Automation",
  60. "NewAutomation",
  61. # Integrations
  62. "Integration", # doc:exclude
  63. "SlackIntegration", # doc:exclude
  64. "WebhookIntegration", # doc:exclude
  65. ]