The latest major version (v7) of web3.py includes a reimagining of the middleware architecture. The short version: the functional programming paradigm has been replaced with class-based middleware. The refactor provides clearer control over request and response processing, and clears the path for new features, including batch transactions.
This post