Pure-Python Unicode-aware casing for Turkic Latin text
Project description
turkicase
A tiny, dependency-free Python package for Unicode-aware Turkic casing.
It preserves the two distinct Latin I case pairs used by Turkish, Azerbaijani, and Common Turkic Alphabet text:
I ↔ ıİ ↔ i
Python's default str.lower() and str.casefold() are locale-independent, so
"I".lower() becomes "i". This package applies the Turkic special-casing
rules from Unicode while retaining Python's normal casing behavior for all
other characters.
Installation
From a local checkout:
python -m pip install .
After publication on PyPI:
python -m pip install turkicase
Usage
from turkicase import lower, upper, casefold
lower("IĞDIR") # "ığdır"
lower("İSTANBUL") # "istanbul"
upper("izmir") # "İZMİR"
upper("ışık") # "IŞIK"
casefold("I") == casefold("ı") # True
casefold("İ") == casefold("i") # True
The longer aliases are also available:
from turkicase import common_turkic_lower, common_turkic_upper, common_turkic_casefold
Combining marks
The implementation includes Unicode's contextual Before_Dot and After_I
rules, so canonically equivalent decomposed input is handled correctly:
lower("I\u0307") # "i"
The result is normalized to NFC by default. Casing contexts are always
evaluated on the original input code points. Pass normalization=None to skip
result normalization.
Development
python -m pip install -e ".[dev]"
pytest
python -m build
python -m twine check dist/*
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turkicase-0.1.0.tar.gz.
File metadata
- Download URL: turkicase-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
101c2ee1800f7ecb381d2f8f57ecc7b5803e9acc81193a0e90f77b4b58f72b52
|
|
| MD5 |
8a6b5cab66855e7a062527d4f6061b9d
|
|
| BLAKE2b-256 |
2f1a816566d869b173bac7aad3e11a009757224c267885b1495fa182166e2bf4
|
File details
Details for the file turkicase-0.1.0-py3-none-any.whl.
File metadata
- Download URL: turkicase-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b092f462a5221359f57b786ac993a9e46eb844d12d471785f8e137c2ed22009
|
|
| MD5 |
410e1cc2aa5db0a8631b0d29b9562f8d
|
|
| BLAKE2b-256 |
7c3ada77b473e4648547519464057dc52151e7f46487b1f6b4f37283f454684c
|