diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f60c4ca..290dccf 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,11 +9,15 @@ on: jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v5 - uses: astral-sh/setup-uv@v5 with: enable-cache: true + python-version: ${{ matrix.python-version }} - run: uvx hatch test -acp if: ${{ always() }} lint: diff --git a/ollama/_utils.py b/ollama/_utils.py index 15f1cc0..b32525b 100644 --- a/ollama/_utils.py +++ b/ollama/_utils.py @@ -3,14 +3,14 @@ import inspect import re from collections import defaultdict -from typing import Callable, Union +from typing import Callable, Dict, Union import pydantic from ollama._types import Tool -def _parse_docstring(doc_string: Union[str, None]) -> dict[str, str]: +def _parse_docstring(doc_string: Union[str, None]) -> Dict[str, str]: parsed_docstring = defaultdict(str) if not doc_string: return parsed_docstring diff --git a/pyproject.toml b/pyproject.toml index 05eafdc..dfd6904 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ default-args = ['ollama', 'tests'] extra-dependencies = [ 'pytest-anyio', 'pytest-httpserver', + 'tox', ] [tool.hatch.envs.hatch-static-analysis] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..bda8f8b --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +# Tox configuration for local multi-version testing +# Run `tox` to test the package on all supported Python versions +# Requires Python interpreters to be installed (e.g., via pyenv) + +[tox] +envlist = py38, py39, py310, py311, py312, py313 +skip_missing_interpreters = true + +[testenv] +allowlist_externals = uv +deps = + pytest + pytest-anyio + pytest-httpserver +install_command = uv pip install {opts} {packages} +commands = uv run pytest {posargs:tests/} \ No newline at end of file