Skip to content

Conversation

jamesbraza
Copy link
Collaborator

@jamesbraza jamesbraza commented Jul 3, 2025

@jamesbraza jamesbraza self-assigned this Jul 3, 2025
@jamesbraza jamesbraza added the bug Something isn't working label Jul 3, 2025
@Copilot Copilot AI review requested due to automatic review settings July 3, 2025 21:11
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 3, 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

Adds a new BibTeXSource enum to track where BibTeX entries originate and ensures bibtex_source is included in the other field of DocDetails.

  • Introduce BibTeXSource enum and its helper method update_other
  • Refactor populate_bibtex_key_citation to use the new enum
  • Update clients and tests to populate bibtex_source via enum values

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/test_paperqa.py Updated test to expect "bibtex_source": ["self_generated"]
paperqa/types.py Added BibTeXSource enum and refactored bibtex metadata logic
paperqa/clients/semantic_scholar.py Switched hardcoded strings to BibTeXSource enum values
paperqa/clients/crossref.py Switched hardcoded strings to BibTeXSource enum values
Comments suppressed due to low confidence (4)

paperqa/types.py:348

  • The new update_other helper logic isn’t directly tested; consider adding unit tests for scenarios with no existing other, with an existing list missing the source, and with the source already present.
    def update_other(self, other: dict[str, Any] | None = None) -> dict[str, Any]:

paperqa/clients/semantic_scholar.py:154

  • [nitpick] Storing the raw enum .value bypasses type safety; consider passing the enum member itself and converting to string only at serialization boundary.
    bibtex_source = BibTeXSource.SELF_GENERATED.value

paperqa/clients/crossref.py:170

  • [nitpick] Consistent with the previous suggestion, using .value here loses the benefit of the enum; consider carrying the enum through until final serialization.
    bibtex_source = BibTeXSource.SELF_GENERATED.value

paperqa/types.py:588

  • You removed the # noqa: PLR0912 comment but the method is still very long and nested; consider re-adding the noqa or refactoring to satisfy complexity rules.
    def populate_bibtex_key_citation(cls, data: dict[str, Any]) -> dict[str, Any]:

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 3, 2025
@jamesbraza jamesbraza merged commit bf7fcf9 into main Jul 3, 2025
5 checks passed
@jamesbraza jamesbraza deleted the bibtex-source branch July 3, 2025 21:33
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:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants