Improve python version handling in Evergreen

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Infrastructure
    • None
    • Python Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      PyMongo's Evergreen tasks uses a confusing mix of approaches to finding the right Python, and also lacks the ability to install a pre-release Python (such as 3.15rc1) that is not already in the toolchain. This ticket blocks 
PYTHON-6077.

      A later improvement tracked in DRIVERS-3564 will let us use ensure_uv.sh from drivers-evergreen-tools to find or install uv with an explicit version specifier. This ticket is not blocked by that work.

      Definition of done

      • Tasks request a Python through UV_PYTHON: a version (3.10), a variant (3.14t, pypy3.11), or an explicit interpreter path (for example the FIPS host's /usr/bin/python3.11). TOOLCHAIN_VERSION is removed from the task generator and the generated configs.
      • On the host, a matching Python in the Python toolchain is used directly. When there is no matching one, uv supplies a Python. If uv still cannot provide the requested Python (for example it never shipped a build for that version), the task fails with a clear error.
      • The default UV_PYTHON remains 3.10, but will be found in the Python toolchain if available.
      • Behavior is validated on Linux, macOS arm64, Win64, Win32, the FIPS host, and a toolchain-less host (Amazon Linux).
      • Evergreen task and variant names are unchanged, and regenerating the configs is deterministic.
      • An evergreen patch build demonstrating that Python 3.15 is installed using the latest uv.

      Pitfalls

      • An empty search-path environment variable disables uv's PATH-based discovery entirely, so it must only be exported when it has a value.
      • An explicit interpreter path must be used as-is and never routed through uv's install step.
      • Generated task and variant names must stay byte-identical after the generator change.

            Assignee:
            Steve Silvester
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: