Repository navigation
Conversation
bibtexparser 2.x (2.0.1 and 2.1.0 are now the latest stable releases on PyPI) removed bibtexparser.bibdatabase, bparser, loads() and dumps(), so "import scholarly" fails with ModuleNotFoundError: No module named 'bibtexparser.bibdatabase' on any fresh install on Python 3.10+. Move the BibTeX parsing and writing into two helpers that use the 2.x API when it is available and the 1.x API otherwise (bibtexparser 2 requires Python 3.10, so 3.8 and 3.9 still get 1.x). The 2.x path produces the same entry dicts and the same BibTeX text as 1.x (fields sorted by name, one-space indent, brace-enclosed values). Fixes scholarly-python-package#546.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #546.
Description
bibtexparser 2.x is now the stable release on PyPI (2.0.1 on 2026-09-10, 2.1.0 on 2026-10-02). It removes
bibtexparser.bibdatabase,bparser,loads()anddumps(). Sincebibtexparseris unpinned in setup.py and requirements.txt, a freshpip install scholarlyon Python 3.10+ now pulls in 2.x, andimport scholarlyfails withThis PR moves the BibTeX parsing (in
PublicationParser.fill) and writing (inPublicationParser.bibtex) into two small helpers. They use the 2.x API when it's installed and the 1.x API otherwise, so nothing needs pinning: bibtexparser 2 requires Python 3.10, and pip still installs 1.x on 3.8/3.9. The 2.x path produces the same entry dict (ENTRYTYPE,ID, lower-case field names, unbraced values) and the same BibTeX text as 1.x (fields sorted by name, one-space indent,{}-enclosed values).testdata/test_bibtex_result.txttherefore still matches.Checklist
developand notmain.test_bibtexcovers the output; see below for an offline check.)Testing
Offline script, run against this branch on CPython 3.12.13, 3.13.14 and 3.14.3, each with bibtexparser 1.4.4 and with 2.1.0 (six venvs). It feeds
PublicationParser.fill()a Google-Scholar-style BibTeX string for thetest_bibtexpaper through a stub navigator, then callsbibtex()on the filled publication:bibtex()output is byte-identical totestdata/test_bibtex_result.txtin all six combinationsbibdict produced byfill()is identical across all sixflake8 scholarly/publication_parser.pywith the repo's .flake8: 0 issuesContext: found while testing packages against Python 3.13 for FreeBSD ports (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292105).