infra[patch]: Use langchain core in-tree as a dev dependency (#13957)

Using the published version means master is broken for contributors
whenever we make changes in one lib that depend on the other.
This commit is contained in:
Nuno Campos 2023-11-28 17:23:43 +00:00 committed by GitHub
parent 2703a1b061
commit e0bcc98436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 138 deletions

View File

@ -7,10 +7,6 @@ on:
required: true required: true
type: string type: string
description: "From which folder this pipeline executes" description: "From which folder this pipeline executes"
langchain-core-location:
required: false
type: string
description: "Relative path to the langchain core library folder"
env: env:
POETRY_VERSION: "1.6.1" POETRY_VERSION: "1.6.1"
@ -44,14 +40,6 @@ jobs:
shell: bash shell: bash
run: poetry install --with=test_integration run: poetry install --with=test_integration
- name: Install langchain core editable
working-directory: ${{ inputs.working-directory }}
if: ${{ inputs.langchain-core-location }}
env:
LANGCHAIN_CORE_LOCATION: ${{ inputs.langchain-core-location }}
run: |
poetry run pip install -e "$LANGCHAIN_CORE_LOCATION"
- name: Check integration tests compile - name: Check integration tests compile
shell: bash shell: bash
run: poetry run pytest -m compile tests/integration_tests run: poetry run pytest -m compile tests/integration_tests

View File

@ -11,10 +11,6 @@ on:
required: false required: false
type: string type: string
description: "Relative path to the langchain library folder" description: "Relative path to the langchain library folder"
langchain-core-location:
required: false
type: string
description: "Relative path to the langchain core library folder"
env: env:
POETRY_VERSION: "1.6.1" POETRY_VERSION: "1.6.1"
@ -82,14 +78,6 @@ jobs:
run: | run: |
poetry run pip install -e "$LANGCHAIN_LOCATION" poetry run pip install -e "$LANGCHAIN_LOCATION"
- name: Install langchain core editable
working-directory: ${{ inputs.working-directory }}
if: ${{ inputs.langchain-core-location }}
env:
LANGCHAIN_CORE_LOCATION: ${{ inputs.langchain-core-location }}
run: |
poetry run pip install -e "$LANGCHAIN_CORE_LOCATION"
- name: Get .mypy_cache to speed up mypy - name: Get .mypy_cache to speed up mypy
uses: actions/cache@v3 uses: actions/cache@v3
env: env:

View File

@ -11,10 +11,6 @@ on:
required: false required: false
type: string type: string
description: "Relative path to the langchain library folder" description: "Relative path to the langchain library folder"
langchain-core-location:
required: false
type: string
description: "Relative path to the langchain core library folder"
env: env:
POETRY_VERSION: "1.6.1" POETRY_VERSION: "1.6.1"
@ -56,14 +52,6 @@ jobs:
run: | run: |
poetry run pip install -e "$LANGCHAIN_LOCATION" poetry run pip install -e "$LANGCHAIN_LOCATION"
- name: Install langchain core editable
working-directory: ${{ inputs.working-directory }}
if: ${{ inputs.langchain-core-location }}
env:
LANGCHAIN_CORE_LOCATION: ${{ inputs.langchain-core-location }}
run: |
poetry run pip install -e "$LANGCHAIN_CORE_LOCATION"
- name: Install the opposite major version of pydantic - name: Install the opposite major version of pydantic
# If normal tests use pydantic v1, here we'll use v2, and vice versa. # If normal tests use pydantic v1, here we'll use v2, and vice versa.
shell: bash shell: bash

View File

@ -11,10 +11,6 @@ on:
required: false required: false
type: string type: string
description: "Relative path to the langchain library folder" description: "Relative path to the langchain library folder"
langchain-core-location:
required: false
type: string
description: "Relative path to the langchain core library folder"
env: env:
POETRY_VERSION: "1.6.1" POETRY_VERSION: "1.6.1"
@ -56,14 +52,6 @@ jobs:
run: | run: |
poetry run pip install -e "$LANGCHAIN_LOCATION" poetry run pip install -e "$LANGCHAIN_LOCATION"
- name: Install langchain core editable
working-directory: ${{ inputs.working-directory }}
if: ${{ inputs.langchain-core-location }}
env:
LANGCHAIN_CORE_LOCATION: ${{ inputs.langchain-core-location }}
run: |
poetry run pip install -e "$LANGCHAIN_CORE_LOCATION"
- name: Run core tests - name: Run core tests
shell: bash shell: bash
run: | run: |

View File

@ -3,19 +3,19 @@ name: libs/langchain CI
on: on:
push: push:
branches: [ master ] branches: [master]
pull_request: pull_request:
paths: paths:
- '.github/actions/poetry_setup/action.yml' - ".github/actions/poetry_setup/action.yml"
- '.github/tools/**' - ".github/tools/**"
- '.github/workflows/_lint.yml' - ".github/workflows/_lint.yml"
- '.github/workflows/_test.yml' - ".github/workflows/_test.yml"
- '.github/workflows/_pydantic_compatibility.yml' - ".github/workflows/_pydantic_compatibility.yml"
- '.github/workflows/langchain_ci.yml' - ".github/workflows/langchain_ci.yml"
- 'libs/*' - "libs/*"
- 'libs/langchain/**' - "libs/langchain/**"
- 'libs/core/**' - "libs/core/**"
workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI
# If another push to the same PR or branch happens while this workflow is still running, # If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run. # cancel the earlier run in favor of the next run.
@ -33,77 +33,29 @@ env:
jobs: jobs:
lint: lint:
uses: uses: ./.github/workflows/_lint.yml
./.github/workflows/_lint.yml
with: with:
working-directory: libs/langchain working-directory: libs/langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
test: test:
uses: uses: ./.github/workflows/_test.yml
./.github/workflows/_test.yml
with: with:
working-directory: libs/langchain working-directory: libs/langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
compile-integration-tests: compile-integration-tests:
uses: uses: ./.github/workflows/_compile_integration_test.yml
./.github/workflows/_compile_integration_test.yml
with: with:
working-directory: libs/langchain working-directory: libs/langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
pydantic-compatibility: pydantic-compatibility:
uses: uses: ./.github/workflows/_pydantic_compatibility.yml
./.github/workflows/_pydantic_compatibility.yml
with: with:
working-directory: libs/langchain working-directory: libs/langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
# It's possible that langchain works fine with the latest *published* langchain-core,
# but is broken with the langchain-core on `master`.
#
# We want to catch situations like that *before* releasing a new langchain-core, hence this test.
test-with-latest-langchain-core:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKDIR }}
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
name: test with unpublished langchain-core - Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ env.WORKDIR }}
cache-key: unpublished-langchain-core
- name: Install dependencies
shell: bash
run: |
echo "Running tests with unpublished langchain, installing dependencies with poetry..."
poetry install
echo "Editably installing langchain-core outside of poetry, to avoid messing up lockfile..."
poetry run pip install -e ../core
- name: Run tests
run: make test
extended-tests: extended-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:

View File

@ -3,19 +3,19 @@ name: libs/experimental CI
on: on:
push: push:
branches: [ master ] branches: [master]
pull_request: pull_request:
paths: paths:
- '.github/actions/poetry_setup/action.yml' - ".github/actions/poetry_setup/action.yml"
- '.github/tools/**' - ".github/tools/**"
- '.github/workflows/_lint.yml' - ".github/workflows/_lint.yml"
- '.github/workflows/_test.yml' - ".github/workflows/_test.yml"
- '.github/workflows/langchain_experimental_ci.yml' - ".github/workflows/langchain_experimental_ci.yml"
- 'libs/*' - "libs/*"
- 'libs/experimental/**' - "libs/experimental/**"
- 'libs/langchain/**' - "libs/langchain/**"
- 'libs/core/**' - "libs/core/**"
workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI
# If another push to the same PR or branch happens while this workflow is still running, # If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run. # cancel the earlier run in favor of the next run.
@ -33,26 +33,21 @@ env:
jobs: jobs:
lint: lint:
uses: uses: ./.github/workflows/_lint.yml
./.github/workflows/_lint.yml
with: with:
working-directory: libs/experimental working-directory: libs/experimental
langchain-location: ../langchain langchain-location: ../langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
test: test:
uses: uses: ./.github/workflows/_test.yml
./.github/workflows/_test.yml
with: with:
working-directory: libs/experimental working-directory: libs/experimental
langchain-location: ../langchain langchain-location: ../langchain
langchain-core-location: ../core
secrets: inherit secrets: inherit
compile-integration-tests: compile-integration-tests:
uses: uses: ./.github/workflows/_compile_integration_test.yml
./.github/workflows/_compile_integration_test.yml
with: with:
working-directory: libs/experimental working-directory: libs/experimental
secrets: inherit secrets: inherit

View File

@ -4178,16 +4178,18 @@ version = "0.0.6"
description = "Building applications with LLMs through composability" description = "Building applications with LLMs through composability"
optional = false optional = false
python-versions = ">=3.8.1,<4.0" python-versions = ">=3.8.1,<4.0"
files = [ files = []
{file = "langchain_core-0.0.6-py3-none-any.whl", hash = "sha256:dcc727ff811159e09fc1d72caae4aaea892611349d5c3fc1c18b3a19573faf27"}, develop = true
{file = "langchain_core-0.0.6.tar.gz", hash = "sha256:cffd1031764d838ad2a2f3f64477b710923ddad58eb9fe3130ff94b3669e8dd8"},
]
[package.dependencies] [package.dependencies]
jsonpatch = ">=1.33,<2.0" jsonpatch = "^1.33"
langsmith = ">=0.0.63,<0.1.0" langsmith = "~0.0.63"
pydantic = ">=1,<3" pydantic = ">=1,<3"
tenacity = ">=8.1.0,<9.0.0" tenacity = "^8.1.0"
[package.source]
type = "directory"
url = "../core"
[[package]] [[package]]
name = "langkit" name = "langkit"
@ -11194,4 +11196,4 @@ text-helpers = ["chardet"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.8.1,<4.0" python-versions = ">=3.8.1,<4.0"
content-hash = "d57493dcdb7c864d71aa43463a57491f0c9cbd8fa8674d21c0b11117e8d7ea67" content-hash = "d049735bc75655dbdda59770b6f5b2fe9fe3c1985c75e3ad662f0863158f1e7b"

View File

@ -165,6 +165,7 @@ pytest-mock = "^3.10.0"
pytest-socket = "^0.6.0" pytest-socket = "^0.6.0"
syrupy = "^4.0.2" syrupy = "^4.0.2"
requests-mock = "^1.11.0" requests-mock = "^1.11.0"
langchain-core = {path = "../core", develop = true}
[tool.poetry.group.codespell.dependencies] [tool.poetry.group.codespell.dependencies]

View File

@ -74,6 +74,7 @@ def test_test_group_dependencies(poetry_conf: Mapping[str, Any]) -> None:
[ [
"duckdb-engine", "duckdb-engine",
"freezegun", "freezegun",
"langchain-core",
"lark", "lark",
"pandas", "pandas",
"pytest", "pytest",