APA7 Style for Pybtex
This is a fork of naeka's pybtex-apa-style, which targeted APA6.
This plugin provides APA7 style for Pybtex.
Pybtex provides Python support for interacting with bibTeX
bibliography data. Style plugins provide support for formatting bibliographies,
similar to the role that csl files play for LaTeX.
Installation
$ pip install pybtex pybtex-apa7-style
Usage
Pybtex uses Python's plugin system. To use APA7, load it as a plugin as shown in the example below.
from pybtex.plugin import find_plugin
from pybtex.database import parse_file
APA = find_plugin('pybtex.style.formatting', 'apa7')()
HTML = find_plugin('pybtex.backends', 'html')()
def bib_to_apa7_html(bibfile):
bibliography = parse_file(bibfile, 'bibtex')
formatted_bib = APA.format_bibliography(bibliography)
return "<br>".join(entry.text.render(HTML) for entry in formatted_bib)
Other output formats
APA.format_bibliography(...) returns Pybtex's own rich-text representation, which is
independent of any particular output format. Rendering to HTML above is just one choice;
swap in a different Pybtex backend to get
plaintext, Markdown, or LaTeX output instead:
TXT = find_plugin('pybtex.backends', 'text')()
MD = find_plugin('pybtex.backends', 'markdown')()
LATEX = find_plugin('pybtex.backends', 'latex')()
entry.text.render(TXT) # 'Ackermann, E. (2001). ...'
entry.text.render(MD) # 'Ackermann, E\\. \\(2001\\)\\. ...'
entry.text.render(LATEX) # 'Ackermann, E. (2001). ...'
The Markdown backend escapes characters like ., (, and ) that are meaningful in
Markdown syntax, which is correct behavior for a Markdown renderer but can look noisy
if you only want plain text. If you just want plaintext, prefer the text backend over
markdown.
Contributing
This is a work in progres; APA style is not fully-specified and has endless edge cases. I would be delighted to receive examples of bibTeX entries which are not formatted correctly in APA.
If you clone this project's repository, you
can add bibTeX exemplars in tests/examples and then run python tests/test_visual_results.py.
Open tests/results.html to see the resulting APA-formatted HTML.
Metadata
Release files for pybtex-apa7-style 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybtex_apa7_style-0.1.5.tar.gz | 18.8 kB | Without provenance | Details for pybtex_apa7_style-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybtex_apa7_style-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for pybtex_apa7_style-0.1.5-py3-none-any.whl |
Total release size: 27.9 kB
Release files / pybtex_apa7_style-0.1.5.tar.gz
| Download URL | pybtex_apa7_style-0.1.5.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c2107746d49d1523e8d1319594b6eb84affaeea2525d507944c836d8edc60d6
|
|
BLAKE2b-256 checksum How to use checksums |
9795e0f2707f3b697363031a8b885c4e7421f13262d7d52d2ef6fc148bc3822d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pybtex_apa7_style-0.1.5-py3-none-any.whl
| Download URL | pybtex_apa7_style-0.1.5-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09c30e44e710449d8884b52b68fee036051114ecdd59df87a7c308070091f234
|
|
BLAKE2b-256 checksum How to use checksums |
75daf69198d7e7d071207d2e81b7572a30e36ea79be0805c98c74ea599a0bcda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pybtex-apa7-style 0.1.5
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.