Skip to content

Commit cac8e8e

Browse files
authored
Merge pull request #211 from langchain-ai/jn/ci_python_version_upate
ci: Upgrade CI Python version for LangChain NVIDIA AI Endpoints
2 parents f2a3df6 + 797c3d4 commit cac8e8e

File tree

8 files changed

+78
-85
lines changed

8 files changed

+78
-85
lines changed

.github/scripts/check_diff.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
"libs/trt",
99
]
1010

11+
PYTHON_VERSIONS = {
12+
"libs/ai-endpoints": ["3.10", "3.11", "3.12", "3.13"],
13+
"libs/trt": ["3.8", "3.9", "3.10", "3.11"],
14+
}
15+
16+
LINT_PYTHON_VERSIONS = {
17+
"libs/ai-endpoints": ["3.10", "3.13"],
18+
"libs/trt": ["3.8", "3.11"],
19+
}
20+
1121
if __name__ == "__main__":
1222
files = sys.argv[1:]
1323

@@ -48,11 +58,29 @@
4858
# elif any(file.startswith(p) for p in ["docs/", "templates/", "cookbook/"]):
4959
# dirs_to_run["lint"].add(".")
5060

61+
test_matrix = [
62+
{
63+
"working-directory": dir_,
64+
"python-versions": json.dumps(PYTHON_VERSIONS.get(dir_, ["3.8", "3.9", "3.10", "3.11"]))
65+
}
66+
for dir_ in dirs_to_run["test"]
67+
]
68+
69+
lint_matrix = [
70+
{
71+
"working-directory": dir_,
72+
"python-versions": json.dumps(LINT_PYTHON_VERSIONS.get(dir_, ["3.8", "3.11"]))
73+
}
74+
for dir_ in (dirs_to_run["lint"] | dirs_to_run["test"])
75+
]
76+
5177
outputs = {
5278
"dirs-to-lint": list(
5379
dirs_to_run["lint"] | dirs_to_run["test"]
5480
),
5581
"dirs-to-test": list(dirs_to_run["test"]),
82+
"test-matrix": test_matrix,
83+
"lint-matrix": lint_matrix,
5684
}
5785
for key, value in outputs.items():
5886
json_output = json.dumps(value)

.github/workflows/_compile_integration_test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
required: true
88
type: string
99
description: "From which folder this pipeline executes"
10+
python-versions:
11+
required: false
12+
type: string
13+
default: '["3.8", "3.9", "3.10", "3.11"]'
14+
description: "JSON array of Python versions to test"
1015

1116
env:
1217
POETRY_VERSION: "1.7.1"
@@ -19,11 +24,7 @@ jobs:
1924
runs-on: ubuntu-latest
2025
strategy:
2126
matrix:
22-
python-version:
23-
- "3.8"
24-
- "3.9"
25-
- "3.10"
26-
- "3.11"
27+
python-version: ${{ fromJson(inputs.python-versions) }}
2728
name: "poetry run pytest -m compile tests/integration_tests #${{ matrix.python-version }}"
2829
steps:
2930
- uses: actions/checkout@v4

.github/workflows/_lint.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
required: false
1212
type: string
1313
description: "Relative path to the langchain library folder"
14+
python-versions:
15+
required: false
16+
type: string
17+
default: '["3.8", "3.11"]'
18+
description: "JSON array of Python versions to lint (should be min and max supported versions)"
1419

1520
env:
1621
POETRY_VERSION: "1.7.1"
@@ -32,9 +37,7 @@ jobs:
3237
# GitHub rate-limits how many jobs can be running at any one time.
3338
# Starting new jobs is also relatively slow,
3439
# so linting on fewer versions makes CI faster.
35-
python-version:
36-
- "3.8"
37-
- "3.11"
40+
python-version: ${{ fromJson(inputs.python-versions) }}
3841
steps:
3942
- uses: actions/checkout@v4
4043

.github/workflows/_scheduled_test.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version:
20-
- "3.8"
21-
- "3.11"
22-
working-directory:
23-
- "libs/ai-endpoints"
24-
- "libs/trt"
19+
include:
20+
- python-version: "3.8"
21+
working-directory: "libs/trt"
22+
- python-version: "3.11"
23+
working-directory: "libs/trt"
24+
- python-version: "3.11"
25+
working-directory: "libs/ai-endpoints"
26+
- python-version: "3.13"
27+
working-directory: "libs/ai-endpoints"
2528

2629
steps:
2730
- uses: actions/checkout@v4

.github/workflows/_test.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
required: false
1212
type: string
1313
description: "Relative path to the langchain library folder"
14+
python-versions:
15+
required: false
16+
type: string
17+
default: '["3.8", "3.9", "3.10", "3.11"]'
18+
description: "JSON array of Python versions to test"
1419

1520
env:
1621
POETRY_VERSION: "1.7.1"
@@ -23,11 +28,7 @@ jobs:
2328
runs-on: ubuntu-latest
2429
strategy:
2530
matrix:
26-
python-version:
27-
- "3.8"
28-
- "3.9"
29-
- "3.10"
30-
- "3.11"
31+
python-version: ${{ fromJson(inputs.python-versions) }}
3132
name: "make test #${{ matrix.python-version }}"
3233
steps:
3334
- uses: actions/checkout@v4

.github/workflows/check_diffs.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,45 @@ jobs:
3535
outputs:
3636
dirs-to-lint: ${{ steps.set-matrix.outputs.dirs-to-lint }}
3737
dirs-to-test: ${{ steps.set-matrix.outputs.dirs-to-test }}
38+
test-matrix: ${{ steps.set-matrix.outputs.test-matrix }}
39+
lint-matrix: ${{ steps.set-matrix.outputs.lint-matrix }}
3840
lint:
39-
name: cd ${{ matrix.working-directory }}
41+
name: cd ${{ matrix.config.working-directory }}
4042
needs: [ build ]
41-
if: ${{ needs.build.outputs.dirs-to-lint != '[]' }}
43+
if: ${{ needs.build.outputs.lint-matrix != '[]' }}
4244
strategy:
4345
matrix:
44-
working-directory: ${{ fromJson(needs.build.outputs.dirs-to-lint) }}
46+
config: ${{ fromJson(needs.build.outputs.lint-matrix) }}
4547
uses: ./.github/workflows/_lint.yml
4648
with:
47-
working-directory: ${{ matrix.working-directory }}
49+
working-directory: ${{ matrix.config.working-directory }}
50+
python-versions: ${{ matrix.config.python-versions }}
4851
secrets: inherit
4952

5053
test:
51-
name: cd ${{ matrix.working-directory }}
54+
name: cd ${{ matrix.config.working-directory }}
5255
needs: [ build ]
53-
if: ${{ needs.build.outputs.dirs-to-test != '[]' }}
56+
if: ${{ needs.build.outputs.test-matrix != '[]' }}
5457
strategy:
5558
matrix:
56-
working-directory: ${{ fromJson(needs.build.outputs.dirs-to-test) }}
59+
config: ${{ fromJson(needs.build.outputs.test-matrix) }}
5760
uses: ./.github/workflows/_test.yml
5861
with:
59-
working-directory: ${{ matrix.working-directory }}
62+
working-directory: ${{ matrix.config.working-directory }}
63+
python-versions: ${{ matrix.config.python-versions }}
6064
secrets: inherit
6165

6266
compile-integration-tests:
63-
name: cd ${{ matrix.working-directory }}
67+
name: cd ${{ matrix.config.working-directory }}
6468
needs: [ build ]
65-
if: ${{ needs.build.outputs.dirs-to-test != '[]' }}
69+
if: ${{ needs.build.outputs.test-matrix != '[]' }}
6670
strategy:
6771
matrix:
68-
working-directory: ${{ fromJson(needs.build.outputs.dirs-to-test) }}
72+
config: ${{ fromJson(needs.build.outputs.test-matrix) }}
6973
uses: ./.github/workflows/_compile_integration_test.yml
7074
with:
71-
working-directory: ${{ matrix.working-directory }}
75+
working-directory: ${{ matrix.config.working-directory }}
76+
python-versions: ${{ matrix.config.python-versions }}
7277
secrets: inherit
7378
ci_success:
7479
name: "CI Success"

libs/ai-endpoints/poetry.lock

Lines changed: 5 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/ai-endpoints/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ packages = [
1515
"Source Code" = "https://github.com/langchain-ai/langchain-nvidia/tree/main/libs/ai-endpoints"
1616

1717
[tool.poetry.dependencies]
18-
python = ">=3.9,<4.0"
18+
python = ">=3.10,<4.0"
1919
langchain-core = ">=0.3.51"
2020
aiohttp = "^3.9.1"
2121
filetype = "^1.2.0"

0 commit comments

Comments
 (0)