Starlette-context

Latest version: v0.4.0

Safety actively analyzes 715032 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

0.4.0

* Drop support for Python 3.8. Now only 3.9+ is supported ( https://github.com/tomwojcik/starlette-context/pull/152/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R29 )
* Drop support for Starlette versions below 0.27.0 ( released May 16, 2023) ( https://github.com/tomwojcik/starlette-context/pull/152/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R30 )
* Drop `ContextMiddleware` deprecation warning as Starlette no longer plans to deprecate it ( https://github.com/encode/starlette/discussions/2160#discussioncomment-6053386 )
* Fix `starlette-context` potentially breaking if `ContextMiddleware` is used along with `starlette>=0.41.3` ( https://github.com/tomwojcik/starlette-context/issues/151 )

0.3.6

* fix for being unable to catch some exceptions with a try/except due to base exc inheriting from the `BaseException` (Thanks soundstripe) https://github.com/tomwojcik/starlette-context/issues/90
* minimal Python version required is now 3.8

0.3.5

- fix for accessing the context in error handlers (Thanks hhamana) https://github.com/tomwojcik/starlette-context/issues/74

0.3.4

- add ``request_cycle_context``. It’s a context manager that allows for easier testing and cleaner code (Thanks hhamana) https://github.com/tomwojcik/starlette-context/issues/46
- fix for accessing context during logging, outside of the request-response cycle. Technically it should raise an exception, but it makes sense to include the context by default (in logs) and if it’s not available, some logs are better than no logs. Now it will show context data if context is available, with a fallback to an empty dict (instead of raising an exc) https://github.com/tomwojcik/starlette-context/issues/65
- add ``ContextMiddleware`` deprecation warning
- ``**context`` context unpacking seems to be working now

0.3.3

* add support for custom error responses if error occurred in plugin / middleware -> fix for 500 (Thanks hhamana)
* better (custom) exceptions with a base `StarletteContextError` (Thanks hhamana)

0.3.2

* ``ContextDoesNotExistError`` is raised when context object can't be accessed. Previously it was ``RuntimeError``.
For backwards compatibility, it inherits from ``RuntimeError`` so it shouldn't result in any regressions.
* Added ``py.typed`` file so your mypy should never complain

Page 1 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.