Skip to main content

A plugin for LLM that enables proper plugin management when installed via uv tool.

Project description

llm-uv-tool

PyPI PyPI - Python Version

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 install
  • llm uninstall

Once installed, llm-uv-tool's commands replace the built-in versions while maintaining the same interface and arguments. Behind the scenes, they:

  1. Track installed plugins in a JSON file.
  2. Map appropriate arguments between LLM's commands and uv's tool system.
  3. 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 tool CLI 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:

  1. Install llm-uv-tool in your current LLM environment:

    llm install llm-uv-tool
    
  2. Copy all installed plugins to uv-tool-packages.json in 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"
    
  3. 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:

  1. Tracking installed plugins persistently.
  2. Intercepting llm install and llm uninstall commands to correctly manage plugins within the uv tool context.
  3. 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

llm_uv_tool-0.1.3.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_uv_tool-0.1.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for llm_uv_tool-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3f7d432a61b6d3525fc58ee4e3e398654f6c146b3c7517b3b00bf4268cbfc449
MD5 a1f75a2da575dfecb83f3c8691402509
BLAKE2b-256 8135f909e727aa0ddea35b0da4ecb3d32f2639117acdbd1a8cc585a129879799

See more details on using hashes here.

File details

Details for the file llm_uv_tool-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_uv_tool-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6a4fbe7abead8cc4b4f4736bf734c0cdd7df173d8079c3dadf66aecc61547db0
MD5 fc0ef2868ba5a7deee318d9f45dea1be
BLAKE2b-256 66b78783dd8eb75f72532cbf0fe44edc3e3edf46a0556a60dab524a17a5e7093

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page