diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fd87675..c7961fd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ on: - "uv.lock" - ".python-version" +permissions: + contents: read + jobs: type_check: name: Type Check and Lint @@ -41,6 +44,31 @@ jobs: - name: Pyright run: uv run pyright . + import_without_extras: + name: Import Without Extras + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + version: "0.9.27" + enable-cache: true + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version-file: ".python-version" + + - name: Install without extras + run: uv sync --no-dev --package uipath-langchain-client + + - name: Import packages + run: | + uv run --no-sync python -c "import uipath.llm_client" + uv run --no-sync python -c "import uipath_langchain_client" + test: name: Test runs-on: ubuntu-latest diff --git a/packages/uipath_langchain_client/CHANGELOG.md b/packages/uipath_langchain_client/CHANGELOG.md index e55a3e8a..276b7681 100644 --- a/packages/uipath_langchain_client/CHANGELOG.md +++ b/packages/uipath_langchain_client/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to `uipath_langchain_client` will be documented in this file. +## [1.16.1] - 2026-07-03 + +### Fixed +- `import uipath_langchain_client` no longer requires the `bedrock` extra (regression in 1.15.1). + ## [1.16.0] - 2026-07-03 ### Changed diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py index f8d61b09..67ef7a71 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py @@ -1,3 +1,3 @@ __title__ = "UiPath LangChain Client" __description__ = "A Python client for interacting with UiPath's LLM services via LangChain." -__version__ = "1.16.0" +__version__ = "1.16.1" diff --git a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py index a7e36be8..aac3fb99 100644 --- a/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py +++ b/packages/uipath_langchain_client/src/uipath_langchain_client/factory.py @@ -26,9 +26,6 @@ UiPathBaseChatModel, UiPathBaseEmbeddings, ) -from uipath_langchain_client.clients.bedrock.model_resolution import ( - apply_backing_model_detection_hints, -) from uipath_langchain_client.settings import ( API_FLAVOR_TO_VENDOR_TYPE, BYOM_TO_ROUTING_FLAVOR, @@ -221,6 +218,10 @@ def get_chat_model( **model_kwargs, ) + from uipath_langchain_client.clients.bedrock.model_resolution import ( + apply_backing_model_detection_hints, + ) + apply_backing_model_detection_hints(model_kwargs, model_info) if api_flavor == ApiFlavor.INVOKE: diff --git a/tests/langchain/features/test_optional_extras.py b/tests/langchain/features/test_optional_extras.py new file mode 100644 index 00000000..580597cc --- /dev/null +++ b/tests/langchain/features/test_optional_extras.py @@ -0,0 +1,56 @@ +"""The package must import without optional provider extras installed.""" + +import subprocess +import sys + +_OPTIONAL_MODULES = [ + "anthropic", + "google.genai", + "langchain_anthropic", + "langchain_aws", + "langchain_azure_ai", + "langchain_fireworks", + "langchain_google_genai", + "langchain_google_vertexai", + "langchain_litellm", + "langchain_openai", + "litellm", + "openai", +] + +_IMPORT_WITH_BLOCKED_EXTRAS = """ +import sys + +blocked = set(sys.argv[1:]) + + +class _BlockOptionalDeps: + def find_spec(self, name, path=None, target=None): + if any(name == module or name.startswith(module + ".") for module in blocked): + raise ImportError(f"blocked optional dependency: {name}") + return None + + +sys.meta_path.insert(0, _BlockOptionalDeps()) + +import uipath_langchain_client + +providers = [ + name + for name in sys.modules + if name.startswith("uipath_langchain_client.clients.") + and not name.startswith("uipath_langchain_client.clients.normalized") +] +assert not providers, providers +print("OK") +""" + + +def test_package_imports_without_optional_extras(): + result = subprocess.run( + [sys.executable, "-c", _IMPORT_WITH_BLOCKED_EXTRAS, *_OPTIONAL_MODULES], + capture_output=True, + text=True, + ) + assert result.returncode == 0, result.stderr + assert result.stdout.strip() == "OK"