File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -76,11 +76,29 @@ def extract_marker_from_fastapi(param: Any) -> Any:
7676
7777 MARKER_EXTRACTORS .append (extract_marker_from_fastapi )
7878
79+ # Fast-depends support for both old and new versions
80+ FastDepends = None
81+ FastDependant = None
82+
83+ # Try to import from different locations to support both versions
84+ with suppress (ImportError ):
85+ # Try version 3.0.0+ first (Dependant from model)
86+ from fast_depends .dependencies .model import Dependant as FastDependant
87+
88+ def extract_marker_from_dependant_fast_depends (param : Any ) -> Any :
89+ # Check for Dependant (3.0.0+)
90+ if FastDependant is not None and isinstance (param , FastDependant ):
91+ return param .dependency
92+ return None
93+
94+ MARKER_EXTRACTORS .append (extract_marker_from_dependant_fast_depends )
95+
7996with suppress (ImportError ):
97+ # Try version < 3.0.0 (Depends class)
8098 from fast_depends .dependencies import Depends as FastDepends
8199
82100 def extract_marker_from_fast_depends (param : Any ) -> Any :
83- if isinstance (param , FastDepends ):
101+ if FastDepends is not None and isinstance (param , FastDepends ):
84102 return param .dependency
85103 return None
86104
Original file line number Diff line number Diff line change 1717 mypy_boto3_s3
1818 pydantic-settings
1919 werkzeug
20- fast-depends
20+ fast-depends ==3.0.0
2121extras =
2222 yaml
2323commands = pytest
4545 boto3
4646 mypy_boto3_s3
4747 werkzeug
48- fast-depends
48+ fast-depends ==3.0.0
4949commands = pytest -m pydantic
5050
5151[testenv:coveralls]
You can’t perform that action at this time.
0 commit comments