Fix deprecated useage of FastAPI Depends
fast-api-non-annotated-dependency (FAST002)
Derived from the FastAPI linter.
Fix is sometimes available.
Identifies FastAPI routes with deprecated uses of Depends or similar.
The [FastAPI documentation] recommends the use of [typing.Annotated][typing-annotated] for defining route dependencies and parameters, rather than using Depends, Query or similar as a default value for a parameter. Using this approach everywhere helps ensure consistency and clarity in defining dependencies and parameters.
Annotated was added to the typing module in Python 3.9; however, the third-party [typing_extensions][typing-extensions] package provides a backport that can be used on older versions of Python.
Issue Resolves ruff FAST issue.
Approach
ruff check --fix --unsafe-fixes
- [ ] PR title captures the intent of the changes, and is fitting for release notes.
- [ ] Added appropriate release note label
- [ ] Commit history is consistent and clean, in line with the contribution guidelines.
- [ ] Make sure unit tests pass locally after every commit (
git rebase -i main --exec 'just rapid-tests')
When applicable
- [ ] When there are user facing changes: Updated documentation
- [ ] New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
- [ ] Large PR: Prepare changes in small commits for more convenient review
- [ ] Bug fix: Add regression test for the bug
- [ ] Bug fix: Add backport label to latest release (format: 'backport release-branch-name')
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.65%. Comparing base (19228a0) to head (b3fd85f).
Additional details and impacted files
@@ Coverage Diff @@
## main #12531 +/- ##
==========================================
- Coverage 90.67% 90.65% -0.02%
==========================================
Files 431 431
Lines 29720 29721 +1
==========================================
- Hits 26948 26945 -3
- Misses 2772 2776 +4
| Flag | Coverage Δ | |
|---|---|---|
| cli-tests | 37.61% <0.00%> (-0.01%) |
:arrow_down: |
| gui-tests | 68.73% <0.00%> (-0.01%) |
:arrow_down: |
| performance-and-unit-tests | 74.15% <100.00%> (-0.02%) |
:arrow_down: |
| test | 38.36% <100.00%> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
CodSpeed Performance Report
Merging #12531 will not alter performance
Comparing berland:fast_typing (b3fd85f) with main (19228a0)
Summary
✅ 22 untouched