Skip to main content

lingva — Python SDK

Python client for the Lingva localization platform.

Requires Python 3.11+.

This is a preview package. It follows the same conformance contract as the Swift, Kotlin, and Flutter SDKs but is not yet published to PyPI.


Install

# From the monorepo root (editable install)
pip install -e sdks/python

# With async HTTP support (httpx)
pip install -e "sdks/python[http]"

Once published:

pip install lingva-sdk
pip install "lingva-sdk[http]"   # adds httpx for async delivery

Quickstart

Load from a local bundle file

from lingva import LingvaClient

client = LingvaClient.from_file(".lingva/translations/en.bundle.json")

print(client.t("actions.continue"))           # Continue
print(client.t("welcome.title", name="Alice")) # Welcome, Alice.

Load from CDN (async)

import asyncio
from lingva import LingvaClient, LingvaDeliveryTarget

target = LingvaDeliveryTarget(
    base_url="https://api.lingva.dev",
    project_id="my-project",
    environment="production",
)

async def main():
    client = await LingvaClient.from_url(target, locale="fr", fallback_locale="en")
    print(client.t("welcome.title", name="Alice"))

asyncio.run(main())

Load from CDN (synchronous)

from lingva import LingvaClient, LingvaDeliveryTarget

target = LingvaDeliveryTarget(
    base_url="https://api.lingva.dev",
    project_id="my-project",
    environment="production",
)

client = LingvaClient.from_url_sync(target, locale="fr", fallback_locale="en")
print(client.t("welcome.title", name="Alice"))

API

LingvaClient

Method / Property Description
LingvaClient.from_bundle(bundle) Create from a parsed dict
LingvaClient.from_file(path, *, fallback_path=None) Load from filesystem
LingvaClient.from_url_sync(target, locale, ...) Synchronous HTTP fetch
await LingvaClient.from_url(target, locale, ...) Async HTTP fetch (requires lingva[http])
.t(key, **variables) Translate a key with optional {varname} substitution
.has(key) Check if a key exists
.locale Active locale string
.fallback_locale Fallback locale string or None
.bundle() Raw bundle dict (for last-valid caching)

LingvaDeliveryTarget

LingvaDeliveryTarget(
    base_url="https://api.lingva.dev",
    project_id="my-project",
    environment="production",          # default
    uri_template="...",                # optional custom path template
)
target.resolve("fr")
# -> "https://api.lingva.dev/bundles/my-project/production/latest/fr.bundle.json"

Bundle schema

The SDK reads schemaVersion 1 bundles. Variables use {varname} syntax. Unknown variables pass through unchanged.

{
  "schemaVersion": 1,
  "locale": "en",
  "fallbackLocale": "en",
  "fallbackKeys": [],
  "messages": {
    "actions.continue": "Continue",
    "welcome.title": "Welcome, {name}."
  }
}

Metadata

Release files for lingva-sdk 0.1.0

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

Source distribution (sdist)

Source distribution for lingva-sdk 0.1.0
File Size Uploaded
lingva_sdk-0.1.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lingva-sdk 0.1.0
File Interpreter ABI Platform
lingva_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / lingva_sdk-0.1.0.tar.gz

Download URL lingva_sdk-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
db329524207acb0c6e3198fca0a8b66f6856c0bc0a0bb11b4f2be953f9914d08
BLAKE2b-256 checksum
How to use checksums
1af61b929a87b155de9340062188161f77ffb3ea6e8fe532dcb3581f2f4e3b7f
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 Oct 3, 2026.

Transparency log

Release files / lingva_sdk-0.1.0-py3-none-any.whl

Download URL lingva_sdk-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4ac0796c97aa56c45c8f256a3071ff70f9667685ec7cbb2721b03aabc27a7d5
BLAKE2b-256 checksum
How to use checksums
541c9054dc441a54df60a4cd8ff8b35fc0b9ea81d798bfa94cf371aae6aad855
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 Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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