TransTex (Python)
Reference conversion helpers for BibTeX plus APA 6th/7th, IEEE, MLA 9th, Chicago (author-date), and Vancouver styles.
Features
- Parse BibTeX entries into structured
Referenceobjects. - Serialize references back to clean BibTeX.
- Convert formatted citations between supported styles.
- Handle common book/chapters and web sources in addition to journal articles.
- Provide runnable examples and unit tests.
Project layout
src/ # Library source code (transtex package)
tests/ # Unit tests built with unittest
examples/ # Small runnable scripts demonstrating the API
Getting started
Use uv to run commands without mutating the base environment:
uv run python examples/format_from_bibtex.py
You can also round-trip formatted citations back into BibTeX:
uv run python examples/citation_to_bibtex.py
Convert citations across styles (APA → IEEE/Chicago/MLA, and back):
uv run python examples/convert_citation_styles.py
See book/web coverage:
uv run python examples/book_and_web_examples.py
Usage
Format a Reference in multiple styles:
from transtex import (
Reference,
format_apa,
format_apa7,
format_ieee,
format_mla,
format_chicago,
format_vancouver,
reference_to_bibtex,
)
ref = Reference(
entry_type="article",
cite_key="doe2020deep",
title="Deep Learning for Everything",
authors=["John Doe", "Jane Smith"],
journal="Journal of Omniscience",
year="2020",
volume="42",
issue="7",
pages="1-10",
doi="10.1000/j.jo.2020.01.001",
)
print(format_apa(ref))
print(format_apa7(ref))
print(format_ieee(ref))
print(format_mla(ref))
print(format_chicago(ref))
print(format_vancouver(ref))
print(reference_to_bibtex(ref))
Parse a formatted citation back to BibTeX:
from transtex import citation_to_bibtex
ieee_text = 'J. Doe and J. Smith, "Deep Learning for Everything," Journal of Omniscience, vol. 42, no. 7, pp. 1–10, 2020, doi: 10.1000/j.jo.2020.01.001.'
bibtex = citation_to_bibtex("ieee", ieee_text)
print(bibtex)
Book / web example
from transtex import Reference, format_apa, format_ieee
book_ref = Reference(
entry_type="book",
cite_key="turing1950",
title="Computing Machinery and Intelligence",
authors=["Alan M. Turing"],
publisher="Oxford University Press",
place="Oxford, UK",
year="1950",
edition="2nd ed.",
pages="1-120",
)
web_ref = Reference(
entry_type="misc",
cite_key="ada1843",
title="Sketch of the Analytical Engine",
authors=["Ada Lovelace"],
year="1843",
url="https://example.org/analytical-engine",
accessed_date="2024-02-10",
)
print(format_apa(book_ref))
print(format_ieee(web_ref))
Running tests
uv run python -m unittest
Metadata
Release files for transtex 1.0.2
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 |
|---|---|---|---|---|
| transtex-1.0.2.tar.gz | 58.3 kB | Without provenance | Details for transtex-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| transtex-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for transtex-1.0.2-py3-none-any.whl |
Total release size: 141.3 kB
Release files / transtex-1.0.2.tar.gz
| Download URL | transtex-1.0.2.tar.gz |
|---|---|
| Size | 58.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63e28788f20bd50519a5d2868be6125f345a6742793d9d85a582d9b18c85e405
|
|
BLAKE2b-256 checksum How to use checksums |
51e778192b2bd7672517022fac7aa7dedaf6d1191f6705c2a19b877e66d73e95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Release files / transtex-1.0.2-py3-none-any.whl
| Download URL | transtex-1.0.2-py3-none-any.whl |
|---|---|
| Size | 82.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e1653fd589f1f9ca00625170cc167b1aa877c616b1f204baa403aa6dafb26f0
|
|
BLAKE2b-256 checksum How to use checksums |
4681e8d7af147a1c6d1946ada7745d1429d96d10b9aa1cc680111c149f8533a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Security for transtex 1.0.2
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.