Firefox Translations neural machine-translation engine — native (compiled Rust), batteries-included model management.
Project description
fxtranslate
Translate with Firefox Translations models from Python — a library powered by the same lightweight, CPU-only models Firefox ships for on-device translation. The engine is native compiled Rust (fast, CPU-only, no GPU), and it discovers, downloads, and caches the models for you; no API keys, no network round-trips to a translation service, nothing leaves your machine after the model download.
Unlike the npm/wasm build, the Python wheel ships the fast, batteries-included engine: the gemmology SIMD int8 GEMM kernel, mmap, ICU4X sentence segmentation, and built-in networked model discovery/download/caching. Prefer a native binary, a Rust dependency, or Node? See Related packages.
Install
$ pip install fxtranslate
The first release ships an sdist plus one platform wheel (built on the release machine). On other platforms pip compiles from source — that needs a Rust and C++ toolchain, and it falls back to the portable scalar kernel automatically if no SIMD backend is wired for your target — until the full binary-wheel matrix lands.
Library, batteries-included
Lead with this — the native advantage over the wasm build. One call discovers the model for the pair, downloads and hash-verifies it into a local cache, builds the engine, and is ready to translate:
from fxtranslate import Translator
t = Translator.load("en", "es") # discover → download → cache → ready
print(t.translate("The weather is nice today."))
# El clima es agradable hoy.
# translate_long segments multi-sentence / long input and translates each part
# within the model's context window, instead of truncating.
print(t.translate_long(long_article))
Library, bring-your-own model
If you already have the model files on disk (recommended for production — see The models), pass the bytes directly. You supply the marian .bin model and the source/target SentencePiece vocabularies (the same file for most pairs; only CJK pairs differ) — pass the source vocab twice for a shared-vocab pair:
from fxtranslate import Translator
model = open("en-es/model.bin", "rb").read()
vocab = open("en-es/vocab.spm", "rb").read()
t = Translator(model, vocab, vocab) # src vocab twice for shared-vocab pairs
print(t.translate("The weather is nice today."))
Discovery helpers
fxtranslate.discovery re-exports the pure model-discovery/routing surface the batteries-included path is built on — over a Remote Settings records body, returning native Python objects (no JSON strings) — for building your own model-management flow:
from fxtranslate import discovery
route = discovery.resolve_route(records_json, "en", "es") # {"kind": "direct", ...}
cat = discovery.catalog(records_json, "en") # {"bidirectional": [...], ...}
pairs = discovery.model_pairs(records_json) # list[(src, trg)]
recs = discovery.parse_records(records_json) # list[dict]
sents = discovery.segment_sentences(text) # list[str] (ICU4X UAX #29)
plain = discovery.verify_and_decompress(zst_bytes, sha256_hex) # bytes
The models
fxtranslate uses the models Firefox ships. They're discovered through Mozilla's Remote Settings and downloaded from Firefox's CDN, then cached under the platform-native cache directory — ~/Library/Caches/fxtranslate/models on macOS, $XDG_CACHE_HOME/fxtranslate/models on Linux, %LOCALAPPDATA%\fxtranslate\models on Windows — one subdirectory per language pair.
That hosting is provisioned for Firefox, not for third-party traffic, and neither the endpoints nor the availability of any particular model are a stable contract for downstream projects. Translator.load is a convenient way to try the engine; if you're shipping a product on top of it, mirror the model files you depend on, serve them from infrastructure you control, and load them with the bring-your-own-model Translator(...) constructor.
Related packages
The same engine is published across ecosystems on one shared version, so you can pick the artifact that fits:
fxtranslate(crates.io) — the Rust engine library. Native SIMD int8 kernel, optional built-in model management.fxtranslate-cli(crates.io) — the native Rust CLI, installed withcargo install fxtranslate-cli.fxtranslate(npm) — the Node CLI + library (WebAssembly core).
License
MPL-2.0. The engine is a Rust port of the Firefox Translations inference engine.
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 Distributions
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 fxtranslate-0.4.2.tar.gz.
File metadata
- Download URL: fxtranslate-0.4.2.tar.gz
- Upload date:
- Size: 397.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c276d4ff31a2bbb673be37f2d07ce4b477adc13b760d6b91ef0e9984c22aff2
|
|
| MD5 |
2cac3350605978bc7a80d8a1be96c8c6
|
|
| BLAKE2b-256 |
76047886f4013ed3ca2739d88c84d2f8ebf32f0d61fe3f683980d3c224b85c97
|
Provenance
The following attestation bundles were made for fxtranslate-0.4.2.tar.gz:
Publisher:
pypi-wheels.yml on gregtatum/translations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fxtranslate-0.4.2.tar.gz -
Subject digest:
2c276d4ff31a2bbb673be37f2d07ce4b477adc13b760d6b91ef0e9984c22aff2 - Sigstore transparency entry: 2204703317
- Sigstore integration time:
-
Permalink:
gregtatum/translations@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Branch / Tag:
refs/tags/fxtranslate-v0.4.2 - Owner: https://github.com/gregtatum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-wheels.yml@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fxtranslate-0.4.2-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: fxtranslate-0.4.2-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c882849e744ec869639f36ddec24064e07991b240846609f43e7f5e480ee8507
|
|
| MD5 |
797749b6161a8cd7ac769b8c17dd5c9e
|
|
| BLAKE2b-256 |
7fc2908d75b0a1bcd6f8ac2b510297b9a8708ee33db894135e13072d9400dab0
|
Provenance
The following attestation bundles were made for fxtranslate-0.4.2-cp38-abi3-win_amd64.whl:
Publisher:
pypi-wheels.yml on gregtatum/translations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fxtranslate-0.4.2-cp38-abi3-win_amd64.whl -
Subject digest:
c882849e744ec869639f36ddec24064e07991b240846609f43e7f5e480ee8507 - Sigstore transparency entry: 2204703330
- Sigstore integration time:
-
Permalink:
gregtatum/translations@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Branch / Tag:
refs/tags/fxtranslate-v0.4.2 - Owner: https://github.com/gregtatum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-wheels.yml@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7db1aeb474a7c568ca6531a130ca4ddd528f9421c2da88eca2d19a33bb51c16
|
|
| MD5 |
e13761241d92c20c6216326c7ab1bc8b
|
|
| BLAKE2b-256 |
c20791c7d0324f8f427bb0d694422bde99d93270df1994954e9f8733e877b1ef
|
Provenance
The following attestation bundles were made for fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
pypi-wheels.yml on gregtatum/translations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
b7db1aeb474a7c568ca6531a130ca4ddd528f9421c2da88eca2d19a33bb51c16 - Sigstore transparency entry: 2204703335
- Sigstore integration time:
-
Permalink:
gregtatum/translations@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Branch / Tag:
refs/tags/fxtranslate-v0.4.2 - Owner: https://github.com/gregtatum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-wheels.yml@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
511aafe82ddad8814a11819a018062f35cd3a9dc166d2aa436a6c8c915f64a0b
|
|
| MD5 |
ff41b889e68b0b8972ba06f7e5e0ebad
|
|
| BLAKE2b-256 |
05c27e2b0668cc107f6d3b2437732de2105c47b45f6eea0fcbd2e81443b13624
|
Provenance
The following attestation bundles were made for fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
pypi-wheels.yml on gregtatum/translations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
511aafe82ddad8814a11819a018062f35cd3a9dc166d2aa436a6c8c915f64a0b - Sigstore transparency entry: 2204703323
- Sigstore integration time:
-
Permalink:
gregtatum/translations@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Branch / Tag:
refs/tags/fxtranslate-v0.4.2 - Owner: https://github.com/gregtatum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-wheels.yml@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
251ac787436ab9ccf8063e0e8da504e7d68663d2dd03d3bdc1eaeb73f66f191a
|
|
| MD5 |
7cd6a97282bbbc0abaa1e478a23b3bc8
|
|
| BLAKE2b-256 |
b1955b8faea7d15d6a2c9e671955ed726a354f7d2eacc68e30e4b4660d30704b
|
Provenance
The following attestation bundles were made for fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
pypi-wheels.yml on gregtatum/translations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
251ac787436ab9ccf8063e0e8da504e7d68663d2dd03d3bdc1eaeb73f66f191a - Sigstore transparency entry: 2204703328
- Sigstore integration time:
-
Permalink:
gregtatum/translations@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Branch / Tag:
refs/tags/fxtranslate-v0.4.2 - Owner: https://github.com/gregtatum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-wheels.yml@5e8eb732bf1636e1fe811e85cc1ad0f1a8b0cc5e -
Trigger Event:
push
-
Statement type: