Skip to content

tests: Move langchain under toxgen, add variants #4349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update readme
  • Loading branch information
sentrivana committed May 6, 2025
commit 00f42a7679c6fd77eeaae81d3a580f1b3a57ca3a
8 changes: 0 additions & 8 deletions .github/workflows/test-integrations-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-latest"
- name: Test langchain-notiktoken latest
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-notiktoken-latest"
- name: Test openai latest
run: |
set -x # print commands that are executed
Expand Down Expand Up @@ -141,10 +137,6 @@ jobs:
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-langchain"
- name: Test langchain-notiktoken pinned
run: |
set -x # print commands that are executed
./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-langchain-notiktoken"
- name: Test openai pinned
run: |
set -x # print commands that are executed
Expand Down
23 changes: 23 additions & 0 deletions scripts/populate_tox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ integration_name: {
},
"python": python_version_specifier,
"include": package_version_specifier,
"variants": another_integration_name,
}
```

Expand Down Expand Up @@ -153,6 +154,28 @@ be expressed like so:
}
```

### `variants`

Sometimes we want to test a single integration against two different sets of
dependencies. For example, `langchain` should be tested both with and without
`tiktoken`. In that case, add the variant as its own entry in `TEST_SUITE_CONFIG`
and link it from the base variant by referencing its name in `variants` of the
original variant:

```python
{
"langchain": {
"variants": ["langchain-notiktoken"],
...
},
"langchain-notiktoken": {
...
}
}
```

This will result in both `langchain` and `langchain-notiktoken` being run under
the Langchain CI workflow.

## How-Tos

Expand Down
1 change: 1 addition & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"<0.2": ["httpx<0.28.0", "openai~=1.0.0"],
">0.2": ["langchain-community"],
},
"variants": ["langchain-notiktoken"],
},
"langchain-notiktoken": {
"package": "langchain",
Expand Down
11 changes: 11 additions & 0 deletions scripts/populate_tox/populate_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,17 @@ def main(fail_on_changes: bool = False) -> None:
}
)

variants = TEST_SUITE_CONFIG[integration].get("variants") or []
for variant in variants:
packages[group].append(
{
"name": variant,
"package": package,
"extra": extra,
"releases": test_releases,
}
)

if fail_on_changes:
old_file_hash = get_file_hash()

Expand Down
1 change: 0 additions & 1 deletion scripts/split_tox_gh_actions/split_tox_gh_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"anthropic",
"cohere",
"langchain",
"langchain-notiktoken",
"openai",
"huggingface_hub",
],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# The file (and all resulting CI YAMLs) then need to be regenerated via
# "scripts/generate-test-files.sh".
#
# Last generated: 2025-05-06T10:28:08.299635+00:00
# Last generated: 2025-05-06T10:37:25.618827+00:00

[tox]
requires =
Expand Down
Loading