From de9fd3c0a0bc633aa8a0f5d8b6b2c6058af41ce1 Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 8 Aug 2025 20:11:08 -0700 Subject: [PATCH 1/3] Added missing dependencies to mypy in pre-commit --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ecff556..3a6329d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -105,6 +105,10 @@ repos: - numpy - pydantic~=2.11 # Match pyproject.toml - pydantic-settings + - PyPDF>=3 # Match pyproject.toml + - pytest + - pytest-asyncio + - pytest-subtests - qdrant-client - rich - tantivy>=0.22.2 # Match pyproject.toml From 76061b1ac0dc96372695de7e72930e5e472e4fea Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 8 Aug 2025 20:11:01 -0700 Subject: [PATCH 2/3] Passing correct args to mypy, to not be silent --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3a6329d5..2fe74f21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -91,7 +91,7 @@ repos: rev: v1.17.1 hooks: - id: mypy - args: [--pretty, --ignore-missing-imports] + args: [--scripts-are-modules] additional_dependencies: - aiohttp>=3.10.6 # Match pyproject.toml - PyMuPDF>=1.24.12 From 8f72f30658abace89ac73a584089638e613fad67 Mon Sep 17 00:00:00 2001 From: James Braza Date: Mon, 11 Aug 2025 10:49:32 -0700 Subject: [PATCH 3/3] Moved to local pre-commit so CI mypy can see paperqa.version --- .github/workflows/tests.yml | 7 +++++++ .pre-commit-config.yaml | 34 +++++----------------------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2430e65a..99df511e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,6 +20,13 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - run: echo "UV_PROJECT_ENVIRONMENT=$(python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")" >> $GITHUB_ENV + - run: uv python pin ${{ matrix.python-version }} # uv requires .python-version to match OS Python: https://github.com/astral-sh/uv/issues/11389 + - run: uv sync --python-preference only-system + - run: git checkout .python-version # For clean git diff given `pre-commit run --show-diff-on-failure` - uses: pre-commit/action@v3.0.1 - uses: pre-commit-ci/lite-action@v1.1.0 if: always() diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fe74f21..ebf54822 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -87,34 +87,10 @@ repos: rev: 0.0.10 hooks: - id: markdown-toc-creator - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.17.1 + - repo: local # Use local so we can inspect paperqa.version hooks: - id: mypy - args: [--scripts-are-modules] - additional_dependencies: - - aiohttp>=3.10.6 # Match pyproject.toml - - PyMuPDF>=1.24.12 - - anyio - - fhlmi>=0.28 # Match pyproject.toml - - fhaviary[llm]>=0.20 # Match pyproject.toml - - ldp>=0.25.0 # Match pyproject.toml - - html2text - - httpx - - pybtex - - numpy - - pydantic~=2.11 # Match pyproject.toml - - pydantic-settings - - PyPDF>=3 # Match pyproject.toml - - pytest - - pytest-asyncio - - pytest-subtests - - qdrant-client - - rich - - tantivy>=0.22.2 # Match pyproject.toml - - tenacity - - tiktoken>=0.4.0 # Match pyproject.toml - - types-setuptools - - types-PyYAML - - sentence-transformers - - pyzotero + name: mypy + entry: mypy + language: system + types_or: [python, pyi]