File tree 1 file changed +17
-0
lines changed
src/mkdocstrings_handlers/python
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 7
7
from dataclasses import field , fields
8
8
from typing import TYPE_CHECKING , Annotated , Any , Literal
9
9
10
+ from mkdocstrings .loggers import get_logger
11
+
10
12
# YORE: EOL 3.10: Replace block with line 2.
11
13
if sys .version_info >= (3 , 11 ):
12
14
from typing import Self
13
15
else :
14
16
from typing_extensions import Self
15
17
18
+
19
+ logger = get_logger (__name__ )
20
+
21
+
16
22
try :
17
23
# When Pydantic is available, use it to validate options (done automatically).
18
24
# Users can therefore opt into validation by installing Pydantic in development/CI.
30
36
if getattr (pydantic , "__version__" , "1." ).startswith ("1." ):
31
37
raise ImportError # noqa: TRY301
32
38
39
+ if sys .version_info < (3 , 10 ):
40
+ try :
41
+ import eval_type_backport # noqa: F401
42
+ except ImportError :
43
+ logger .debug (
44
+ "Pydantic needs the `eval-type-backport` package to be installed "
45
+ "for modern type syntax to work on Python 3.9. "
46
+ "Deactivating Pydantic validation for Python handler options." ,
47
+ )
48
+ raise
49
+
33
50
from inspect import cleandoc
34
51
35
52
from pydantic import Field as BaseField
You can’t perform that action at this time.
0 commit comments