Skip to main content

citeproc-py

PyPI - Version GitHub Actions Workflow Status Coveralls

citeproc-py is a CSL processor for Python. It aims to implement the CSL 1.0.2 specification. citeproc-py can output styled citations and bibliographies in a number of different output formats. Currently supported are plain text, reStructuredText and HTML. Other formats can be added easily.

citeproc-py uses semantic versioning. Currently, its major version number is still at 0, meaning the API is not yet stable. However, you should not expect to see any major API changes soon.

Requirements

citeproc-py supports Python 3.9 and up. It depends on lxml for parsing and navigating the CSL style and locale files.

Installation

The recommended way of installing citeproc-py is by using pip:

   pip install citeproc-py

If lxml isn't installed, pip will try to install it for you.

If you insist, you can manually install citeproc-py from distribution packages hosted at PyPI. Please ignore the release archives offered by GitHub.

Getting Started

To get started with citeproc-py, take a look at the examples under examples/. Two examples are provided, one parsing references from a JSON representation of references as supported by citeproc-js, another parsing the references from a BibTeX file. Both show and explain how to cite references and render the bibliography.

CSL Compatibility

Currently, citeproc-py passes about 60% of the tests in the citeproc-test suite. A non-exhaustive list of functionality that is missing includes:

  • disambiguation/year-suffix
  • et-al-subsequent-min/et-al-subsequent-use-first
  • collapsing
  • punctuation-in-quote
  • display

Also, some citeproc-js functionality that is not part of the CSL spec is not (yet) supported:

  • raw dates
  • static-ordering
  • literal names

Contributing

citeproc-py is 100% volunteer maintained, and new contributions are always welcome. If you would like to contribute, please follow the guidelines in the CONTRIBUTING.md file.

Local Install and Running the Tests

First clone the citeproc-py repository and install the submodules with

git submodule update --init

If you want git to fully ignore the submodules, you can type

git update-index --assume-unchanged citeproc/data/schema
git update-index --assume-unchanged citeproc/data/locales

Then install with

pip install --editable .[tests]

You can run all the tests using tox:

tox run -e py314

Or you can manually run citeproc-test tests using

python tests/citeproc-test.py

The first time you run the script it will clone the citeproc-test suite repository into the tests directory and checkout the last tested version. By default failed tests are automatically added into the failing_tests.txt file and aren't shown when running the test suite again.

citeproc-py uses ruff for linting. You can run it directly using ruff check. Any test failures or linting errors will show up on the CI and will need to be fixed before a Pull Request can be merged.

v0.12.0 (Fri Oct 30 2026)

🚀 Enhancement

Authors: 1


v0.11.1 (Tue Sep 01 2026)

🐛 Bug Fix

🏠 Internal

  • tests: remove global, ancient python code, and deprecated load_module #213 (@tmorrell)

Authors: 1


v0.11.0 (Thu Aug 20 2026)

🚀 Enhancement

Authors: 2


v0.10.7 (Mon Aug 10 2026)

🐛 Bug Fix

Authors: 1


v0.10.6 (Mon Aug 10 2026)

🐛 Bug Fix

  • Count citation-number as a variable call in cs:group #206 (@eseifert)

Authors: 1


v0.10.5 (Mon Aug 10 2026)

🐛 Bug Fix

  • fix(model): add defensive check in get_locale_option() for Locale roots #209 (@kyodai0000)

Authors: 1


v0.10.4 (Wed Aug 05 2026)

🐛 Bug Fix

  • setup.py: Prune imports #191 (@hseg)
  • Remove unneeded nonuniversal wheel declaration #191 (@hseg)
  • Fix project URL #191 (@hseg)
  • Specify license file #191 (@hseg)
  • Add missing build dep: lxml #191 (@hseg)
  • Use entry points for running scripts #191 (@hseg)
  • Use setuptools' builtin multifile longdesc support #191 (@hseg)
  • Rely on setuptools' automatic package discovery #191 (@hseg)
  • Migrate versioneer to pyproject.toml #191 (@hseg)
  • Migrate simple metadata to pyproject.toml #191 (@hseg)

Authors: 1


v0.10.3 (Fri Jul 24 2026)

🐛 Bug Fix

🔩 Dependency Updates

Authors: 2


v0.10.2 (Tue Jul 21 2026)

🐛 Bug Fix

  • Additional chicago style page range formats in csl 1.0.2 #198 (@tmorrell)

Authors: 1


v0.10.1 (Wed Jul 08 2026)

🐛 Bug Fix

Authors: 1


v0.10.0 (Tue Jul 07 2026)

🚀 Enhancement

🔩 Dependency Updates

Authors: 2


v0.9.3 (Thu Apr 30 2026)

🐛 Bug Fix

  • fix: Et_Al looked up literal term name 'variable' instead of the local variable #190 (@Jasaj4)

🔩 Dependency Updates

Authors: 2


v0.9.2 (Tue Apr 21 2026)

🐛 Bug Fix

Authors: 1


v0.9.1 (Mon Apr 20 2026)

🐛 Bug Fix

  • Add Dependabot configuration for GitHub Actions #185 (@tmorrell)
  • tests: drop python 3.9 #179 (@tmorrell)
  • Fix ordinal suffixes when style has embedded locale without ordinal terms #184 (@Copilot)

Authors: 2


v0.9.0 (Mon Aug 25 2025)

🚀 Enhancement

Authors: 1


v0.8.3 (Mon Aug 18 2025)

🐛 Bug Fix

🏠 Internal

📝 Documentation

Authors: 4


v0.8.2 (Wed Mar 12 2025)

🏠 Internal

  • Explicitly specify utf-8 encoding while reading top level .md files for description #162 (@yarikoptic)
  • Instruct that long description is in markdown and not ReST #160 (@yarikoptic)

Authors: 1


v0.8.1 (Wed Mar 12 2025)

🏠 Internal

Authors: 1


v0.8.0 (Wed Mar 12 2025)

🚀 Enhancement

  • release: use GitHUb App token for checkout and push #158 (@tmorrell)

⚠️ Pushed to master

🏠 Internal

📝 Documentation

  • Convert CHANGES.rst, CONTRIBUTING.rst, and README.md to markdown #154 (@tmorrell)

Authors: 3


Release 0.7.0 (2025-02-19)

Just to get a release out after long period.

Bug fixes

  • Better handling of ordinals
  • Fix locator conditions (resolves #142)
  • Make family name optional
  • Allow date parts to not be integers
  • Support space macros
  • Fix multiple capitals
  • Fix parsing BibTex integer values

Other changes:

  • Removed support for Python 3.6, 3.7, 3.8 and added for 3.10 - 3.13
  • Switch versioning to versioneer

Release 0.6.0 (2021-05-27)

Bug fixes

  • Various issues on Windows: testing, explicit utf-8 encoding
  • Strings with unescaped \ declared r"aw"

Other changes:

  • Removed support for Python 2.7, 3.5 and added for 3.9
  • Travis CI is removed in favor of GitHub actions testing across all 3 major OSes (MacOS, Windows, GNU/Linux Ubuntu)
  • CSL test-suite progressed from 5779a8c to c3db429

Release 0.5.1 (2020-03-06)

Bug fixed:

  • avoid rnc2rng 2.6.2 which breaks installation of citeproc-py

Release 0.5.0 (2020-02-09)

Enhancements:

  • handle commas and ampersands in a functional style
  • Number: handle commas and ampersands
  • added symbol for textquotesingle
  • specify fallback locales for fr-CA and es-CL
  • improved page number and ranges parsing

Bug fixed:

  • don't fail on empty page ranges (#90) (bbm)
  • detect end of file while parsing incorrect bib (#59) (John Vandenberg)

Other changes:

  • Removed 3.2-3.4 and added 3.7, 3.8 to supported Pythons
  • Refactored locales handling

Release 0.4.0 (2017-06-23)

New features:

  • allow specifying the encoding of a BibTeX database file (#20 and #25)
  • BibTeX 'month' field: support integers and " " values
  • BibTeX 'pages' field: support "10", "10+", "10-12" and "10--12" formats
  • BibTeX entry types: map the non-standard 'thesis' and 'report' entries
  • update the CSL schema to version 1.0.1 (#5)
  • update the CSL locales to commit 49bf3fc0

Bug fixed:

  • avoid crash when there is nothing to affix (David Lesieur)
  • fix BibTeX month to CSL month mapping (#24)
  • strip leading/trailing whitespace from BibTeX values (#37)

Release 0.3.0 (2014-11-07)

Major improvements to the BibTeX parser:

  • split names into parts and assign them to the equivalent CSL name parts
  • fixed handling of accent macros and escaped characters
  • more compatible (La)TeX macro handling in general (but still basic)
  • handle standard Computer Modern ligatures such as --, ---, and <<
  • added unit tests for the BibTeX and LaTeX parsers

Other changes:

  • disable RelaxNG validation of CSL styles by default (API change)

Release 0.2.0 (2014-10-25)

  • bad cite callback function can determine how a bad cite is displayed (hetsch)
  • added option to disable RelaxNG validation (Jasper Op de Coul)
  • distutils was replaced with setuptools (Joshua Carp)
  • bug fixes (Yaroslav Halchenko, David Lesieur)
  • CitationStylesBibliography.bibliography() now returns the list of entries

Metadata

Release files for citeproc-py 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for citeproc-py 0.12.0
File Size Uploaded Provenance Actions
citeproc_py-0.12.0.tar.gz 293.8 kB Without provenance Details for citeproc_py-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for citeproc-py 0.12.0
File Interpreter ABI Platform Actions
citeproc_py-0.12.0-py3-none-any.whl Python 3 none any Details for citeproc_py-0.12.0-py3-none-any.whl

Total release size: 681.8 kB

Release files / citeproc_py-0.12.0.tar.gz

Download URL citeproc_py-0.12.0.tar.gz
Size 293.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de8c7d5afc98d1509e14c7d7d128f2d26007ba20c7a2eca65b02b56240e15759
BLAKE2b-256 checksum
How to use checksums
55238cd25cc416578e82f91ea9411538d1020fc23a434bd673f91145e1adec48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / citeproc_py-0.12.0-py3-none-any.whl

Download URL citeproc_py-0.12.0-py3-none-any.whl
Size 387.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95513bf5aa8e086fe19e66df237460e3c5ebe548c49f92c94ecb43855f73bbaa
BLAKE2b-256 checksum
How to use checksums
cd05d4d9f9825c15e672540e9aea9ae26be725e1fdbf9bea0cda2291d7da542d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for citeproc-py 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page