serbian-translit
Deterministic Serbian and Montenegrin script conversion, Cyrillic ↔ Latin. Case preservation, digraph handling, quoted-region protection, Roman-numeral and non-native-word filtering.
Both official scripts of Serbian (and Montenegrin) map one-to-one at the letter level: љ↔lj, њ↔nj, џ↔dž, plus с́↔ś, з́↔ź for Montenegrin. The library plays the pairing from a YAML table; there is no per-language code path in the engine.
Installation
Install the released package from PyPI:
pip install serbian-translit
Usage
from serbian_translit import srp, cnr
srp.to_cyr("Njujork") # 'Њујорк'
srp.to_cyr("LJUBAV") # 'ЉУБАВ'
srp.to_cyr("New York") # 'New York' (word skipped, has non-native letters)
srp.to_cyr('grupa „AC/DC"') # 'група „AC/DC"' (quoted region preserved)
srp.to_lat("Њујорк") # 'Njujork'
cnr.to_cyr("śever") # 'с́евер' (с + U+0301)
cnr.to_lat("с́евер") # 'śever'
Behaviour
- Digraphs
lj,nj,dž(Latin) ↔љ,њ,џ(Cyrillic) with case preservation (Njin title-case position,NJinside all-caps). - Montenegrin extras
ś,ź↔с́,з́(base letter + combining acute U+0301; no precomposed codepoints exist). - Đ variants
Đ(U+0110),đ(U+0111),Ð(U+00D0 Eth),ð(U+00F0 eth) all map toЂ/ђ. - Roman numerals (
II,XIV,XX) stay in Latin regardless of direction. - Words with non-native letters (Latin
w,x,y,q) are skipped whole; treated as foreign inclusions. - Quoted regions (
"…",„…",“…”,«…») are preserved verbatim so brand names and foreign quotes survive round-trip. - Non-alphabetic content (numbers, punctuation, whitespace) is left unchanged.
Rules and tests
Rules live in serbian_translit/data/rules.yaml; test cases in tests/tests.yaml. Both files are the source of truth shared with the Swift and (upcoming) Kotlin ports so behaviour stays identical across languages.
Documentation
The API reference is generated from the public Python API and deployed by GitHub Actions.
Lines of Code
Metadata
Release files for serbian-translit 0.4.3
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 |
|---|---|---|---|---|
| serbian_translit-0.4.3.tar.gz | 11.8 kB | With provenance | Details for serbian_translit-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serbian_translit-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for serbian_translit-0.4.3-py3-none-any.whl |
Total release size: 22.5 kB
Release files / serbian_translit-0.4.3.tar.gz
| Download URL | serbian_translit-0.4.3.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11e0756a0f11d6d86a202ac6a19fb8e20423a8794e8e356ff4f73ee6d73a6d03
|
|
BLAKE2b-256 checksum How to use checksums |
283c9a590795dc5d7583dfe65336592e5329d6eeddf3f4028c421659e429d5a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / serbian_translit-0.4.3-py3-none-any.whl
| Download URL | serbian_translit-0.4.3-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
acad8e135890010491b43b116892aa2045396a55f7bd696cf7954f0465aea779
|
|
BLAKE2b-256 checksum How to use checksums |
263ae1be1c223e5b177cedb1c6dedd86d0f1935371c6a7a11871f685e3aa2722
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logSecurity for serbian-translit 0.4.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for serbian_translit-0.4.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logA 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.