Skip to content

Conversation

jamesbraza
Copy link
Collaborator

To get typeguard to work you need to not import the target package into conftest.py. We were doing that, so to not do that:

  • Using lmi imports where possible
  • Lazily importing the rest

Then, I resolved all type errors that were exposed.

@jamesbraza jamesbraza self-assigned this Jun 11, 2025
@Copilot Copilot AI review requested due to automatic review settings June 11, 2025 05:42
@jamesbraza jamesbraza added the bug Something isn't working label Jun 11, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores typeguard functionality by refactoring the import structure to delay importing certain packages and updating type annotations to support multiple value types.

  • Introduce lazy imports in tests/conftest.py and agent test fixtures to avoid typeguard errors.
  • Update type annotations for missing replacement parameters across multiple functions using Mapping.
  • Refactor header usage in client modules to use lmi.utils constants.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/conftest.py Lazily import paperqa modules to avoid typeguard instrumentation.
paperqa/utils.py Updated missing_replacements type to Mapping for added flexibility.
paperqa/types.py Annotated CITATION_FALLBACK_DATA with an explicit mapping type.
paperqa/clients/semantic_scholar.py Updated header usage to use the constant from lmi.utils.
paperqa/clients/crossref.py Updated missing_replacements types and refactored fragments loop.
Comments suppressed due to low confidence (1)

tests/conftest.py:112

  • There is a duplicated word 'is' in the question string; please change it to 'What is a self-explanatory model?'.
return PQASession(question="What is is a self-explanatory model?")

@jamesbraza jamesbraza force-pushed the typeguard-running branch 2 times, most recently from fff687d to b83998e Compare June 11, 2025 06:07
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 11, 2025
@jamesbraza jamesbraza merged commit 38bd16a into main Jun 11, 2025
16 of 20 checks passed
@jamesbraza jamesbraza deleted the typeguard-running branch June 11, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants