FastAPI 0.140.2 has been released, focusing on internal refactoring and improved testing infrastructure. The main change eliminates the retention of flat dependency trees, streamlining how dependencies are processed. Additionally, a new memory benchmark has been introduced to track performance over time.
- Refactoring: Stop retaining flat dependency trees. PR #16065 by @tiangolo. Previously, FastAPI stored flat representations of resolved dependency trees, which could lead to unnecessary memory usage and complexity. This change removes that retention, simplifying internal logic and potentially reducing memory footprint in applications with complex dependency graphs.
- Internal improvement: Add new memory benchmark. PR #16064 by @tiangolo. A new benchmark has been added to measure memory consumption during dependency resolution and request handling. This will help the team detect regressions and optimize memory usage in future releases.
For developers, this update signals a focus on internal cleanliness and performance. The removal of flat dependency trees may not directly affect APIs, but it lays groundwork for more efficient dependency injection in future versions. The memory benchmark ensures that performance remains a priority as the framework evolves. As always, upgrade with pip install --upgrade fastapi to stay current.
Source: https://github.com/fastapi/fastapi/releases/tag/0.140.2