python-tools

Public

Forked from soumyajit7038/python-tools

python-tools gives LM Studio local models tools for trusted local Python work. It is for users who want a model to run Python code, manage Python files, check syntax, use selected Python interpreters, and install packages on their own machine.

764 Downloads

2 stars

1 fork

README

python-tools

python-tools gives LM Studio local models tools for trusted local Python work. It is for users who want a model to run Python code, manage Python files, check syntax, use selected Python interpreters, and install packages on their own machine.

Security Notice

This plugin executes Python code on the local machine. It is trusted local execution, not a sandbox.

Python code can read and write files and run operations according to the user's operating system permissions. pip install and pip uninstall can execute package-maintainer code. Only run code and install packages you trust.

Requirements

  • LM Studio with plugin support.
  • A local Python installation.
  • Windows is best supported for visible terminal windows.
  • Other platforms may have limited interactive-window support.

Installation

Install python-tools from LM Studio Hub. Use the Run in LM Studio or Hub install flow, then enable or use the plugin in a chat where tools are available.

Exact interface wording may vary between LM Studio versions.

Tools

ToolPurpose
run_pythonRun inline Python code and return output, errors, exit status, and the interpreter used.
run_python_fileRun a Python file from the workspace with the selected interpreter.
run_python_interactiveRun inline Python code in a visible terminal window where supported.
run_python_file_interactiveRun a Python file in a visible terminal window where supported.
install_moduleInstall a Python package for the selected interpreter.
uninstall_moduleUninstall a Python package from the selected interpreter.
switch_python_versionList or switch Python interpreters.
save_python_fileSave a Python file inside the workspace.
read_python_fileRead a Python file inside the workspace.
list_directoryList files and folders inside the workspace.
edit_python_fileEdit a Python file by text replacement.
edit_python_file_by_lineEdit a Python file by line number.
check_for_bugsCheck inline Python code for syntax or compile errors.
check_for_bugs_in_fileCheck a Python file for syntax or compile errors.
list_toolsList the tools registered by the plugin.

Python Interpreters

Python tools use the currently selected interpreter. run_python reports pythonExecutableUsed so users can see which Python executable ran the code.

Use switch_python_version to list or switch interpreters. Users may need to ensure Python is installed and discoverable. If supported by the tool, users can select an explicit executable path.

Interactive Windows

run_python_interactive and run_python_file_interactive open a visible terminal/window where supported. They return immediately to LM Studio.

The terminal remains open so the user can read output and errors. Windows desktop sessions are best supported. If no window opens, use the non-interactive tools or check platform support.

Workspace Files

File tools operate inside the configured workspace/safe root. Path traversal outside the workspace should be blocked.

Users should review files created or edited by an AI model.

Examples

  • Run this Python code and show stdout.
  • Save this script as hello.py.
  • Run hello.py with these arguments.
  • Check this code for syntax errors.
  • Install colorama for the selected Python interpreter.

Troubleshooting

  • Python not found: Install Python locally and make sure it is discoverable.
  • Wrong interpreter selected: Use switch_python_version to list and select the intended interpreter, then check pythonExecutableUsed.
  • Interactive window does not open: Use non-interactive tools or check whether visible terminal windows are supported on your platform.
  • Package install fails: Confirm the selected interpreter can run pip, the package name is valid, and the machine has the required permissions and network access.
  • File path rejected: Use a path inside the configured workspace.

For Maintainers

Run these from the plugin root:

npm install
npm run typecheck
npm run build
lms dev
lms login
lms push

lms dev is for local development. lms push publishes the current plugin folder to LM Studio Hub. Check manifest.json before publishing.