Skip to content

Make plugin install non experiment dependent #476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions transformerlab/routers/experiment/plugins.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import os
from pathlib import Path
from distutils.dir_util import remove_tree

from typing import Annotated

Expand All @@ -15,7 +14,7 @@

from werkzeug.utils import secure_filename

from transformerlab.routers.plugins import install_plugin, plugin_gallery
from transformerlab.routers.plugins import plugin_gallery


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


@router.get(path="/install_plugin_to_experiment")
async def install_plugin_to_experiment(id: int, plugin_name: str):
return await install_plugin(plugin_name)


@router.get(path="/delete_plugin_from_experiment")
async def delete_plugin_from_experiment(id: int, plugin_name: str):
final_path = dirs.plugin_dir_by_name(plugin_name)
remove_tree(final_path)
return {"message": f"Plugin {plugin_name} deleted from experiment {id}"}


@router.get("/download", summary="Download a dataset to the LLMLab server.")
async def plugin_download(id: int, plugin_slug: str):
"""Download a plugin and install to a local list of available plugins"""
Expand Down
9 changes: 8 additions & 1 deletion transformerlab/routers/plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from distutils.dir_util import copy_tree
from distutils.dir_util import copy_tree, remove_tree
import json
import os
import sys
Expand Down Expand Up @@ -167,6 +167,13 @@ async def run_installer_for_plugin(plugin_id: str, log_file):
return {"status": "success", "message": return_msg}


@router.get(path="/delete_plugin")
async def delete_plugin(plugin_name: str):
final_path = dirs.plugin_dir_by_name(plugin_name)
remove_tree(final_path)
return {"message": f"Plugin {plugin_name} deleted successfully."}


@router.get("/gallery/{plugin_id}/install", summary="Install a plugin from the gallery.")
async def install_plugin(plugin_id: str):
"""Install a plugin from the gallery"""
Expand Down
Loading