Skip to main content

indic-language-utils

Provider-neutral foundations for Indian language operations in Python.

indic-language-utils standardizes language detection, neural machine translation, script identification, and text processing across Indian languages. It abstracts concrete cloud and local engines behind unified, resilient interfaces, allowing applications to start with local or low-cost providers and switch routing configuration for production without rewriting business logic.

Key Features

  • Provider Neutrality: Code against high-level capability interfaces. Swap, configure, or chain providers without changing text processing or domain code.
  • Text Translation: Translate plain text or complex Markdown documents across 22 scheduled Indian languages and English.
  • Text Language Detection: Identify languages using offline FastText classification (lid.176.ftz) or cloud inference pipelines via Bhashini.
  • Script Identification: Fast, zero-dependency Unicode script identification across 12+ Indic scripts and Latin.
  • Document and Code Protection: Structural pre-processors and post-processors protect headings, bullet markers, inline code spans, URLs, and code blocks from neural translation corruption.
  • Resilient Execution: Automatic multi-provider fallback routing, bounded concurrency limits per provider, and exponential backoff retries with jitter.
  • High-Performance Caching: In-memory LRU and multi-process SQLite caches with write-ahead logging (WAL mode) and stampede protection.
  • Canonical Normalization: Shared language registry recognizing all 22 Eighth Schedule Indian languages plus English, mapping aliases and regional codes to BCP 47.
  • Localization Catalogs: Match reviewed human translations for critical UI strings before dispatching to neural engines.

Getting started

Install the core package with pip install indic-language-utils. Provider selection is explicit, and local detection requires an optional extra. The installation and quick start guide covers a credential-free setup, Bhashini configuration, and the first detection and translation calls.

Supported Providers

Provider Capability Mode Prerequisites
Bhashini Translation, Detection Cloud API API key, Endpoint, Service ID
FastText Text Language Detection Offline / Local [local-tld] extra
Google Translate Translation Cloud (unofficial) [googletrans] extra

Configuration

The library uses a tiered configuration system combining project TOML files (.indic-language-utils.toml), environment variables, and programmatic overrides.

Example .indic-language-utils.toml:

[cache]
enabled = true
backend = "sqlite"
path = ".cache/translations.sqlite3"
max_entries = 50000
ttl_seconds = 86400

[retry]
max_attempts = 3
base_delay_seconds = 0.25
max_delay_seconds = 5.0

[providers.bhashini]
endpoint = "https://dhruva-api.bhashini.gov.in/services/inference/pipeline"
translation_service_id = "default-translation-model-id"
detection_service_id = "default-tld-model-id"
max_concurrency = 8

[routes]
translation = ["bhashini", "googletrans"]
text_language_detection = ["bhashini", "fasttext"]

Supply credentials securely through environment variables:

export BHASHINI_API_KEY="your-bhashini-api-key"

Documentation

Comprehensive guides are available in the documentation site:

Development

Install the locked development environment with uv:

uv sync --dev
uv run pre-commit install

Run test suite, code quality checks, and local documentation server:

uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest
uv build
uv run mkdocs serve
uv run mkdocs build --strict

License

This project is licensed under the MIT License.

Release files for indic-language-utils 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indic-language-utils 0.1.1
File Size Uploaded
indic_language_utils-0.1.1.tar.gz 135.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for indic-language-utils 0.1.1
File Interpreter ABI Platform
indic_language_utils-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 195.9 kB

Release files / indic_language_utils-0.1.1.tar.gz

Download URL indic_language_utils-0.1.1.tar.gz
Size 135.4 kB
Tags Source
SHA-256 checksum
How to use checksums
96554f468eeea49716a17cfd4346dc5432d8cd7368749c3f976ed83b193e7526
BLAKE2b-256 checksum
How to use checksums
75ef95f44331466eb8531428d456d108e11a5322ae6a5d64dc247ce26f6b41f1
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 22, 2026.

Transparency log

Release files / indic_language_utils-0.1.1-py3-none-any.whl

Download URL indic_language_utils-0.1.1-py3-none-any.whl
Size 60.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59697b40ddacd946d8ac8ae11565b9e1bf5e56cd00df0b54972b3446a1886594
BLAKE2b-256 checksum
How to use checksums
f445a15b80aed747de890757f48af9db9b5576fa2dc4f0fde99dfa4b5eb94fc7
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 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page