Skip to content

Commit

Permalink
ci: add testing with Python 3.12 (langchain-ai#22813)
Browse files Browse the repository at this point in the history
We need to use a different version of numpy for py3.8 and py3.12 in
pyproject.
And so do projects that use that Python version range and import
langchain.

    - **Twitter handle:** _cbornet
  • Loading branch information
cbornet authored Jun 12, 2024
1 parent b6bf2bb commit d04e899
Show file tree
Hide file tree
Showing 20 changed files with 359 additions and 118 deletions.
1 change: 1 addition & 0 deletions .github/workflows/_compile_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: "poetry run pytest -m compile tests/integration_tests #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: dependency checks ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# so linting on fewer versions makes CI faster.
python-version:
- "3.8"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: "make test #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_test_doc_imports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
python-version:
- "3.11"
- "3.12"
name: "check doc imports #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ubuntu-latest
defaults:
run:
Expand Down
59 changes: 53 additions & 6 deletions libs/community/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion libs/community/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ langchain = "^0.2.0"
SQLAlchemy = ">=1.4,<3"
requests = "^2"
PyYAML = ">=5.3"
numpy = "^1"
aiohttp = "^3.8.3"
tenacity = "^8.1.0"
dataclasses-json = ">= 0.5.7, < 0.7"
langsmith = "^0.1.0"

# Support Python 3.8 and 3.12+.
numpy = [
{version = "^1", python = "<3.12"},
{version = "^1.26.0", python = ">=3.12"}
]

[tool.poetry.group.test]
optional = true

Expand Down
2 changes: 1 addition & 1 deletion libs/community/tests/unit_tests/agents/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def the_tool(foo: str, bar: str) -> str:
with pytest.raises(
ValueError,
match=f"{agent_cls.__name__} does not support" # type: ignore
f" multi-input tool {the_tool.name}.",
f" multi-input tool the_tool.",
):
agent_cls.from_llm_and_tools(MagicMock(), [the_tool]) # type: ignore

Expand Down
1 change: 1 addition & 0 deletions libs/community/tests/unit_tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_required_dependencies(poetry_conf: Mapping[str, Any]) -> None:

is_required = {
package_name: isinstance(requirements, str)
or isinstance(requirements, list)
or not requirements.get("optional", False)
for package_name, requirements in dependencies.items()
}
Expand Down
Loading

0 comments on commit d04e899

Please sign in to comment.