Change Log
This document records all notable changes to starlette-context. This project adheres to Semantic Versioning.
Latest release
0.4.0
Release date: TBA
remove ContextMiddleware https://github.com/tomwojcik/starlette-context/issues/47
0.3.6
Release date: February 16, 2023
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
Release date: November 26, 2022
fix for accessing the context in error handlers (Thanks @hhamana) https://github.com/tomwojcik/starlette-context/issues/74
0.3.4
Release date: June 22, 2022
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
Release date: June 28, 2021
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
Release date: April 22, 2021
ContextDoesNotExistError
is raised when context object can’t be accessed. Previously it wasRuntimeError
. For backwards compatibility, it inherits fromRuntimeError
so it shouldn’t result in any regressions.Added
py.typed
file so your mypy should never complain (Thanks @ginomempin)
0.3.1
Release date: October 17, 2020
add
ApiKeyPlugin
plugin forX-API-Key
header
0.3.0
Release date: October 10, 2020
add
RawContextMiddleware
forStreaming
andFile
responsesadd flake8, isort, mypy
small refactor of the base plugin, moved directories and removed one redundant method (potentially breaking changes)
0.2.3
Release date: July 27, 2020
add docs on read the docs
fix bug with
force_new_uuid=True
returning the same uuid constantlydue to ^ a lot of tests had to be refactored as well
0.2.2
Release date: Apr 26, 2020
for correlation id and request id plugins, add support for enforcing the generation of a new value
for ^ plugins add support for validating uuid. It’s a default behavior so will break things for people who don’t use uuid4 there. If you don’t want this validation, you need to pass validate=False to the plugin
you can now check if context is available (Thanks @VukW)
0.2.1
Release date: Apr 18, 2020
dropped with_plugins from the middleware as Starlette has it’s own way of doing this
due to ^ this change some tests are simplified
if context is not available no LookupError will be raised, instead there will be RuntimeError, because this error might mean one of two things: user either didn’t use ContextMiddleware or is trying to access context object outside of request-response cycle
0.2.0
Release date: Feb 21, 2020
changed parent of context object. More or less the API is the same but due to this change the implementation itself is way more simple and now it’s possible to use .items() or keys() like in a normal dict, out of the box. Still, unpacking
**kwargs
is not supported and I don’t think it ever will be. I tried to inherit from the builtin dict but nothing good came out of this. Now you access context as dict using context.data, not context.dict()there was an issue related to not having awaitable plugins. Now both middleware and plugins are fully async compatible. It’s a breaking change as it forces to use await, hence new minor version
0.1.6
Release date: Jan 2, 2020
breaking changes
one middleware, one context, multiple plugins for middleware
very easy testing and writing custom plugins
0.1.5
Release date: Jan 1, 2020
lint
tests (100% cov)
separate class for header constants
BasicContextMiddleware add some logic
0.1.4
Release date: Dec 31, 2019
get_many in context object
cicd improvements
type annotations
mvp until 0.1.4
experiments and tests with ContextVar