matra
Find code that breaks text written in Indian scripts.
Most text code is written and tested in English. Run it on Hindi, Bengali, Tamil or any of India's scripts and it fails quietly: words fall apart, real names are rejected, and truncated text ends in half a syllable. The cause is almost always the same. Indian scripts write vowels as combining marks (matras) attached to consonants, and ASCII-minded code does not count those marks as letters.
matra finds that code in JavaScript/TypeScript, Python, Go and Rust, shows the word it breaks, and gives the fix. matra fuzz then proves it by running your own functions on real words in 11 scripts.
$ matra demo
What ASCII-minded Python does to Indian-script text:
re.findall(r'\w+', 'हिंदी') -> ['ह', 'द']
'हिंदी'.isalpha() -> False
re.fullmatch(r'[A-Za-z ]+', 'प्रिया') -> None
'क्षमा'[:2] -> 'क्'
'हिंदी'[::-1] -> 'ीदंिह'
None of these is exotic. 'हिंदी'.isalpha() is False, and so is isalpha() for every word with a vowel sign in Tamil, Bengali, Telugu, Punjabi and the rest. So a name check built on it rejects every name written in an Indian script. In JavaScript, /\w+/u matches nothing at all in 'हिंदी', and \b finds no word boundary in 'தமிழ்'.
Install
pip install matra-lint
Use
matra check . # scan a project
matra check src --min-confidence medium
matra check . --format sarif > matra.sarif # GitHub code scanning
matra rules # every rule with its evidence
matra fuzz myapp.text:truncate --kind truncate
check exits with 1 when it finds something, so it can gate CI. Silence a line with # matra: ignore or // matra: ignore[MAT006], or a whole file (fixtures, test data) with matra: ignore-file in its first 10 lines.
Rules
Every rule's evidence is checked by the test suite against the real runtime, not assumed.
| Rule | Languages | Confidence | Flags | Breaks because |
|---|---|---|---|---|
| MAT001 ascii-word-class | JS/TS, Python, Go | medium | \w, \b in a regex |
re.findall(r'\w+', 'हिंदी') == ['ह', 'द']; in JS /\w+/u finds nothing |
| MAT002 letters-without-marks | all | high | [\p{L}...]+ with no \p{M} |
'हिंदी'.match(/[\p{L}]+/gu) gives ['ह', 'द'] |
| MAT003 isalpha-rejects-indic | Python | high | .isalpha(), .isalnum() |
False for every word with a vowel sign |
| MAT004 go-isletter-without-ismark | Go | medium | unicode.IsLetter with no IsMark in the file |
vowel signs are category M, not L |
| MAT005 ascii-only-name-pattern | all | medium | [A-Za-z] on a name, city or address |
rejects प्रिया |
| MAT006 truncation-splits-syllables | all | low | title.slice(0, n), text[:n], &name[..n] |
'क्षमा'[:2] == 'क्'; in Rust a byte cut can panic |
| MAT007 per-character-reversal | all | low | s[::-1], .split('').reverse() |
'हिंदी'[::-1] starts with an orphan vowel sign |
| MAT008 alphanumeric-word-edge-drops-marks | rs | medium | trim_matches(|c| !c.is_alphanumeric()), rfind(char::is_alphanumeric) |
"தமிழ்" trims to "தமிழ": the pulli is not alphanumeric. Found real bugs in clipy#986 |
Rust's \w already includes marks, so MAT001 skips Rust.
Fuzz your own functions
Static rules can only guess. The fuzz checks run your function on real words and report exactly which word broke:
from matra.fuzz import check_truncate, check_tokenize, check_validator
check_truncate(my_truncate) # my_truncate(text, n) -> str: must end on a grapheme boundary
check_tokenize(my_tokenize) # my_tokenize(text) -> list[str]: must keep words whole
check_validator(is_valid_name) # is_valid_name(name) -> bool: must accept real names
Grapheme boundaries come from Unicode's own rules (UAX #29, including the conjunct rules added in Unicode 15.1), via the regex module.
In CI
- uses: RaktimChandra/matra-lint@main
with:
min-confidence: medium # findings also appear in the Security tab
Found in the wild
- A hotel-booking app's
validate_nameused^[A-Za-z]+...$.matra fuzz --kind validateshowed it rejected all 9 real names in 9 scripts (राकेश, முருகன், সৌরভ, ...). - Clipy #982: a transcript grouper used
char::is_alphanumeric, which counts vowel signs as letters, so a loneिtoken after a pause splitकिinto two segments.
Limits
This is a line-based scanner, not a type checker. It cannot know whether a given title[:40] ever sees Indian-script text, which is why truncation and reversal are marked low confidence. Use --min-confidence medium for a quieter first run.
License
MIT
Metadata
Release files for matra-lint 0.2.0
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 |
|---|---|---|---|---|
| matra_lint-0.2.0.tar.gz | 15.6 kB | With provenance | Details for matra_lint-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matra_lint-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for matra_lint-0.2.0-py3-none-any.whl |
Total release size: 30.7 kB
Release files / matra_lint-0.2.0.tar.gz
| Download URL | matra_lint-0.2.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03f912058fb51cd1b357814fcb784354657d0881a97292acd972a4e77621a3f6
|
|
BLAKE2b-256 checksum How to use checksums |
ab64c31032f2ac1bbda51f057dc097d4b850fe26a459ed9e231fe93f86d0badb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / matra_lint-0.2.0-py3-none-any.whl
| Download URL | matra_lint-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e7fc7a4c0f77fb1542bfd3aac66a4f97d0a09133ac6c4481130ab54cadfbefa
|
|
BLAKE2b-256 checksum How to use checksums |
d3399f1d7b86c336652edf291de32e1a4f08266ac82c4add389188771eb0a6d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logSecurity for matra-lint 0.2.0
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 matra_lint-0.2.0.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 Dec 2, 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.