Pybtex / Docs / Python API / Extending Pybtex with plugins

# Extending Pybtex with plugins

- Entry points
  - pybtex.database.input
  - pybtex.database.output
  - pybtex.backends
  - pybtex.style.formatting
  - pybtex.style.labels
  - pybtex.style.names
  - pybtex.style.sorting
- Registering plugins
- Example plugins

Pybtex uses plugins for bibliography data formats, output markup formats and bibliography formatting styles. This allows to add new formats or styles to Pybtex withoud modifying Pybtex itself.

The plugins are based on Setuptools’ entry points.

## Entry points

Here is the list of entry points supported by Pybtex.

### pybtex.database.input

This entry point is used for bibliography parsers. Must point to a subclass of `pybtex.database.input.BaseParser`.

There is also an additional entry point called `pybtex.database.output.suffixes`. It is used for registering bibliography formats for specific file suffixes (like BibTeX for `.bib` files).

For example, a JSON input plugin could use these entry points:

    [pybtex.database.input]
    json = pybtexjson:JSONParser

    [pybtex.database.input.suffixes]
    .json = pybtexjson:JSONParser

### pybtex.database.output

This entry poing is used for bibliography writers. Must point to a subclass of `pybtex.database.output.BaseWriter`.

There is also an additional entry point called `pybtex.database.output.suffixes`. It is used for registering default plugins for specific file suffixes in the same way as `pybtex.database.input.suffixes` described above.

### pybtex.backends

This entry point is for adding new output markup formats for Pythonic bibliography styles. The built-in plugins are `latex`, `html`, `markdown`, and `plaintext`. Must point to a `pybtex.backends.BaseBackend` subclass.

### pybtex.style.formatting

This is the entry point for Pythonic bibliography styles. Must point to a `pybtex.style.formatting.BaseStyle` subclass.

### pybtex.style.labels

Label styles for Pythonic bibliography styles.

### pybtex.style.names

Name styles for Pythonic bibliography styles.

### pybtex.style.sorting

Sorting styles for Pythonic bibliography styles.

## Registering plugins

See Setuptools’ documentation.

## Example plugins

An example project directory with two simple plugins and a `setup.py` file can be found in the examples/sample_plugins subdirectory.

← Designing styles
Table of contents
Version history →