Skip to content

docs: restore per-document bibliographies after sphinxcontrib-bibtex 2.7.0#909

Open
anevolbap wants to merge 2 commits into
pymc-labs:mainfrom
anevolbap:docs/restore-per-doc-bibliographies-870
Open

docs: restore per-document bibliographies after sphinxcontrib-bibtex 2.7.0#909
anevolbap wants to merge 2 commits into
pymc-labs:mainfrom
anevolbap:docs/restore-per-doc-bibliographies-870

Conversation

@anevolbap
Copy link
Copy Markdown
Contributor

Closes #870. Supersedes #905 (the panel_fixed_effects bibliography cell stays in place under this approach, so the cleanup PR is no longer needed).

Why

#834 centralized 22 per-document :::{bibliography}::: blocks into a single global references.rst to silence bibtex.duplicate_citation warnings. The deeper reason was that on sphinxcontrib-bibtex 2.6.x, citation hyperlinks resolved non-deterministically across documents (a {cite:t} on page A could link to page B's bibliography). The trade-off was a UX regression: readers leaving the page they were on to see a reference.

sphinxcontrib-bibtex 2.7.0 (PyPI, 2026-05-06) addresses that with same-document-preferred resolution (upstream issue #385 / PR #387) and a new duplicate_local_citation warning category that lets us suppress only the cross-document noise.

Changes

  • pyproject.toml: pin sphinxcontrib-bibtex>=2.7.0.
  • docs/source/conf.py: add suppress_warnings = ["bibtex.duplicate_citation", "bibtex.duplicate_label"] (both are expected noise across per-doc bibliographies; same-page duplicates still surface as bibtex.duplicate_local_citation). Revert bibtex_default_style from "alpha" to "unsrt". Drop the strip_citation_labels extension and the custom.css hanging-indent rule (both were tuned for the centralized page).
  • Delete docs/source/_extensions/strip_citation_labels.py, docs/source/_static/custom.css, docs/source/references.rst. Drop ../references from the knowledgebase toctree.
  • Restore ## References + :::{bibliography}:filter: docname in docnames::: in 22 docs (3 markdown, 19 notebooks). Two extra notebooks that previously cited keys without a per-doc bib (structural_causal_models.ipynb, iv_vs_priors.ipynb) also got one, since cross-doc resolution no longer covers them under same-document-first behavior.

Notebook handling

Edits used raw JSON manipulation that preserves each notebook's original indent and key ordering, so diffs are minimal: each touched notebook adds 11-12 lines (the new markdown cell only). Outputs were not re-executed because no code cell changed; the appended cell is markdown only.

Verification

  • prek run --all-files passes locally.
  • make html builds with 12 warnings, all of them pre-existing and unrelated:
    • 8x pymc.model.core.Model.debug docstring ERRORs (PyMC source, also flagged in docs: fix Sphinx build warnings #834).
    • 4x bibtex.key_not_found for goodman2021difference in panel_fixed_effects.ipynb, sensitivity_checks.md, and staggered_did_pymc.ipynb -- the actual key in references.bib is goodmanbacon2021difference. This typo was already broken under the centralized page; out of scope for this PR.
  • Spot-checked rendered HTML: {cite:t} / {cite:p} links in sc_pymc.html, did_pymc_banks.html, inv_prop_pymc.html resolve to in-page anchors (href="#idN" matching id="idN" in the same document).
  • No bibtex.duplicate_local_citation warnings.

Out of scope

…2.7.0

Reverts the centralization done in pymc-labs#834. With sphinxcontrib-bibtex 2.7.0
(released 2026-05-06), citation hyperlinks resolve to the same page when
the citing document has its own bibliography block, even when other
documents register the same key. This removes the UX regression that
forced the central-page workaround.

- pyproject.toml: pin sphinxcontrib-bibtex>=2.7.0
- conf.py: suppress duplicate_citation/duplicate_label, revert default
  style alpha->unsrt, drop strip_citation_labels extension and
  custom.css hanging-indent rule
- delete _extensions/strip_citation_labels.py, _static/custom.css,
  references.rst
- knowledgebase/index.md: drop ../references toctree entry
- restore '## References' + bibliography block in 22 docs (3 markdown
  + 19 notebooks). Two extra notebooks that always cited keys without
  a per-doc bib (structural_causal_models.ipynb, iv_vs_priors.ipynb)
  now also have one, since cross-doc resolution no longer covers them
  by default.

Closes pymc-labs#870.
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 7, 2026
@juanitorduz juanitorduz requested a review from drbenvincent May 7, 2026 09:13
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.89%. Comparing base (e14d731) to head (adda79f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
+ Coverage   94.87%   94.89%   +0.01%     
==========================================
  Files          85       85              
  Lines       13174    13174              
  Branches      793      793              
==========================================
+ Hits        12499    12501       +2     
+ Misses        479      478       -1     
+ Partials      196      195       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 7, 2026

…ence

The references.bib entry has always been goodmanbacon2021difference, but
four citations across three docs used a misspelled goodman2021difference
that had never resolved. Fixes the resulting bibtex.key_not_found
warnings flagged during the per-document bibliography revert build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore per-document bibliography sections

1 participant