Skip to content

Commit 64f978e

Browse files
committed
Adding del
1 parent 8ae6460 commit 64f978e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

shiny/_app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import copy
44
import os
5+
import shutil
56
import secrets
67
from contextlib import AsyncExitStack, asynccontextmanager
78
from 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),

shiny/ui/_include_helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def check_path(path: Path | str) -> Path:
197197
def 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,

0 commit comments

Comments
 (0)