File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 22
33import copy
44import os
5+ import shutil
56import secrets
67from contextlib import AsyncExitStack , asynccontextmanager
78from inspect import signature
@@ -214,6 +215,18 @@ def __init__(
214215 cast ("Tag | TagList" , ui ), lib_prefix = self .lib_prefix
215216 )
216217
218+ def __del__ (self ):
219+ user_dependencies = [
220+ v .source ["subdir" ]
221+ for k , v in self ._registered_dependencies .items ()
222+ if k .startswith ("include-" )
223+ ]
224+
225+ for item in user_dependencies :
226+ if os .path .exists (item ):
227+ print ("Removing dependency: " , item )
228+ shutil .rmtree (item )
229+
217230 def init_starlette_app (self ) -> starlette .applications .Starlette :
218231 routes : list [starlette .routing .BaseRoute ] = [
219232 starlette .routing .WebSocketRoute ("/websocket/" , self ._on_connect_cb ),
Original file line number Diff line number Diff line change @@ -197,7 +197,6 @@ def check_path(path: Path | str) -> Path:
197197def create_include_dependency (
198198 name : str , path : str , include_files : bool
199199) -> tuple [HTMLDependency , str ]:
200- print ("create include: " , name , os .path .dirname (path ))
201200 dep = HTMLDependency (
202201 name ,
203202 DEFAULT_VERSION ,
You can’t perform that action at this time.
0 commit comments