diff --git a/.github/workflows/test-sdk-python.yml b/.github/workflows/test-sdk-python.yml index 1c3746e7..a59af41d 100644 --- a/.github/workflows/test-sdk-python.yml +++ b/.github/workflows/test-sdk-python.yml @@ -68,13 +68,11 @@ jobs: with: python-version: "3.13" - # 1.x still lists the vendor SDKs as dependencies, so they are removed again here; - # from 2.0 the plain install brings none and the uninstall step can go. - - name: Install the package without vendor SDKs + # The plain install, as a caller who brings their own provider has it. + - name: Install the package without extras run: | python -m pip install --upgrade pip pip install . pytest pytest-asyncio - pip uninstall -y openai anthropic google-genai - name: Every evaluator without them run: python -m pytest tests/unit/test_without_vendor_sdks.py -p no:cacheprovider diff --git a/sdks/python/README.md b/sdks/python/README.md index b213685a..a3569d0e 100644 --- a/sdks/python/README.md +++ b/sdks/python/README.md @@ -31,7 +31,7 @@ Python SDK for [Learning Commons evaluators](https://docs.learningcommons.org/ev ## Dependencies - Python 3.11+ -- `pydantic`, `httpx`, `pillow`, and `textstat`, plus the provider clients (`openai`, `anthropic`, `google-genai`), each also available as an extra (see [Installation](#installation)). +- `pydantic`, `httpx`, `pillow`, and `textstat`. The provider clients (`openai`, `anthropic`, `google-genai`) are extras: install the ones your evaluators use (see [Installation](#installation)). - Credentials are constructor arguments. The SDK reads no provider keys from the environment, so a shell `GOOGLE_API_KEY` leaves `google_api_key` unset. A missing key raises `ConfigurationError` at construction, before any I/O. ## Installation @@ -52,7 +52,7 @@ pip install "learning-commons-evaluators[all]" # every provider A `model_override` needs the extra for its provider instead. An evaluator whose provider's SDK is not installed raises `ConfigurationError` at construction, naming the extra to add. -Version 1.x still installs all three provider clients without an extra, so these lines change nothing today. Version 2.0 will install them only through their extras, and the plain `pip install learning-commons-evaluators` will be for [bringing your own provider](#bring-your-own-provider), which needs none. +The plain `pip install learning-commons-evaluators` installs no provider client. It is for [bringing your own provider](#bring-your-own-provider), which needs none. Pass the key each evaluator's default provider requires ([which keys](https://docs.learningcommons.org/evaluators/getting-started/quickstart#required-api-keys)): diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 17cd756d..422ae1d3 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -34,16 +34,8 @@ classifiers = [ dependencies = [ "pydantic>=2.0.0,<3", "textstat>=0.7.0,<1", - # Native provider SDKs (D10): one adapter per SDK under providers/. httpx is what - # google-genai transports over and what the error taxonomy reads transport failures - # from. openai (since 2.47.0) and anthropic (since 1.0.0) transport over httpx 2, - # published as the separate httpx2 package, which they bring themselves; the lower - # bounds are the first versions to do so, so httpx2 is always present for the error - # classifier and the tests that build the SDKs' exceptions. - "openai>=2.47.0,<4", - "anthropic>=1.0.0,<2", - # 1.39.0 is the first to let a client be closed (Client.close, AsyncClient.aclose). - "google-genai>=1.39.0,<3", + # What the Knowledge Graph client and google-genai transport over, and what the error + # taxonomy reads transport failures from. The provider SDKs are extras, below. "httpx>=0.27.0,<1", # Image inputs (features/image_source.py): reads an attached file's format and # dimensions from its header, without decoding pixels, to enforce the contract's @@ -65,13 +57,18 @@ dependencies = [ ] [project.optional-dependencies] -# One extra per provider, named by its `Provider` value, so the error for a missing SDK -# names the extra mechanically. Each repeats its pin from `dependencies` above, where the -# SDKs still sit so that no 1.x install changes; 2.0 drops them from there (DSCR-2625), -# leaving the base install for callers who inject their own `llm_provider`. Bump a pin in -# both places until then. +# Native provider SDKs (D10), one extra per adapter under providers/, named by its +# `Provider` value so the error for a missing SDK names the extra mechanically. None is +# in the base install: a caller who injects their own `llm_provider` needs none of them, +# and most evaluators call one provider. The caps follow the rule above. +# +# openai (since 2.47.0) and anthropic (since 1.0.0) transport over httpx 2, published as +# the separate httpx2 package, which they bring themselves; the lower bounds are the first +# versions to do so, so httpx2 is present for the error classifier wherever their errors +# can be raised, and for the tests that build those errors. openai = ["openai>=2.47.0,<4"] anthropic = ["anthropic>=1.0.0,<2"] +# 1.39.0 is the first to let a client be closed (Client.close, AsyncClient.aclose). google = ["google-genai>=1.39.0,<3"] all = ["learning-commons-evaluators[openai,anthropic,google]"] dev = [