{"library":"pybtex","title":"Pybtex: BibTeX-compatible bibliography processor","description":"Pybtex is a BibTeX-compatible bibliography processor written in Python, designed to read citation information from various formats (BibTeX, BibTeXML, YAML) and produce formatted bibliographies. It supports traditional BibTeX `.bst` styles and also allows for defining custom styles directly in Python, with output options including LaTeX, HTML, Markdown, or plain text. Currently at version 0.26.1, it is actively maintained and serves as a flexible alternative or drop-in replacement for the original BibTeX.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pybtex"],"cli":{"name":"pybtex","version":"pybtex-0.26.1"}},"imports":["from pybtex.database import BibliographyData","from pybtex.database.input.bibtex import Parser","from pybtex.database.output.html import Writer","from pybtex.style.formatting import BaseStyle","from pybtex.richtext import Text"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pybtex.database.input import bibtex\nfrom pybtex.database.output import html\nfrom pybtex.style.formatting import plain\nfrom pybtex.style.template import field, sentence, tag\nimport os\n\n# Create a dummy .bib file for demonstration\nbib_content = \"\"\"\n@article{einstein1905relativity,\n  title={Zur Elektrodynamik bewegter K\\\"orper},\n  author={Einstein, Albert},\n  journal={Annalen der Physik},\n  volume={322},\n  number={10},\n  pages={891-921},\n  year={1905},\n  doi={10.1002/andp.19053221006}\n}\n\"\"\"\nwith open('references.bib', 'w') as f:\n    f.write(bib_content)\n\n# 1. Parse the bibliography data\nparser = bibtex.Parser()\nbib_data = parser.parse_file('references.bib')\n\n# 2. Select a formatting style (e.g., 'plain' or a custom one)\n# For a custom style, you would inherit from BaseStyle\nstyle = plain.Style()\n\n# 3. Format the bibliography\n# The 'citations' argument specifies which entries to include. \n# If not provided, all entries in bib_data will be formatted.\nformatted_bibliography = style.format_bibliography(bib_data, citations=['einstein1905relativity'])\n\n# 4. Write the formatted bibliography to an output file (e.g., HTML)\nwriter = html.Writer()\nwith open('output.html', 'w') as f:\n    writer.write_file(formatted_bibliography, f)\n\nprint(\"Bibliography processed and saved to output.html\")\n\n# Clean up dummy file\nos.remove('references.bib')\nos.remove('output.html')","lang":"python","description":"This quickstart demonstrates how to parse a BibTeX file, apply a predefined formatting style (or a custom one), and output the result to an HTML file using Pybtex's Python API. It creates a dummy `.bib` file, processes it, and then cleans up the generated files. For more complex use cases, especially with `.aux` files, the command-line interface or the `pybtex.Engine` might be more suitable.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.26.1","pypi_latest":"0.26.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.8,"avg_import_s":0.12,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.11,"mem_mb":4,"disk_size":"21.2M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.08,"mem_mb":4,"disk_size":"22M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":4.7,"disk_size":"23.3M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.13,"mem_mb":4.7,"disk_size":"25M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":5.3,"disk_size":"15.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.16,"mem_mb":5.3,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.13,"mem_mb":5.5,"disk_size":"14.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.14,"mem_mb":5.5,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.1,"mem_mb":4.2,"disk_size":"20.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pybtex","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.11,"mem_mb":4.2,"disk_size":"22M"}]}}