Skip to main content

A pybtex plugin for NBIB/Medline/PubMed files

Project description

pipline badge coverage badge black badge git3moji badge

A pybtex plugin for NBIB/Medline/PubMed files. For information on the file format, see the documentation at the National Library of Medicine.

Installation

Install pybtexnbib from PyPI using pip:

pip install pybtexnbib

Command-line usage

To convert an NBIB file to another format, use the pybtex-convert command. For example:

pybtex-convert bibliography.nbib bibliography.bib

The extension of the output file must be supported by pybtex or an associated plugin.

To format an NBIB file into a human-readable bibliography, use the pybtex-format command. For example:

pybtex-format bibliography.nbib bibliography.txt

For more information, see the documentation for pybtex.

Programmatic usage

NBIB files can be formatted into a human-readable bibliography as a string as follows:

from pybtex import format_from_file
bibliography_string = format_from_file(
    "path/to/file.nbib",
    style="plain",
    output_backend="plaintext",
    bib_format="nbib",
)

Multiple NBIB files can be formatted in a similar way:

from pybtex import format_from_files
bibliography_string = format_from_files(
    ["path/to/file1.nbib", "path/to/file2.nbib"],
    style="plain",
    output_backend="plaintext",
    bib_format="nbib",
)

By giving "suffix" as the argument to bib_format, NBIB files can be combined with bibliography files of other formats (such as BibTeX or RIS):

from pybtex import format_from_files
bibliography_string = format_from_files(
    ["path/to/file1.nbib", "path/to/file2.bib", "path/to/file3.ris"],
    style="plain",
    output_backend="plaintext",
    bib_format="suffix",
)

The RIS parser comes from pybtexris. Parsers for the files for other formats need to be registered on the pybtex.database.input.suffixes entry point as discussed pybtex plugin documentation.

For more information on programmatic use of pybtex, see the documentation of the Python API of pybtex.

Credit

Robert Turnbull (Melbourne Data Analytics Platform, University of Melbourne)

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

pybtexnbib-0.1.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

pybtexnbib-0.1.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pybtexnbib-0.1.2.tar.gz.

File metadata

  • Download URL: pybtexnbib-0.1.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1031-azure

File hashes

Hashes for pybtexnbib-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a9b865643c91153a26169e9f234d8a87e8daf76fdb98a141ca660e0aac178843
MD5 77800c8636ea18f8ade617f022f9edfb
BLAKE2b-256 24aefbe4bc1058c3af87eb192d305ff5c6e1acde3772cc1f43c10b86230ffd21

See more details on using hashes here.

File details

Details for the file pybtexnbib-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pybtexnbib-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-1031-azure

File hashes

Hashes for pybtexnbib-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31051eafd63ab36a72de5aafebb1ab6c7a577d97b4c7061fd1898c2486c5325e
MD5 19322e15a54c5d5f640fbc3bfafbefd8
BLAKE2b-256 d93157bfb80c5aed93b3a5ed08fd710ab136a39c94f167386d9de8d25c3bc537

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