diff --git a/.github/workflows/lint-langchain-fallback.yaml b/.github/workflows/lint-langchain-fallback.yaml new file mode 100644 index 0000000000..0373a6565a --- /dev/null +++ b/.github/workflows/lint-langchain-fallback.yaml @@ -0,0 +1,28 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: langchain +on: + pull_request: + paths: # These paths are the inverse of lint.yml + - "sdks/langchain/**/*.md" + +jobs: + lint: + runs-on: ubuntu-latest + permissions: + contents: none + + steps: + - run: echo "No tests required." \ No newline at end of file diff --git a/.github/workflows/lint-langchain.yaml b/.github/workflows/lint-langchain.yaml new file mode 100644 index 0000000000..422768be26 --- /dev/null +++ b/.github/workflows/lint-langchain.yaml @@ -0,0 +1,54 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: langchain +on: + pull_request: + paths: + - 'sdks/langchain/**' + - '!sdks/langchain/**/*.md' + +# Declare default permissions as read only. +permissions: read-all + +jobs: + lint: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: + - name: Checkout Repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + + - name: Setup Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: "3.13" + + - name: Install library requirements + run: pip install -r sdks/langchain/requirements.txt + + - name: Install test requirements + run: pip install sdks/langchain[test] + + - name: Run linters + run: | + black --check . + isort --check . + + - name: Run type-check + env: + MYPYPATH: 'sdks/langchain/src' + run: mypy --install-types --non-interactive --explicit-package-bases sdks/langchain \ No newline at end of file diff --git a/sdks/langchain/integration.cloudbuild.yaml b/sdks/langchain/integration.cloudbuild.yaml new file mode 100644 index 0000000000..f03577fc8c --- /dev/null +++ b/sdks/langchain/integration.cloudbuild.yaml @@ -0,0 +1,43 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +steps: + - id: Install library requirements + name: 'python:${_VERSION}' + args: + - install + - '-r' + - 'sdks/langchain/requirements.txt' + - '--user' + entrypoint: pip + - id: Install test requirements + name: 'python:${_VERSION}' + args: + - install + - 'sdks/langchain[test]' + - '--user' + entrypoint: pip + - id: Run integration tests + name: 'python:${_VERSION}' + env: + - TOOLBOX_URL=$_TOOLBOX_URL + args: + - '-c' + - >- + python -m pytest sdks/langchain/tests/ + entrypoint: /bin/bash +options: + logging: CLOUD_LOGGING_ONLY +substitutions: + _VERSION: '3.13' \ No newline at end of file diff --git a/sdks/langchain/requirements.txt b/sdks/langchain/requirements.txt index a76d0d4d56..52e8c6accc 100644 --- a/sdks/langchain/requirements.txt +++ b/sdks/langchain/requirements.txt @@ -1,4 +1,4 @@ langchain-core==0.3.21 PyYAML==6.0.2 pydantic==2.10.2 -aiohttp==3.11.7 \ No newline at end of file +aiohttp==3.11.7