Skip to content

uv-managed interpreters are not discovered on macOS: wrong store directory #109

Closed

Description

@henryiii

This was discovered looking into wntrblm/nox#1139. Report from that investigation below.

🤖 AI text below 🤖

Problem

_propose_from_uv falls back to platformdirs.user_data_path("uv") / "python" when neither UV_PYTHON_INSTALL_DIR nor XDG_DATA_HOME is set. On macOS that is ~/Library/Application Support/uv/python, but uv intentionally follows the XDG convention on macOS and stores interpreters in ~/.local/share/uv/python:

$ uv python dir
/Users/me/.local/share/uv/python

So on macOS the uv store is silently invisible to discovery. The interpreters are only found via the ~/.local/bin shims on PATH (which users can disable, and which downstreams such as nox are moving to suppress: wntrblm/nox#1139).

Reproduction (macOS, python-discovery 1.5.0)

With cpython-3.8.20-macos-aarch64-none present in ~/.local/share/uv/python and ~/.local/bin removed from PATH:

import os
os.environ['PATH'] = ':'.join(p for p in os.environ['PATH'].split(':') if '.local/bin' not in p)
from python_discovery import get_interpreter
print(get_interpreter('3.8'))  # None

os.environ['UV_PYTHON_INSTALL_DIR'] = os.path.expanduser('~/.local/share/uv/python')
print(get_interpreter('3.8'))  # found in the uv store

Suggested fix

Replicate uv's directory logic (XDG-style ~/.local/share/uv/python on every non-Windows platform, including macOS) instead of platformdirs. Windows may need a check too — uv uses %APPDATA%\uv\python (Roaming), while platformdirs.user_data_path("uv") points at Local; I have only verified the macOS behavior.

Environment: macOS 15 (arm64), python-discovery 1.5.0, uv 0.9.x.

Activity

  1. added 4 commits that reference this issue on Jul 31, 2026
    6ee9f27
    df94c3b
    0c88a7d
    4f6ed4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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