Skip to content

Allow users to use already installed python versions with UV #342

@dometto

Description

@dometto

This PR to uv introduces the possibility to use the UV_PYTHON_EXTRA_INSTALL_DIRS environment variable to allow uv to discover Python interpreters in a number of directories:

astral-sh/uv#16222

If this is merged and release in uv, we could use this to allow users to use any python interpreters that were installed in the global /usr/local/uu/env/uv directory, which is used (e.g) by the Custom Packages component. This means that any python versions installed during workspace creation will already be available when the user types uv, without needing to install it into their local uv directory.

We could use a snippet like this in the Custom Packages component:

- name: Add uv python install dir to each user's path
  ansible.builtin.copy:
    dest: /etc/profile.d/uu-uv.sh
    mode: "0644"
    content: |
      export UV_PYTHON_EXTRA_INSTALL_DIRS="{{ _custom_packages_env_dir }}/uv"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions