Skip to content

Commit 1f18057

Browse files
authored
Merge pull request #476 from transformerlab/fix/make-plugin-install-noexp
Make plugin install non experiment dependent
2 parents 1e639a0 + b9308ef commit 1f18057

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

transformerlab/routers/experiment/plugins.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import os
33
from pathlib import Path
4-
from distutils.dir_util import remove_tree
54

65
from typing import Annotated
76

@@ -15,7 +14,7 @@
1514

1615
from werkzeug.utils import secure_filename
1716

18-
from transformerlab.routers.plugins import install_plugin, plugin_gallery
17+
from transformerlab.routers.plugins import plugin_gallery
1918

2019

2120
router = APIRouter(prefix="/plugins", tags=["plugins"])
@@ -105,18 +104,6 @@ async def experiment_list_scripts(id: int, type: str = None, filter: str = None)
105104
return scripts_full_json
106105

107106

108-
@router.get(path="/install_plugin_to_experiment")
109-
async def install_plugin_to_experiment(id: int, plugin_name: str):
110-
return await install_plugin(plugin_name)
111-
112-
113-
@router.get(path="/delete_plugin_from_experiment")
114-
async def delete_plugin_from_experiment(id: int, plugin_name: str):
115-
final_path = dirs.plugin_dir_by_name(plugin_name)
116-
remove_tree(final_path)
117-
return {"message": f"Plugin {plugin_name} deleted from experiment {id}"}
118-
119-
120107
@router.get("/download", summary="Download a dataset to the LLMLab server.")
121108
async def plugin_download(id: int, plugin_slug: str):
122109
"""Download a plugin and install to a local list of available plugins"""

transformerlab/routers/plugins.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from distutils.dir_util import copy_tree
2+
from distutils.dir_util import copy_tree, remove_tree
33
import json
44
import os
55
import sys
@@ -167,6 +167,13 @@ async def run_installer_for_plugin(plugin_id: str, log_file):
167167
return {"status": "success", "message": return_msg}
168168

169169

170+
@router.get(path="/delete_plugin")
171+
async def delete_plugin(plugin_name: str):
172+
final_path = dirs.plugin_dir_by_name(plugin_name)
173+
remove_tree(final_path)
174+
return {"message": f"Plugin {plugin_name} deleted successfully."}
175+
176+
170177
@router.get("/gallery/{plugin_id}/install", summary="Install a plugin from the gallery.")
171178
async def install_plugin(plugin_id: str):
172179
"""Install a plugin from the gallery"""

0 commit comments

Comments
 (0)