bibtexparser

Bibtex parser for Python 3

https://github.com/sciunto-org/python-bibtexparser

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 52 committers (1.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary

Keywords

bibtex bibtex-files latex python

Keywords from Contributors

closember transformer ranking gtk qt tk wx
Last synced: 6 months ago · JSON representation

Repository

Bibtex parser for Python 3

Basic Info
Statistics
  • Stars: 525
  • Watchers: 24
  • Forks: 132
  • Open Issues: 30
  • Releases: 12
Topics
bibtex bibtex-files latex python
Created about 13 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

python-bibtexparser v2

Welcome to python-bibtexparser, a parser for .bib files with a long history and wide adaption.

Bibtexparser is available in two versions: V1 and V2. For new projects, we recommend using v2 which, in the long run, will provide an overall more robust and faster experience. For now, however, note that v2 is an early beta, and does not contain all features of v1. Install v2 using pip:

bash pip install bibtexparser --pre

Or you can install the latest development version directly from the main branch: bash pip install --no-cache-dir --force-reinstall git+https://github.com/sciunto-org/python-bibtexparser@main

If instead, you want to use v1, install it using:

bash pip install bibtexparser~=1.0

Note that all development and maintenance effort is focussed on v2. Small PRs for v1 are still accepted, but only as long as they are backwards compatible and don't introduce much additional technical debt. Development of version one happens on the dedicated v1 branch.

The remainder of this README is specific to v2.

Documentation

Go check out our documentation on https://bibtexparser.readthedocs.io/en/main/.

Advantages of V2

  • :rocket: Order of magnitudes faster
  • :wrench: Easily customizable parsing and writing
  • :herb: Access to raw, unparsed bibtex.
  • :hankey: Fault-Tolerant: Able to parse files with syntax errors
  • :mahjong: Massively simplified, robuster handling of de- and encoding (special chars, ...).
  • :copyright: Permissive MIT license

TLDR Usage Example

```python

Parsing a bibtex string with default values

bibdatabase = bibtexparser.parsestring(bibtex_string)

Converting it back to a bibtex string, again with default values

newbibtexstring = bibtexparser.writestring(bibdatabase) ```

Slightly more involved example:

```python

Lets parse some bibtex string.

bibdatabase = bibtexparser.parsestring(bibtexstring, # Middleware layers to transform parsed entries. # Here, we split multiple authors from each other and then extract first name, last name, ... for each appendmiddleware=[SeparateCoAuthors(), SplitNameParts()], )

Here you have a bib_database with all parsed bibtex blocks.

Let's transform it back to a bibtex_string.

newbibtexstring = bibtexparser.writestring(bibdatabase, # Revert aboves transfomration prepend_middleware=[MergeNameParts(), MergeCoAuthors()] ) ```

These examples really only show the bare minimum. Consult the documentation for a list of available middleware, parsing options and write-formatting options.

V2 Architecture and Terminology

bibtexparserv2

The architecture consists of the following components:

Library

Reflects the contents of a parsed bibtex files, including all comments, entries, strings, preamples and their metadata (e.g. order).

A Splitter

Splits a bibtex string into basic blocks (Entry, String, Preamble, ...), with correspondingly split content (e.g. fields on Entry, key-value on String, ...). The splitter aims to be forgiving when facing invalid bibtex: A line starting with a block definition (@....) ends the previous block, even if not yet every bracket is closed, failing the parsing of the previous block. Correspondingly, one block type is "ParsingFailedBlock".

Middleware

Middleware layers transform a library and its blocks, for example by decoding latex special characters, interpolating string references, resoling crossreferences or re-ordering blocks. Thus, the choice of middleware allows to customize parsing and writing to ones specific usecase. Note: Middlewares, by default, no not mutate their input, but return a modified copy.

Writer

Writes the content of a bibtex library to a .bib file. Optional formatting parameters can be passed using a corresponding dedicated data structure.

About

Since 2022, bibtexparser is primarily written and maintained by Michael Weiss (@MiWeiss). In 2024, Tom de Geus (@tdegeus) joined as co-maintainer.

Credits and thanks to the many contributors who helped creating this library, including François Boulogne (@sciunto, creator of the first version) and Olivier Mangin (@omangin, long-term contributor).

Owner

  • Name: sciunto-org
  • Login: sciunto-org
  • Kind: organization

GitHub Events

Total
  • Create event: 6
  • Release event: 2
  • Issues event: 9
  • Watch event: 56
  • Delete event: 3
  • Issue comment event: 19
  • Push event: 4
  • Pull request event: 5
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Fork event: 3
Last Year
  • Create event: 6
  • Release event: 2
  • Issues event: 9
  • Watch event: 56
  • Delete event: 3
  • Issue comment event: 19
  • Push event: 4
  • Pull request event: 5
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Fork event: 3

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 592
  • Total Committers: 52
  • Avg Commits per committer: 11.385
  • Development Distribution Score (DDS): 0.47
Past Year
  • Commits: 3
  • Committers: 2
  • Avg Commits per committer: 1.5
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
François Boulogne f****g 314
Michael Weiss c****e@m****h 90
Olivier Mangin o****r@m****m 48
François Boulogne d****l@s****g 17
faph f****e@p****h 16
Kevin Borgolte c****o@c****c 14
Tom de Geus t****s 13
Florian Praden f****n@p****u 8
Shuen-Huei (Drake) Guan d****n@g****m 6
Phyks (Lucas Verney) p****s@p****e 5
Christian Schaffner c****s@c****x 4
grochmal g****l@m****g 4
Matthew Lutze m****e 4
Michael Fruth m****h@u****e 3
Blair Bonnett b****t@g****m 3
joncrall e****c@g****m 2
Manuel Stoeckel m****l@o****e 2
Simson L. Garfinkel s****g@a****g 2
Stefan Pfenninger s****n@p****g 2
Sven Goossens s****s@g****m 2
Uwe Schmidt m****l@u****g 2
Claudius Ellsel c****l@l****e 1
Arthur Bols a****r@b****v 1
Florenz Hollebrandse f****e@e****k 1
Keji Li m****l@k****i 1
Chuanren Wu me@c****e 1
geritwagner g****r 1
christiandreher 4****r 1
Zeping Lee z****e@g****m 1
ZH Zhang 3****t 1
and 22 more...

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 134
  • Total pull requests: 111
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 4 months
  • Total issue authors: 78
  • Total pull request authors: 31
  • Average comments per issue: 2.69
  • Average comments per pull request: 1.52
  • Merged pull requests: 90
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 9
  • Pull requests: 4
  • Average time to close issues: 3 days
  • Average time to close pull requests: 5 minutes
  • Issue authors: 9
  • Pull request authors: 4
  • Average comments per issue: 2.22
  • Average comments per pull request: 0.75
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • tdegeus (15)
  • claell (8)
  • MiWeiss (7)
  • omangin (7)
  • sciunto (5)
  • nschloe (4)
  • rudrab (4)
  • mlutze (3)
  • simsong (3)
  • kmccurley (2)
  • michaelfruth (2)
  • mscheltienne (2)
  • zingale (1)
  • detlevd (1)
  • eastGrass (1)
Pull Request Authors
  • MiWeiss (64)
  • tdegeus (25)
  • mlutze (5)
  • michaelfruth (4)
  • m-stoeckel (3)
  • claell (2)
  • Technologicat (2)
  • lartpang (2)
  • rbirke (2)
  • principis (2)
  • kno10 (1)
  • noahkw (1)
  • mscheltienne (1)
  • benlogan (1)
  • cinntamani (1)
Top Labels
Issue Labels
v2 (32) enhancement (32) bug (23) fixed in v2 (22) needs help (13) v1 (13) good first issue (12) question (11) documentation (4) reproduced (4) hacktoberfest (3) cannot reproduce (3) maintenance (3) workaround exists (2) biber (2) waiting for answer (2) under review (2) duplicate (2) waiting for maintainer (1) stale (1) wontfix (1)
Pull Request Labels
enhancement (7) stale (7) hacktoberfest-accepted (3) bug (2) hacktoberfest (1) v1 (1) fixed in v2 (1) wontfix (1) good first issue (1) needs help (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 414,568 last-month
  • Total docker downloads: 191,510,915
  • Total dependent packages: 151
    (may contain duplicates)
  • Total dependent repositories: 1,499
    (may contain duplicates)
  • Total versions: 47
  • Total maintainers: 3
pypi.org: bibtexparser

Bibtex parser for python 3

  • Versions: 29
  • Dependent Packages: 151
  • Dependent Repositories: 1,499
  • Downloads: 414,568 Last month
  • Docker Downloads: 191,510,915
Rankings
Dependent packages count: 0.2%
Dependent repos count: 0.3%
Docker downloads count: 0.4%
Downloads: 1.4%
Average: 1.6%
Stargazers count: 3.3%
Forks count: 4.1%
Maintainers (2)
Last synced: 6 months ago
proxy.golang.org: github.com/sciunto-org/python-bibtexparser
  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 2.3%
Stargazers count: 2.9%
Average: 6.4%
Dependent packages count: 9.6%
Dependent repos count: 10.8%
Last synced: 6 months ago
alpine-edge: py3-bibtexparser

Bibtex parser in Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 7.0%
Dependent packages count: 14.0%
Last synced: 6 months ago
alpine-edge: py3-bibtexparser-pyc

Precompiled Python bytecode for py3-bibtexparser

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 7.0%
Dependent packages count: 14.0%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • pyparsing >=2.0.3
setup.py pypi
  • pyparsing >=2.0.3
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-node v2-beta composite
  • actions/setup-python v2 composite