add note to @expose decorator

This commit is contained in:
Reinier van der Leer
2024-08-28 17:59:12 +02:00
parent efdd0fb04c
commit 0c2c8085bd

View File

@@ -22,6 +22,15 @@ pyro_host = Config().pyro_host
def expose(func: C) -> C:
"""
Decorator to mark a method or class to be exposed for remote calls.
## ⚠️ Gotcha
The types on the exposed function signature are respected **as long as they are
fully picklable**. This is not the case for Pydantic models, so if you really need
to pass a model, try dumping the model and passing the resulting dict instead.
"""
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)