BibClean🔗

bibclean is a simple auto-formatter for BibTeX files. It was designed to clean .bib files provided to sphinx documentation build using sphinxcontrib-bibtex.

Install🔗

BibClean is available on Pypi.

pip install bibclean
pip install git+https://github.com/mscheltienne/bibclean

Usage🔗

BibClean is a single command-line tool, bibclean, with two sub-commands: bibclean fix (auto-format) and bibclean check (check in CIs). Both accept -c or --config to overwrite the default TOML configuration with a different TOML configuration, e.g. pyproject.toml.

bibclean fix processes a single file in place. See here for additional information.

# clean the file references.bib in-place
bibclean fix references.bib
# clean the file references.bib with the configuration in pyproject.toml
bibclean fix references.bib -c pyproject.toml

bibclean check exits with the exit-code 0 if the file is already processed, with the exit-code 1 if violations have been found and with the exit-code 2 if unfixable violations have been found. See here for additional information.

# check if the file references.bib is already processed
bibclean check references.bib
# same, with the configuration in pyproject.toml
bibclean check references.bib -c pyproject.toml
repos:
  - repo: https://github.com/mscheltienne/bibclean
    rev: 1.0.0
    hooks:
      - id: bibclean-fix
        files: doc/references.bib

License🔗

BibClean is licensed under the MIT license. A full copy of the license can be found on GitHub.