summary refs log tree commit diff
path: root/synapse/config/workers.py
diff options
context:
space:
mode:
authorMaxwell G <maxwell@gtmx.me>2023-09-25 10:19:08 -0500
committerGitHub <noreply@github.com>2023-09-25 15:19:08 +0000
commit12611bfcddfe87e3bad90ef96a648acc2f1cebf3 (patch)
tree9d67371d56f1904f3098e9bf7668db71a8b631cc /synapse/config/workers.py
parentBump cryptography from 41.0.3 to 41.0.4 (#16362) (diff)
downloadsynapse-12611bfcddfe87e3bad90ef96a648acc2f1cebf3.tar.xz
Add support for pydantic v2 via pydantic.v1 compat module (#16332)
While maintaining support with pydantic v1.
Diffstat (limited to 'synapse/config/workers.py')
-rw-r--r--synapse/config/workers.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/config/workers.py b/synapse/config/workers.py
index 6567fb6bb0..f1766088fc 100644
--- a/synapse/config/workers.py
+++ b/synapse/config/workers.py
@@ -15,10 +15,16 @@
 
 import argparse
 import logging
-from typing import Any, Dict, List, Optional, Union
+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
 
 import attr
-from pydantic import BaseModel, Extra, StrictBool, StrictInt, StrictStr
+
+from synapse._pydantic_compat import HAS_PYDANTIC_V2
+
+if TYPE_CHECKING or HAS_PYDANTIC_V2:
+    from pydantic.v1 import BaseModel, Extra, StrictBool, StrictInt, StrictStr
+else:
+    from pydantic import BaseModel, Extra, StrictBool, StrictInt, StrictStr
 
 from synapse.config._base import (
     Config,