Python SDK migration guide: v0.3 to v0.4
This guide will help you migrate your Inngest Python SDK from v0.3 to v0.4 by providing a summary of the breaking changes.
Middleware
Constructor
Added the raw_request
arg to the constructor. This is the raw HTTP request received by the serve
function. Its usecase is predominately for platforms that include critical information in the request, like environment variables in Cloudflare Workers.
transform_input
Added the steps
arg, which was previous in ctx._steps
. This is useful in encryption middleware.
Added the function
arg, which is the inngest.Function
object. This is useful for middleware that needs to know the function's metadata (like error reporting).
Its return type is now None
since modifying data should happen by mutating args.
transform_output
Replaced the output
arg with result
arg. Its type is the new inngest.TransformOutputResult
class:
class TransformOutputResult:
# Mutations to these fields within middleware will be kept after running
# middleware
error: typing.Optional[Exception]
output: object
# Mutations to these fields within middleware will be discarded after
# running middleware
step: typing.Optional[TransformOutputStepInfo]
class TransformOutputStepInfo:
id: str
op: execution.Opcode
opts: typing.Optional[dict[str, object]]
Its return type is now None
since modifying data should happen by mutating args.
Removed exports
inngest.FunctionID
-- No use case.inngest.Output
-- Replaced byinngest.TransformOutputResult
.
Removed async_mode
arg in inngest.django.serve
This argument is no longer needed since async mode is inferred based on the Inngest functions you declare. If you have one or more async
Inngest functions then async mode is enabled.
NonRetriableError
Removed the cause
arg since it wasn't actually used. We'll eventually reintroduce it in a proper way.