A plugin for LLM that enables proper plugin management when installed via uv tool.
Project description
llm-uv-tool
A plugin for LLM that enables proper plugin management when LLM is installed as a uv tool. It resolves compatibility issues between uv's isolated environment approach and LLM's plugin system.
Requirements
- Python 3.10, 3.11, 3.12, 3.13
- uv
Installation
Install LLM with this plugin:
uv tool install --with llm-uv-tool llm
If you already have LLM installed:
llm install llm-uv-tool
Once installed, use LLM's standard commands to manage plugins.
If you've previously installed other LLM plugins before adding llm-uv-tool, refer to the migration guide below for steps to preserve them.
Usage
This plugin provides uv-compatible versions of two built-in LLM commands:
llm installllm uninstall
Once installed, llm-uv-tool's commands replace the built-in versions while maintaining the same interface and arguments. Behind the scenes, they:
- Track installed plugins in a JSON file.
- Map appropriate arguments between LLM's commands and uv's tool system.
- Ensure plugins remain properly installed in uv's isolated environment.
Both commands accept the same arguments as LLM's built-in versions. These arguments are either:
- Mapped to equivalent
uv toolCLI arguments. - Handled internally to provide the same functionality.
llm install --force-reinstall llm-gpt4all
llm uninstall -y llm-gpt4all
The plugin maintains a list of installed plugins in a uv-tool-packages.json file located in your LLM config directory (typically ~/.config/io.datasette.llm/, though the location may vary depending on your OS). This file contains a simple JSON array with an entry for each installed plugin:
[
"llm-anthropic",
"llm-ollama",
"llm-uv-tool"
]
When you install or uninstall plugins, this file is automatically updated to track your changes.
Migrating to llm-uv-tool
If you have already installed LLM plugins and want to migrate to using llm-uv-tool, follow these steps:
-
Install llm-uv-tool in your current LLM environment:
llm install llm-uv-tool
-
Copy all installed plugins to
uv-tool-packages.jsonin your LLM config directory.If you have a small number of plugins, you may prefer to create this file by hand. Alternatively, you can use jq to automate the process with the following command:
llm plugins | jq "[.[].name]" > "$XDG_CONFIG_HOME/io.datasette.llm/uv-tool-packages.json"
-
To verify everything is working, add an additional plugin and check the contents of
uv-tool-packages.json.llm install llm-templates-github
After running this command, the newly installed plugin should appear at the end of the array. Using the above command with llm-templates-github as an example, it might look something like this:
[ "llm-anthropic", "llm-uv-tool", "llm-templates-github" ]
Why use this?
When LLM is installed as a standalone CLI tool using uv's tool feature (uv tool install llm), LLM's standard pip-based plugin installation mechanism conflicts with uv's isolated environments. This means actions like upgrading LLM (uv tool upgrade llm) removes all your installed plugins, forcing repeated reinstallation.
llm-uv-tool solves this issue by:
- Tracking installed plugins persistently.
- Intercepting
llm installandllm uninstallcommands to correctly manage plugins within the uv tool context. - Ensuring a consistent and familiar experience that mirrors the built-in LLM commands.
By handling the underlying uv interactions, this plugin ensures your chosen LLM plugins remain installed and functional across upgrades and other tool management operations.
License
llm-uv-tool is licensed under the MIT license. See the LICENSE file for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_uv_tool-0.1.3.tar.gz.
File metadata
- Download URL: llm_uv_tool-0.1.3.tar.gz
- Upload date:
- Size: 39.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f7d432a61b6d3525fc58ee4e3e398654f6c146b3c7517b3b00bf4268cbfc449
|
|
| MD5 |
a1f75a2da575dfecb83f3c8691402509
|
|
| BLAKE2b-256 |
8135f909e727aa0ddea35b0da4ecb3d32f2639117acdbd1a8cc585a129879799
|
File details
Details for the file llm_uv_tool-0.1.3-py3-none-any.whl.
File metadata
- Download URL: llm_uv_tool-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a4fbe7abead8cc4b4f4736bf734c0cdd7df173d8079c3dadf66aecc61547db0
|
|
| MD5 |
fc0ef2868ba5a7deee318d9f45dea1be
|
|
| BLAKE2b-256 |
66b78783dd8eb75f72532cbf0fe44edc3e3edf46a0556a60dab524a17a5e7093
|