Skip to content

Strange interplay with sphinxcontrib-bibtex #177

@mcocdawc

Description

@mcocdawc

Current Behavior

When building documentation using sphinxcontrib-bibtex together with sphinx-multiversion, citations inside Python docstrings (e.g., :cite:\...``) fail with an error such as:

docstring of quemb.molbe.fragment.fragmentate:19: WARNING: could not find bibtex key "weser_automated_2023" [bibtex.key_not_found]

However, the same citation works correctly when used in an .rst file. The error only occurs when using sphinx-multiversion, but not when using sphinx-build directly or via make html.

Expected Behavior

Citations in Python docstrings (e.g., using :cite:) should work identically whether the docs are built using sphinx-build or sphinx-multiversion.

Reproduction Steps

Steps to reproduce the behavior:

  1. Clone the repo:
   git clone git@github.com:troyvvgroup/quemb.git
   cd quemb
   git checkout improve_doc
   pip install .
   cd docs
   pip install -r requirements.txt
  1. Build the documentation using make (this works):
make html
  1. Build the documentation manually using sphinx-build (this also works):
sphinx-build -W --keep-going -n source build/html
  1. Build using sphinx-multiversion (this fails):
sphinx-multiversion -W --keep-going -n source build/html

Environment

Code appears both locally and on GitHub CI pipeline with different python versions.

My local environment:

  • Ubuntu 24.04.2 LTS
  • Python 3.12.3

Additional Context

  • I am not sure if this is a problem of sphinxcontrib-bibtex or of sphinx-multiversion and reported the same issue also there

  • Link to PR where bug appeared: Improve doc troyvvgroup/quemb#181

  • The citation key exists in the literature.bib file and is used successfully in .rst files.

  • I asked the question on StackOverflow.

  • A dumbed down conf.py of our project looks like this

from pathlib import Path

extensions = [
    "sphinx_multiversion",
    "sphinxcontrib.bibtex",
]

CONF_DIR = Path(__file__).parent
bibtex_bibfiles = [str(CONF_DIR / "literature.bib")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions