Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Contributing to LangChain

Hi there! Thank you for even being interested in contributing to LangChain.
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes.

To learn how to contribute to LangChain, please follow the [contribution guide here](https://docs.langchain.com/oss/python/contributing).
16 changes: 16 additions & 0 deletions .github/actions/uv_setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: uv-install
description: Set up Python and uv

inputs:
python-version:
description: Python version, supporting MAJOR.MINOR only
required: true

runs:
using: composite
steps:
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
version: "0.5.25"
python-version: ${{ inputs.python-version }}
39 changes: 0 additions & 39 deletions .github/workflows/_codespell.yml

This file was deleted.

16 changes: 5 additions & 11 deletions .github/workflows/_compile_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
type: string
description: "From which folder this pipeline executes"

env:
POETRY_VERSION: "1.7.1"

jobs:
build:
Expand All @@ -23,29 +21,25 @@ jobs:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: "poetry run pytest -m compile tests/integration_tests #${{ matrix.python-version }}"
name: "uv run pytest -m compile tests/integration_tests #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python ${{ matrix.python-version }} + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: compile-integration

- name: Install integration dependencies
shell: bash
run: poetry install --with=test_integration,test
run: uv sync --group test_integration --group test

- name: Check integration tests compile
shell: bash
run: poetry run pytest -m compile tests/integration_tests
run: uv run pytest -m compile tests/integration_tests

- name: Ensure the tests did not create any additional files
shell: bash
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ on:

env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.7.1"

jobs:
build:
Expand All @@ -46,20 +45,17 @@ jobs:
repository: "${{ inputs.fork }}/langchain-aws"
ref: "${{ inputs.branch }}"

- name: Set up Python ${{ env.PYTHON_VERSION }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python ${{ env.PYTHON_VERSION }} + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: core

- name: Install dependencies
shell: bash
run: poetry install --with test,test_integration
run: uv sync --group test --group test_integration

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v5
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -68,7 +64,7 @@ jobs:
- name: Run integration tests
shell: bash
run: |
poetry run pytest -vv -s ${{ inputs.test-file }}
uv run pytest -vv -s ${{ inputs.test-file }}

- name: Ensure the tests did not create any additional files
shell: bash
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
description: "From which folder this pipeline executes"

env:
POETRY_VERSION: "1.7.1"
WORKDIR: ${{ inputs.working-directory == '' && '.' || inputs.working-directory }}

# This env var allows us to get inline annotations when ruff has complaints.
Expand All @@ -32,30 +31,26 @@ jobs:
# Starting new jobs is also relatively slow,
# so linting on fewer versions makes CI faster.
python-version:
- "3.9"
- "3.12"
steps:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python ${{ matrix.python-version }} + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: lint-with-extras

- name: Check Poetry File
- name: Check pyproject.toml
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
poetry check
uv tree

- name: Check lock file
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
poetry lock --check
uv lock --check

- name: Install dependencies
# Also installs dev/lint/test/typing dependencies, to ensure we have
Expand All @@ -68,7 +63,7 @@ jobs:
# It doesn't matter how you change it, any change will cause a cache-bust.
working-directory: ${{ inputs.working-directory }}
run: |
poetry install --with lint,typing
uv sync --group lint --group typing

- name: Get .mypy_cache to speed up mypy
uses: actions/cache@v4
Expand All @@ -88,7 +83,7 @@ jobs:
- name: Install unit+integration test dependencies
working-directory: ${{ inputs.working-directory }}
run: |
poetry install --with test,test_integration
uv sync --group test --group test_integration

- name: Get .mypy_cache_test to speed up mypy
uses: actions/cache@v4
Expand Down
46 changes: 18 additions & 28 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ on:

env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.7.1"

permissions:
contents: read
Expand All @@ -43,13 +42,10 @@ jobs:
steps:
- uses: actions/checkout@v5

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: release

# We want to keep this build stage *separate* from the release stage,
# so that there's no sharing of permissions between them.
Expand All @@ -63,7 +59,7 @@ jobs:
# > from the publish job.
# https://github.com/pypa/gh-action-pypi-publish#non-goals
- name: Build project for distribution
run: poetry build
run: uv build
working-directory: ${{ inputs.working-directory }}

- name: Upload build
Expand All @@ -77,8 +73,8 @@ jobs:
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
echo pkg-name="$(poetry version | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo version="$(poetry version --short)" >> $GITHUB_OUTPUT
echo pkg-name="$(python -c \"import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])\")" >> $GITHUB_OUTPUT
echo version="$(python -c \"import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])\")" >> $GITHUB_OUTPUT

test-pypi-publish:
needs:
Expand Down Expand Up @@ -138,12 +134,12 @@ jobs:
# - attempt install again after 5 seconds if it fails because there is
# sometimes a delay in availability on test pypi
run: |
poetry run pip install \
uv pip install \
--extra-index-url https://test.pypi.org/simple/ \
"$PKG_NAME==$VERSION" || \
( \
sleep 5 && \
poetry run pip install \
uv pip install \
--extra-index-url https://test.pypi.org/simple/ \
"$PKG_NAME==$VERSION" \
)
Expand All @@ -152,10 +148,10 @@ jobs:
# since that's how Python imports packages with dashes in the name.
IMPORT_NAME="$(echo "$PKG_NAME" | sed s/-/_/g)"

poetry run python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))"
uv run python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))"

- name: Import test dependencies
run: poetry install --with test,test_integration
run: uv sync --group test --group test_integration
working-directory: ${{ inputs.working-directory }}

# Overwrite the local version of the package with the test PyPI version.
Expand All @@ -166,7 +162,7 @@ jobs:
PKG_NAME: ${{ needs.build.outputs.pkg-name }}
VERSION: ${{ needs.build.outputs.version }}
run: |
poetry run pip install \
uv pip install \
--extra-index-url https://test.pypi.org/simple/ \
"$PKG_NAME==$VERSION"

Expand All @@ -175,7 +171,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v5
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -189,8 +185,8 @@ jobs:
working-directory: ${{ inputs.working-directory }}
id: min-version
run: |
poetry run pip install packaging
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml release)"
uv pip install packaging
min_versions="$(uv run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml release)"
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
echo "min-versions=$min_versions"

Expand All @@ -199,7 +195,7 @@ jobs:
env:
MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
run: |
poetry run pip install $MIN_VERSIONS
uv pip install $MIN_VERSIONS

# unset AWS credentials to ensure they are not used in snapshots
unset AWS_ACCESS_KEY_ID
Expand Down Expand Up @@ -237,13 +233,10 @@ jobs:
steps:
- uses: actions/checkout@v5

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: release

- uses: actions/download-artifact@v5
with:
Expand Down Expand Up @@ -278,13 +271,10 @@ jobs:
steps:
- uses: actions/checkout@v5

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: release

- uses: actions/download-artifact@v5
with:
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
type: string
description: "From which folder this pipeline executes"

env:
POETRY_VERSION: "1.7.1"

jobs:
build:
Expand All @@ -23,25 +21,21 @@ jobs:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: "make test #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
- name: Set up Python ${{ matrix.python-version }} + uv
uses: "./.github/actions/uv_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: core

- name: Install dependencies
shell: bash
run: poetry install --with test --with test_integration
run: uv sync --group test --group test_integration

- name: Run core tests
shell: bash
Expand Down
Loading