Skip to content

Configure Python Env tool #25091

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 9 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
86 changes: 43 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1465,81 +1465,58 @@
],
"languageModelTools": [
{
"name": "get_python_environment_info",
"name": "get_python_environment_details",
"displayName": "Get Python Environment Info",
"userDescription": "%python.languageModelTools.get_python_environment_info.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. The details returned include the 1. Type of Environment (conda, venv, etec), 2. Version of Python, 3. List of all installed packages with their versions. ",
"userDescription": "%python.languageModelTools.get_python_environment_details.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. The details returned include the 1. Type of Environment (conda, venv, etec), 2. Version of Python, 3. List of all installed packages with their versions. ALWAYS call configure_python_environment before using this tool.",
"toolReferenceName": "pythonGetEnvironmentInfo",
"tags": [
"ms-python.python"
"enable_other_tool_configure_python_environment"
],
"icon": "$(files)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string"
"type": "string",
"description": "The path to the Python file or workspace to get the environment information for."
}
},
"description": "The path to the Python file or workspace to get the environment information for.",
"required": []
}
},
"when": "!pythonEnvExtensionInstalled"
},
{
"name": "get_python_executable",
"name": "get_python_executable_details",
"displayName": "Get Python Executable",
"userDescription": "%python.languageModelTools.get_python_executable.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. ALWAYS use this tool before executing any Python command in the terminal. This tool returns the details of how to construct the fully qualified path and or command including details such as arguments required to run Python in a terminal. Note: Instead of executing `python --version` or `python -c 'import sys; print(sys.executable)'`, use this tool to get the Python executable path to replace the `python` command. E.g. instead of using `python -c 'import sys; print(sys.executable)'`, use this tool to build the command `conda run -n <env_name> -c 'import sys; print(sys.executable)'`.",
"userDescription": "%python.languageModelTools.get_python_executable_details.userDescription%",
"modelDescription": "This tool will retrieve the details of the Python Environment for the specified file or workspace. ALWAYS use this tool before executing any Python command in the terminal. This tool returns the details of how to construct the fully qualified path and or command including details such as arguments required to run Python in a terminal. Note: Instead of executing `python --version` or `python -c 'import sys; print(sys.executable)'`, use this tool to get the Python executable path to replace the `python` command. E.g. instead of using `python -c 'import sys; print(sys.executable)'`, use this tool to build the command `conda run -n <env_name> -c 'import sys; print(sys.executable)'`. ALWAYS call configure_python_environment before using this tool.",
"toolReferenceName": "pythonExecutableCommand",
"tags": [
"ms-python.python"
],
"icon": "$(files)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string"
}
},
"description": "The path to the Python file or workspace to get the executable information for. If not provided, the current workspace will be used. Where possible pass the path to the file or workspace.",
"required": []
}
},
{
"name": "list_python_packages",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this tool, was disabled

"displayName": "List Python Packages",
"userDescription": "%python.languageModelTools.list_python_packages.userDescription%",
"modelDescription": "This tool will retrieve the list of all installed packages installed in a Python Environment for the specified file or workspace. ALWAYS use this tool instead of executing Python command in the terminal to fetch the list of installed packages. WARNING: Packages installed can change over time, hence the list of packages returned by this tool may not be accurate. Use this tool to get the list of installed packages in a Python environment.",
"toolReferenceName": "listPythonPackages",
"tags": [
"ms-python.python"
"enable_other_tool_configure_python_environment"
],
"icon": "$(files)",
"icon": "$(snake)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string"
"type": "string",
"description": "The path to the Python file or workspace to get the executable information for. If not provided, the current workspace will be used. Where possible pass the path to the file or workspace."
}
},
"description": "The path to the Python file or workspace to list the packages. If not provided, the current workspace will be used. Where possible pass the path to the file or workspace.",
"required": []
},
"when": "false"
"when": "!pythonEnvExtensionInstalled"
},
{
"name": "install_python_package",
"name": "install_python_packages",
"displayName": "Install Python Package",
"userDescription": "%python.languageModelTools.python_install_package.userDescription%",
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment.",
"userDescription": "%python.languageModelTools.install_python_packages.userDescription%",
"modelDescription": "Installs Python packages in the given workspace. Use this tool to install packages in the user's chosen environment. ALWAYS call configure_python_environment before using this tool.",
"toolReferenceName": "pythonInstallPackage",
"tags": [
"ms-python.python"
],
"tags": [],
"icon": "$(package)",
"canBeReferencedInPrompt": true,
"inputSchema": {
Expand All @@ -1562,6 +1539,29 @@
]
},
"when": "!pythonEnvExtensionInstalled"
},
{
"name": "configure_python_environment",
"displayName": "Configure Python Environment",
"modelDescription": "This tool configures a Python environment in the given workspace. ALWAYS Use this tool to set up the user's chosen environment and ALWAYS call this tool before using any other Python related tools.",
"userDescription": "%python.languageModelTools.configure_python_environment.userDescription%",
"toolReferenceName": "configurePythonEnvironment",
"tags": [
"ms-python.python"
],
"icon": "$(files)",
"canBeReferencedInPrompt": true,
"inputSchema": {
"type": "object",
"properties": {
"resourcePath": {
"type": "string",
"description": "The path to the Python file or workspace for which a Python Environment needs to be configured."
}
},
"required": []
},
"when": "!pythonEnvExtensionInstalled"
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions package.nls.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"python.command.python.startTerminalREPL.title": "Start Terminal REPL",
"python.languageModelTools.get_python_environment_info.userDescription": "Get information for a Python Environment, such as Type, Version, Packages, and more.",
"python.languageModelTools.python_install_package.userDescription": "Installs Python packages in a Python Environment.",
"python.languageModelTools.get_python_executable.userDescription": "Get executable info for a Python Environment",
"python.languageModelTools.list_python_packages.userDescription": "Get a list of all installed packages in a Python Environment.",
"python.languageModelTools.get_python_environment_details.userDescription": "Get information for a Python Environment, such as Type, Version, Packages, and more.",
"python.languageModelTools.install_python_packages.userDescription": "Installs Python packages in a Python Environment.",
"python.languageModelTools.get_python_executable_details.userDescription": "Get executable info for a Python Environment",
"python.languageModelTools.configure_python_environment.userDescription": "Configure a Python Environment for a workspace",
"python.command.python.startNativeREPL.title": "Start Native Python REPL",
"python.command.python.createEnvironment.title": "Create Environment...",
"python.command.python.createNewFile.title": "New Python File",
Expand Down
Loading
Loading