Python: map Python middlewares to Tower layers (#1871)
* Python: map Python middlewares to Tower layers * Make middleware layer infallible * Use message and status code from `PyMiddlewareException` * Introduce `FuncMetadata` to represent some information about a Python function * Improve middleware errors * Add missing copyright headers * Allow accessing and changing request body * Allow changing response * Add some documentation about moving data back-and-forth between Rust and Python * Add `mypy` to Pokemon service and update typings and comments for middlewares * Add or update comments on the important types * Add Rust equivalent of `collections.abc.MutableMapping` * Add `PyHeaderMap` to make `HeaderMap` accessible from Python * Apply suggestions from code review Co-authored-by:Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> * Improve logging * Add `RichPyErr` to have a better output for `PyErr`s * Better error messages for `PyMiddlewareError` variants * Factor out repeating patterns in tests * Preserve `__builtins__` in `globals` to fix tests in Python 3.7.10 (our CI version) * Export `RichPyErr` to fix `cargo doc` error * Apply suggestions from code review Co-authored-by:
Matteo Bigoi <1781140+crisidev@users.noreply.github.com> * Add missing SPDX headers * Document that `keys`, `values` and `items` on `PyMutableMapping` causes clones Co-authored-by:
Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Co-authored-by:
Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
Loading
Please register or sign in to comment