This module is meant to be used as a static resources package, in order to make it easy to include the required Citation Style files (.csl) when using citeproc-py.
In order to avoid always installing ~40MB of files each time you include it in a project you could specify it as an extra in your setup.py, and only use it in the production environment or as an optional feature of your module. (Example setup.py)
Note: The style files are referenced as a git submodule. This means that this repository/package is pinned on a specific commit of the CSL Style Repository, and thus may not include any fixes or new styles that may have been added. Next versions of this repository will of course ‘bump’ the styles version to the latest commit, but this will not happen on a scheduled basis for the time being.
citeproc-py-styles is on PyPI so all you need is:
pip install citeproc-py-styles
This is a minimal example of how one could use citeproc-py-styles to render a citation with citeproc-py:
from citeproc import (Citation, CitationItem, CitationStylesBibliography, CitationStylesStyle, formatter) from citeproc.source.json import CiteProcJSON from citeproc_styles import get_style_filepath csl_data = json.loads("...") source = CiteProcJSON(csl_data) style_path = get_style_filepath('apa') style = CitationStylesStyle(style_path) bib = CitationStylesBibliography(style, source, formatter.plain) bib.register(Citation([CitationItem('data_id')])) print(''.join(bib.bibliography()))
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size citeproc_py_styles-0.1.2-py2.py3-none-any.whl (8.2 MB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size citeproc-py-styles-0.1.2.tar.gz (2.1 MB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for citeproc_py_styles-0.1.2-py2.py3-none-any.whl