Skip to main content

Sanitize BibTeX files without going insane

Project description

BibSane

Sanitize BibTeX files without going insane.

BibSane is comparable to bibexport and checkcites, but has a few important improvements.

Features:

  • A single new cleaned bib file is written to replace the old ones.
    • Unused entries are discarded.
    • Missing entries result in an error.
    • Duplicates are reported and merged if safe.
    • Check for BibTeX keys that differ only by case.
    • Remove redundant braces (not in author, editor and title)
    • Optional configurable BibTeX database policies:
      • Drop irrelevant entry types
      • Remove cruft from BibTeX entries. One may add a field, such as bibsane = {misc.url} to support multiple policies for one BibTeX entry
      • Restrict the types of entries.
      • Disallow @preamble.
      • Strip newlines and redundant whitespace in fields.
      • Normalize DOI (lowercase and strip proxy)
      • Merge entries based on DOI and/or BibTeX ID.
      • Normalize page double hyphen
      • Abbreviated Journals, using abbreviso.
      • Sort by year + author last name
  • Hackable: written in Python and built on top of bibtexparser.
  • Configurable
  • Cheerful terminal output
  • Usable as a pre-commit hook.

Installation as standalone tool

pip install BibSane

Usage

bibsane somefile.aux [-c someconfig.yaml]

The file [exampleconfig.yaml] can be used as a starting point for your configuration.

Usage as a pre-commit hook

Add the following to your .pre-commit-config.yaml

- repo: https://github.com/reproducible-reporting/bibsane
  rev: v0.1.0
  hooks:
    - id: bibsane
      # You may want to pass in a config file
      args ["-c someconfig.yaml"]

You also need to commit the .aux files to your Git history.

Development

If you would like to contribute, please read CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BibSane-0.1.3.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

BibSane-0.1.3-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file BibSane-0.1.3.tar.gz.

File metadata

  • Download URL: BibSane-0.1.3.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for BibSane-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b6fbb1abe58670c4f3cd6ce4de696a09c12dbaa257e9ccc85e444884b601b358
MD5 6128737baae11ab1a8b9068e68f0c4a6
BLAKE2b-256 87ec5acfd6285c97540646c023ee051bce67fff963fcbc0ef9c7d74e204e374f

See more details on using hashes here.

File details

Details for the file BibSane-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: BibSane-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for BibSane-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 530dc971c6f778761bc4bce25bcf2e0881e034a61e62908cf232f906076620b5
MD5 e66c7c51de7f26397f3e4903def9a52c
BLAKE2b-256 d82243066269befddc3cec53c6335403227613487759ad97fb7f45c6307da9c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page