| 1 |
# citeproc-py |
| 2 |
|
| 3 |
[](https://pypi.org/project/citeproc-py/) |
| 4 |
[](https://github.com/citeproc-py/citeproc-py/actions?query=branch%3Amaster+workflow%3ATest) |
| 5 |
[](https://coveralls.io/github/citeproc-py/citeproc-py) |
| 6 |
|
| 7 |
|
| 8 |
citeproc-py is a [CSL](https://citationstyles.org/) processor for Python. It aims to implement the |
| 9 |
[CSL 1.0.2 specification](https://docs.citationstyles.org/en/v1.0.2/specification.html). |
| 10 |
citeproc-py can output styled citations and |
| 11 |
bibliographies in a number of different output formats. Currently |
| 12 |
supported are plain text, reStructuredText and HTML. Other formats can |
| 13 |
be added easily. |
| 14 |
|
| 15 |
citeproc-py uses [semantic versioning](https://semver.org/). Currently, its major version |
| 16 |
number is still at 0, meaning the API is not yet stable. However, you |
| 17 |
should not expect to see any major API changes soon. |
| 18 |
|
| 19 |
## Requirements |
| 20 |
|
| 21 |
citeproc-py supports Python 3.9 and up. It depends on [lxml](https://lxml.de/) for parsing and |
| 22 |
navigating the CSL style and locale files. |
| 23 |
|
| 24 |
# Installation |
| 25 |
|
| 26 |
The recommended way of installing citeproc-py is by using |
| 27 |
[pip](https://pip.pypa.io/en/latest/): |
| 28 |
```bash |
| 29 |
pip install citeproc-py |
| 30 |
``` |
| 31 |
|
| 32 |
If `lxml` isn't installed, `pip` will try to install it for you. |
| 33 |
|
| 34 |
If you insist, you can manually install citeproc-py from distribution packages |
| 35 |
hosted at [PyPI](https://pypi.python.org/pypi/citeproc-py/). Please ignore the release archives offered by GitHub. |
| 36 |
|
| 37 |
## Getting Started |
| 38 |
|
| 39 |
To get started with citeproc-py, take a look at the examples under |
| 40 |
`examples/`. Two examples are provided, one parsing references from a |
| 41 |
JSON representation of references as supported by citeproc-js, another |
| 42 |
parsing the references from a BibTeX file. Both show and explain how to |
| 43 |
cite references and render the bibliography. |
| 44 |
|
| 45 |
## CSL Compatibility |
| 46 |
|
| 47 |
Currently, citeproc-py passes about 60% of the tests in the |
| 48 |
[citeproc-test suite](https://github.com/citation-style-language/test-suite). |
| 49 |
A non-exhaustive list of functionality that is missing includes: |
| 50 |
|
| 51 |
- disambiguation/year-suffix |
| 52 |
- et-al-subsequent-min/et-al-subsequent-use-first |
| 53 |
- collapsing |
| 54 |
- punctuation-in-quote |
| 55 |
- display |
| 56 |
|
| 57 |
Also, some [citeproc-js](https://github.com/juris-m/citeproc-js) |
| 58 |
functionality that is not part of the CSL spec is not (yet) supported: |
| 59 |
|
| 60 |
- raw dates |
| 61 |
- static-ordering |
| 62 |
- literal names |
| 63 |
|
| 64 |
## Contributing |
| 65 |
|
| 66 |
citeproc-py is 100% volunteer maintained, and new contributions are always welcome. |
| 67 |
If you would like to contribute, please follow the guidelines in the |
| 68 |
[CONTRIBUTING.md](https://github.com/citeproc-py/citeproc-py/blob/master/CONTRIBUTING.md) file. |
| 69 |
|
| 70 |
## Local Install and Running the Tests |
| 71 |
|
| 72 |
First clone the `citeproc-py` repository and install the submodules with |
| 73 |
```bash |
| 74 |
git submodule update --init |
| 75 |
``` |
| 76 |
|
| 77 |
Then install with |
| 78 |
```bash |
| 79 |
pip install --editable .[tests] |
| 80 |
``` |
| 81 |
|
| 82 |
You can run all the tests using tox: |
| 83 |
```bash |
| 84 |
tox run -e py314 |
| 85 |
``` |
| 86 |
|
| 87 |
Or you can manually run citeproc-test tests using |
| 88 |
```bash |
| 89 |
python tests/citeproc-test.py |
| 90 |
``` |
| 91 |
|
| 92 |
The first time |
| 93 |
you run the script it will clone the |
| 94 |
[citeproc-test suite](https://github.com/citation-style-language/test-suite) repository into the |
| 95 |
`tests` directory and checkout the last tested version. By default failed tests are |
| 96 |
automatically added into the `failing_tests.txt` file and aren't shown when |
| 97 |
running the test suite again. |
| 98 |
|
| 99 |
If you want git to fully ignore the submodule, you can type |
| 100 |
```bash |
| 101 |
git update-index --assume-unchanged citeproc/data/schema |
| 102 |
``` |