From 112c01afa837f56a2d7bb80046bd785642bf6b25 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 3 Oct 2024 17:13:49 -0700 Subject: [PATCH] Remove dill dependency --- pyproject.toml | 1 - reflex/state.py | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 08c4fbdbc..281741368 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ packages = [ [tool.poetry.dependencies] python = "^3.9" -dill = ">=0.3.8,<0.4" fastapi = ">=0.96.0,!=0.111.0,!=0.111.1" gunicorn = ">=20.1.0,<24.0" jinja2 = ">=3.1.2,<4.0" diff --git a/reflex/state.py b/reflex/state.py index c66070da7..5798564fa 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -35,7 +35,6 @@ from typing import ( get_type_hints, ) -import dill from sqlalchemy.orm import DeclarativeBase from typing_extensions import Self @@ -2835,25 +2834,6 @@ class StateManagerDisk(StateManager): await self.set_state(token, state) -# Workaround https://github.com/cloudpipe/cloudpickle/issues/408 for dynamic pydantic classes -if not isinstance(State.validate.__func__, FunctionType): - cython_function_or_method = type(State.validate.__func__) - - @dill.register(cython_function_or_method) - def _dill_reduce_cython_function_or_method(pickler, obj): - # Ignore cython function when pickling. - pass - - -@dill.register(type(State)) -def _dill_reduce_state(pickler, obj): - if obj is not State and issubclass(obj, State): - # Avoid serializing subclasses of State, instead get them by reference from the State class. - pickler.save_reduce(State.get_class_substate, (obj.get_full_name(),), obj=obj) - else: - dill.Pickler.dispatch[type](pickler, obj) - - def _default_lock_expiration() -> int: """Get the default lock expiration time.